-
Notifications
You must be signed in to change notification settings - Fork 29
/
Config.groovy
313 lines (270 loc) · 11.1 KB
/
Config.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
// locations to search for config files that get merged into the main config
// config files can either be Java properties files or ConfigSlurper scripts
// grails.config.locations = [ "classpath:${appName}-config.properties",
// "classpath:${appName}-config.groovy",
// "file:${userHome}/.grails/${appName}-config.properties",
// "file:${userHome}/.grails/${appName}-config.groovy"]
// if(System.properties["${appName}.config.location"]) {
// grails.config.locations << "file:" + System.properties["${appName}.config.location"]
// }
grails.resources.adhoc.excludes = ['/plugins/weceem-1.4-SNAPSHOT']
grails.mime.file.extensions = false // enables the parsing of file extensions from URLs into the request format
grails.mime.use.accept.header = false
grails.mime.types = [ html: ['text/html','application/xhtml+xml'],
xml: ['text/xml', 'application/xml'],
text: 'text/plain',
js: 'text/javascript',
rss: 'application/rss+xml',
atom: 'application/atom+xml',
css: 'text/css',
csv: 'text/csv',
all: '*/*',
json: ['application/json','text/json'],
form: 'application/x-www-form-urlencoded',
multipartForm: 'multipart/form-data'
]
// The default codec used to encode data with ${}
grails.views.default.codec="html" // none, html, base64
// GSP settings
grails {
views {
gsp {
encoding = 'UTF-8'
htmlcodec = 'xml' // use xml escaping instead of HTML4 escaping
codecs {
expression = 'html' // escapes values inside ${}
scriptlet = 'html' // escapes output from scriptlets in GSPs
taglib = 'none' // escapes output from taglibs
staticparts = 'none' // escapes output from static template parts
}
}
// escapes all not-encoded output at final stage of outputting
// filteringCodecForContentType.'text/html' = 'html'
}
}
grails.views.gsp.encoding="UTF-8"
// Bootstrap
grails.plugins.twitterbootstrap.fixtaglib = true
// Set JSON encoded dates to JS native ie. new Date(1194127343161)
grails {
converters {
encoding="UTF-8"
json {
date = 'javascript'
}
}
}
//cache.headers.enabled = false
// enabled native2ascii conversion of i18n properties files
grails.enable.native2ascii = true
// configure auto-caching of queries by default (if false you can cache individual queries with 'cache: true')
grails.hibernate.cache.queries = false
// configure passing transaction's read-only attribute to Hibernate session, queries and criterias
// set "singleSession = false" OSIV mode in hibernate configuration after enabling
grails.hibernate.pass.readonly = false
// configure passing read-only to OSIV session by default, requires "singleSession = false" OSIV mode
grails.hibernate.osiv.readonly = false
weceem.profile.url = [controller:'userProfile', action:'edit']
weceem.logout.url = [controller:'logout']
weceem.content.prefix = ''
weceem.admin.prefix = 'admin'
weceem.tools.prefix="cms/tools"
weceem.space.templates = [
default: "classpath:/org/weceem/resources/default-space-template.zip",
basic:"classpath:/org/weceem/resources/basic-space-template.zip"]
weceem.springsecurity.details.mapper = { ->
[ // Stuff required by weceem spring sec
username: username,
password: passwd,
enabled: enabled,
accountNonExpired: accountNonExpired,
credentialsNonExpired: credentialsNonExpired,
accountNonLocked: accountNonLocked,
authorities: authorities,
// optional stuff we add
email: email,
description: description,
firstName: firstName,
lastName: lastName,
id: id
]
}
// configure custom page for HTTP 404 response
// weceem.page404 = 'test404page'
// configure custom page for HTTP 406 response
// weceem.page406 = 'test406page'
grails.validateable.packages=['org.weceem']
// Configure Spring Security
grails.plugin.springsecurity.rejectIfNoRule = false
grails.plugin.springsecurity.fii.rejectPublicInvocations = false
grails.plugin.springsecurity.securityConfigType = 'InterceptUrlMap'
grails {
plugin {
springsecurity {
active = true
//registerLoggerListener = true
password.algorithm = "SHA-512"
dao.reflectionSaltSourceProperty = 'username'
//use Base64 text ( true or false )
password.encodeHashAsBase64 = false
adh.errorPage = "null"
// Turn of user caching, acegi plugin requires diskstore cache by default, which we don't want.
cacheUsers = false
/** login user domain class name and fields */
userLookup.userDomainClassName = "org.weceem.auth.CMSUser"
userLookup.userNamePropertyName = "username"
userLookup.passwordPropertyName = "passwd"
userLookup.enabledPropertyName = "enabled"
userLookup.authoritiesPropertyName = "authorities"
/**
* Authority domain class authority field name
* authorityFieldInList
*/
authority.className = "org.weceem.auth.CMSRole"
authority.nameField = "authority"
interceptUrlMap = [
'/admin/users/**': ['hasRole(\'ROLE_ADMIN\')', 'isRememberMe()'],
'/admin/**': ['hasRole(\'ROLE_ADMIN\')', 'isRememberMe()'],
'/ck/**': ['isRememberMe()'],
'/*': ['permitAll'],
'/login/**': ['permitAll'],
'/logout/**': ['permitAll']
]
/** AJAX request header */
ajaxHeader = "X-Requested-With"
/** use basicProcessingFilter */
useBasicAuth = false
/** use switchUserProcessingFilter */
useSwitchUserFilter = false
}
}
}
// elasticsearch configuration
def hasCustomElasticSearchConfig
def dbConfLoc = System.getProperty('weceem.config.location', null)
if (!dbConfLoc) {
dbConfLoc = "file:./weceem.properties"
}
if (!grails.config.locations) {
grails.config.locations = [dbConfLoc]
} else grails.config.locations << dbConfLoc
def slurper = new ConfigSlurper()
def configs = grails.config.locations?.collect { l ->
println "Loading Weceem config from ${l}"
try {
URL fileUrl = new URL(l)
boolean isFileExists = new File(fileUrl.getPath()).exists()
if (isFileExists) {
if (l.endsWith('.properties')) {
def props = new Properties()
props.load(fileUrl.newInputStream() )
slurper.parse(props)
} else {
slurper.parse(fileUrl)
}
}
} catch (IOException e) {
println "Couldn't load config from URL $l: $e"
}
}
def config = new ConfigObject()
if (configs && !configs.isEmpty()) {
configs.each { c -> if (config) config?.merge(c) else config = c }
println "Loaded weceem properties: ${config}"
}
if (config?.elasticSearch) {
elasticSearch = config.elasticSearch
} else {
elasticSearch.datastoreImpl = 'hibernateDatastore'
elasticSearch.bulkIndexOnStartup = true
elasticSearch.disableAutoIndex = false
elasticSearch.client.mode = 'local'
elasticSearch.index.store.type = 'memory' // store local node in memory and not on disk
}
// specify in case of full page document structure
// in CKEditor
//ckeditor.fullPage = true
environments {
development {
weceem.upload.dir = 'file:/var/weceem-smart-uploads/'
// weceem.upload.url = "/wcm/files/"
// configuration attribute can be specified as the result of Closure execution
// see example: as far as the values are changed in specified files, the application uses the new values.
/*
weceem.upload.dir = {
URL fileUrl = new URL('file:./uploadDir.txt')
boolean isFileExists = new File(fileUrl.getPath()).exists()
if (isFileExists) {
return new File(fileUrl.getPath()).text
} else {
return 'file:/var/weceem-smart-uploads/'
}
}
weceem.upload.url = {
URL fileUrl = new URL('file:./uploadUrl.txt')
boolean isFileExists = new File(fileUrl.getPath()).exists()
if (isFileExists) {
return new File(fileUrl.getPath()).text
} else {
return '/wcm/files/'
}
}
*/
// log4j configuration
log4j = {
root {
info()
additivity = true
}
/*
debug 'org.weceem',
'grails.app.controller',
'grails.app.service',
'grails.app.filters',
'grails.app.task'
*/
info 'org.weceem',
'grails.app'
error 'org.codehaus.groovy.grails.web.servlet', // controllers
'org.codehaus.groovy.grails.plugins', // plugins
'org.codehaus.groovy.grails.web.pages', // GSP
'org.codehaus.groovy.grails.web.sitemesh', // layouts
'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
'org.codehaus.groovy.grails.commons', // core / classloading
'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
'org.springframework',
'org.hibernate'
}
}
test {
}
production {
if (config?.elasticSearch) {
elasticSearch.client.mode = 'local'
}
log4j = {
appenders {
rollingFile name: 'fileLog',
fileName: 'application.log',
maxFileSize: 26214400,
maxBackupIndex: 10,
layout: pattern(conversionPattern: '%d{yyyy-MM-dd HH:mm:ss,SSS} %p %c{2} %m%n')
}
root {
info()
additivity = true
}
info 'org.weceem',
'grails.app'
error 'org.codehaus.groovy.grails.web.servlet', // controllers
'org.codehaus.groovy.grails.plugins', // plugins
'org.codehaus.groovy.grails.web.pages', // GSP
'org.codehaus.groovy.grails.web.sitemesh', // layouts
'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
'org.codehaus.groovy.grails.commons', // core / classloading
'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
'org.springframework',
'org.hibernate'
}
}
}