Configuration of data source, Discourse integration and OAuth 2.0 security providers such as Google, Facebook or Twitter
for production environment is externalized into file called mc-config.groovy.
|
Important
|
You always have to provide the mc-config.groovy file with at least Database Configuration present
otherwise the catalogue will not start.
|
For local testing place your mc-config.groovy file into your $USER_HOME/.grails/ directory.
For running on Tomcat place your mc-config.groovy file into your Tomcat’s conf directory ($CATALINA_BASE/conf/).
For detailed information about setting the data source, please, follow the instruction in the DataSource section of the Grails Reference Documentation.
|
Note
|
Model Catalogue has been so far tested only using MySQL Database. Default configuration provides you the MySQL driver out of the box. |
dataSource {
pooled = true
dbCreate = "update"
url = "jdbc:mysql://localhost:3306/my_database?autoReconnect=true&useUnicode=yes"
driverClassName = "com.mysql.jdbc.Driver"
dialect = org.hibernate.dialect.MySQLDialect
username = "username"
password = "password"
properties {
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = "SELECT 1"
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
jdbcInterceptors = "ConnectionState;StatementCache(max=200)"
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}
}
Mail plugin must be configured properly to allow user registration (enabled by grails.mc.allow.signup configuration
property set to true).
For detailed information about setting the data source, please, follow the instruction in Grails Mail Plugin Documentation where you can see the configuration for most common mail providers. By default the application expects unsecured mail server running on the localhost.
Following three providers are included out of the box:
You must configure the provides to enable them. See the documentation for particular plugin for details.
Due issues in class loading following APIs implementation must be used:
-
org.modelcatalogue.repack.org.scribe.builder.api.FacebookApi -
org.modelcatalogue.repack.org.scribe.builder.api.GoogleApi20 -
org.modelcatalogue.repack.org.scribe.builder.api.TwitterApi
-
Create new project in Google Developers Console
-
Open new project and navigate to menu:APIs & auth [Credentials]
-
Press the btn:Create new Client ID, select Web Application and fill your website URL into Authorized JavaScript origins input and your website URL followed by
/oauth/google/callbackinto Authorized redirect URIs -
Use generated Client ID and Client secret in the following configuration
oauth {
providers {
google {
// this key is limited to localhost only so no need to hide it
api = org.modelcatalogue.repack.org.scribe.builder.api.GoogleApi20
key = 'change-to-key-from-console'
secret = 'change-to-secret-from-console'
successUri = '/oauth/google/success'
failureUri = '/oauth/google/error'
callback = "${grails.serverURL}/oauth/google/callback"
scope = 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email'
}
}
}
You can customize the text of the home page by setting HTML content into the mc.welcome.jumbo and mc.welcome.info
configuration properties. The mc.welcome.jumbo replaces content in the big grey box, the mc.welcome.info the
text under the big gray box.