##// END OF EJS Templates
javascript: use separate ini config for generating dynamic js files
dan -
r263:967dd702 default
parent child Browse files
Show More
@@ -1,607 +1,609 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # RhodeCode Enterprise - configuration file #
3 # RhodeCode Enterprise - configuration file #
4 # Built-in functions and variables #
4 # Built-in functions and variables #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 # #
6 # #
7 ################################################################################
7 ################################################################################
8
8
9 [DEFAULT]
9 [DEFAULT]
10 debug = true
10 debug = true
11 ################################################################################
11 ################################################################################
12 ## Uncomment and replace with the email address which should receive ##
12 ## Uncomment and replace with the email address which should receive ##
13 ## any error reports after an application crash ##
13 ## any error reports after an application crash ##
14 ## Additionally these settings will be used by the RhodeCode mailing system ##
14 ## Additionally these settings will be used by the RhodeCode mailing system ##
15 ################################################################################
15 ################################################################################
16 #email_to = admin@localhost
16 #email_to = admin@localhost
17 #error_email_from = paste_error@localhost
17 #error_email_from = paste_error@localhost
18 #app_email_from = rhodecode-noreply@localhost
18 #app_email_from = rhodecode-noreply@localhost
19 #error_message =
19 #error_message =
20 #email_prefix = [RhodeCode]
20 #email_prefix = [RhodeCode]
21
21
22 #smtp_server = mail.server.com
22 #smtp_server = mail.server.com
23 #smtp_username =
23 #smtp_username =
24 #smtp_password =
24 #smtp_password =
25 #smtp_port =
25 #smtp_port =
26 #smtp_use_tls = false
26 #smtp_use_tls = false
27 #smtp_use_ssl = true
27 #smtp_use_ssl = true
28 ## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
28 ## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
29 #smtp_auth =
29 #smtp_auth =
30
30
31 [server:main]
31 [server:main]
32 ## COMMON ##
32 ## COMMON ##
33 host = 127.0.0.1
33 host = 127.0.0.1
34 port = 5000
34 port = 5000
35
35
36 ##################################
36 ##################################
37 ## WAITRESS WSGI SERVER ##
37 ## WAITRESS WSGI SERVER ##
38 ## Recommended for Development ##
38 ## Recommended for Development ##
39 ##################################
39 ##################################
40 use = egg:waitress#main
40 use = egg:waitress#main
41 ## number of worker threads
41 ## number of worker threads
42 threads = 5
42 threads = 5
43 ## MAX BODY SIZE 100GB
43 ## MAX BODY SIZE 100GB
44 max_request_body_size = 107374182400
44 max_request_body_size = 107374182400
45 ## Use poll instead of select, fixes file descriptors limits problems.
45 ## Use poll instead of select, fixes file descriptors limits problems.
46 ## May not work on old windows systems.
46 ## May not work on old windows systems.
47 asyncore_use_poll = true
47 asyncore_use_poll = true
48
48
49
49
50 ##########################
50 ##########################
51 ## GUNICORN WSGI SERVER ##
51 ## GUNICORN WSGI SERVER ##
52 ##########################
52 ##########################
53 ## run with gunicorn --log-config <inifile.ini> --paste <inifile.ini>
53 ## run with gunicorn --log-config <inifile.ini> --paste <inifile.ini>
54 #use = egg:gunicorn#main
54 #use = egg:gunicorn#main
55 ## Sets the number of process workers. You must set `instance_id = *`
55 ## Sets the number of process workers. You must set `instance_id = *`
56 ## when this option is set to more than one worker, recommended
56 ## when this option is set to more than one worker, recommended
57 ## value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers
57 ## value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers
58 ## The `instance_id = *` must be set in the [app:main] section below
58 ## The `instance_id = *` must be set in the [app:main] section below
59 #workers = 2
59 #workers = 2
60 ## number of threads for each of the worker, must be set to 1 for gevent
60 ## number of threads for each of the worker, must be set to 1 for gevent
61 ## generally recommened to be at 1
61 ## generally recommened to be at 1
62 #threads = 1
62 #threads = 1
63 ## process name
63 ## process name
64 #proc_name = rhodecode
64 #proc_name = rhodecode
65 ## type of worker class, one of sync, gevent
65 ## type of worker class, one of sync, gevent
66 ## recommended for bigger setup is using of of other than sync one
66 ## recommended for bigger setup is using of of other than sync one
67 #worker_class = sync
67 #worker_class = sync
68 ## The maximum number of simultaneous clients. Valid only for Gevent
68 ## The maximum number of simultaneous clients. Valid only for Gevent
69 #worker_connections = 10
69 #worker_connections = 10
70 ## max number of requests that worker will handle before being gracefully
70 ## max number of requests that worker will handle before being gracefully
71 ## restarted, could prevent memory leaks
71 ## restarted, could prevent memory leaks
72 #max_requests = 1000
72 #max_requests = 1000
73 #max_requests_jitter = 30
73 #max_requests_jitter = 30
74 ## amount of time a worker can spend with handling a request before it
74 ## amount of time a worker can spend with handling a request before it
75 ## gets killed and restarted. Set to 6hrs
75 ## gets killed and restarted. Set to 6hrs
76 #timeout = 21600
76 #timeout = 21600
77
77
78
78
79 ## prefix middleware for RhodeCode, disables force_https flag.
79 ## prefix middleware for RhodeCode, disables force_https flag.
80 ## allows to set RhodeCode under a prefix in server.
80 ## allows to set RhodeCode under a prefix in server.
81 ## eg https://server.com/<prefix>. Enable `filter-with =` option below as well.
81 ## eg https://server.com/<prefix>. Enable `filter-with =` option below as well.
82 #[filter:proxy-prefix]
82 #[filter:proxy-prefix]
83 #use = egg:PasteDeploy#prefix
83 #use = egg:PasteDeploy#prefix
84 #prefix = /<your-prefix>
84 #prefix = /<your-prefix>
85
85
86 [app:main]
86 [app:main]
87 use = egg:rhodecode-enterprise-ce
87 use = egg:rhodecode-enterprise-ce
88 ## enable proxy prefix middleware, defined below
88 ## enable proxy prefix middleware, defined below
89 #filter-with = proxy-prefix
89 #filter-with = proxy-prefix
90
90
91 # During development the we want to have the debug toolbar enabled
91 # During development the we want to have the debug toolbar enabled
92 pyramid.includes =
92 pyramid.includes =
93 pyramid_debugtoolbar
93 pyramid_debugtoolbar
94 rhodecode.utils.debugtoolbar
94 rhodecode.utils.debugtoolbar
95 rhodecode.lib.middleware.request_wrapper
95 rhodecode.lib.middleware.request_wrapper
96
96
97 pyramid.reload_templates = true
97 pyramid.reload_templates = true
98
98
99 debugtoolbar.hosts = 0.0.0.0/0
99 debugtoolbar.hosts = 0.0.0.0/0
100 debugtoolbar.exclude_prefixes =
100 debugtoolbar.exclude_prefixes =
101 /css
101 /css
102 /fonts
102 /fonts
103 /images
103 /images
104 /js
104 /js
105
105
106 ## RHODECODE PLUGINS ##
106 ## RHODECODE PLUGINS ##
107 rhodecode.includes =
107 rhodecode.includes =
108 rhodecode.api
108 rhodecode.api
109
109
110
110
111 # api prefix url
111 # api prefix url
112 rhodecode.api.url = /_admin/api
112 rhodecode.api.url = /_admin/api
113
113
114
114
115 ## END RHODECODE PLUGINS ##
115 ## END RHODECODE PLUGINS ##
116
116
117 full_stack = true
117 full_stack = true
118
118
119 ## Serve static files via RhodeCode, disable to serve them via HTTP server
119 ## Serve static files via RhodeCode, disable to serve them via HTTP server
120 static_files = true
120 static_files = true
121
121
122 # autogenerate javascript routes file on startup
123 generate_js_files = false
124
122 ## Optional Languages
125 ## Optional Languages
123 ## en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
126 ## en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
124 lang = en
127 lang = en
125
128
126 ## perform a full repository scan on each server start, this should be
129 ## perform a full repository scan on each server start, this should be
127 ## set to false after first startup, to allow faster server restarts.
130 ## set to false after first startup, to allow faster server restarts.
128 startup.import_repos = false
131 startup.import_repos = false
129
132
130 ## Uncomment and set this path to use archive download cache.
133 ## Uncomment and set this path to use archive download cache.
131 ## Once enabled, generated archives will be cached at this location
134 ## Once enabled, generated archives will be cached at this location
132 ## and served from the cache during subsequent requests for the same archive of
135 ## and served from the cache during subsequent requests for the same archive of
133 ## the repository.
136 ## the repository.
134 #archive_cache_dir = /tmp/tarballcache
137 #archive_cache_dir = /tmp/tarballcache
135
138
136 ## change this to unique ID for security
139 ## change this to unique ID for security
137 app_instance_uuid = rc-production
140 app_instance_uuid = rc-production
138
141
139 ## cut off limit for large diffs (size in bytes)
142 ## cut off limit for large diffs (size in bytes)
140 cut_off_limit_diff = 1024000
143 cut_off_limit_diff = 1024000
141 cut_off_limit_file = 256000
144 cut_off_limit_file = 256000
142
145
143 ## use cache version of scm repo everywhere
146 ## use cache version of scm repo everywhere
144 vcs_full_cache = true
147 vcs_full_cache = true
145
148
146 ## force https in RhodeCode, fixes https redirects, assumes it's always https
149 ## force https in RhodeCode, fixes https redirects, assumes it's always https
147 ## Normally this is controlled by proper http flags sent from http server
150 ## Normally this is controlled by proper http flags sent from http server
148 force_https = false
151 force_https = false
149
152
150 ## use Strict-Transport-Security headers
153 ## use Strict-Transport-Security headers
151 use_htsts = false
154 use_htsts = false
152
155
153 ## number of commits stats will parse on each iteration
156 ## number of commits stats will parse on each iteration
154 commit_parse_limit = 25
157 commit_parse_limit = 25
155
158
156 ## git rev filter option, --all is the default filter, if you need to
159 ## git rev filter option, --all is the default filter, if you need to
157 ## hide all refs in changelog switch this to --branches --tags
160 ## hide all refs in changelog switch this to --branches --tags
158 git_rev_filter = --branches --tags
161 git_rev_filter = --branches --tags
159
162
160 # Set to true if your repos are exposed using the dumb protocol
163 # Set to true if your repos are exposed using the dumb protocol
161 git_update_server_info = false
164 git_update_server_info = false
162
165
163 ## RSS/ATOM feed options
166 ## RSS/ATOM feed options
164 rss_cut_off_limit = 256000
167 rss_cut_off_limit = 256000
165 rss_items_per_page = 10
168 rss_items_per_page = 10
166 rss_include_diff = false
169 rss_include_diff = false
167
170
168 ## gist URL alias, used to create nicer urls for gist. This should be an
171 ## gist URL alias, used to create nicer urls for gist. This should be an
169 ## url that does rewrites to _admin/gists/<gistid>.
172 ## url that does rewrites to _admin/gists/<gistid>.
170 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
173 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
171 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/<gistid>
174 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/<gistid>
172 gist_alias_url =
175 gist_alias_url =
173
176
174 ## List of controllers (using glob pattern syntax) that AUTH TOKENS could be
177 ## List of controllers (using glob pattern syntax) that AUTH TOKENS could be
175 ## used for access.
178 ## used for access.
176 ## Adding ?auth_token = <token> to the url authenticates this request as if it
179 ## Adding ?auth_token = <token> to the url authenticates this request as if it
177 ## came from the the logged in user who own this authentication token.
180 ## came from the the logged in user who own this authentication token.
178 ##
181 ##
179 ## Syntax is <ControllerClass>:<function_pattern>.
182 ## Syntax is <ControllerClass>:<function_pattern>.
180 ## To enable access to raw_files put `FilesController:raw`.
183 ## To enable access to raw_files put `FilesController:raw`.
181 ## To enable access to patches add `ChangesetController:changeset_patch`.
184 ## To enable access to patches add `ChangesetController:changeset_patch`.
182 ## The list should be "," separated and on a single line.
185 ## The list should be "," separated and on a single line.
183 ##
186 ##
184 ## Recommended controllers to enable:
187 ## Recommended controllers to enable:
185 # ChangesetController:changeset_patch,
188 # ChangesetController:changeset_patch,
186 # ChangesetController:changeset_raw,
189 # ChangesetController:changeset_raw,
187 # FilesController:raw,
190 # FilesController:raw,
188 # FilesController:archivefile,
191 # FilesController:archivefile,
189 # GistsController:*,
192 # GistsController:*,
190 api_access_controllers_whitelist =
193 api_access_controllers_whitelist =
191
194
192 ## default encoding used to convert from and to unicode
195 ## default encoding used to convert from and to unicode
193 ## can be also a comma separated list of encoding in case of mixed encodings
196 ## can be also a comma separated list of encoding in case of mixed encodings
194 default_encoding = UTF-8
197 default_encoding = UTF-8
195
198
196 ## instance-id prefix
199 ## instance-id prefix
197 ## a prefix key for this instance used for cache invalidation when running
200 ## a prefix key for this instance used for cache invalidation when running
198 ## multiple instances of rhodecode, make sure it's globally unique for
201 ## multiple instances of rhodecode, make sure it's globally unique for
199 ## all running rhodecode instances. Leave empty if you don't use it
202 ## all running rhodecode instances. Leave empty if you don't use it
200 instance_id =
203 instance_id =
201
204
202 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
205 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
203 ## of an authentication plugin also if it is disabled by it's settings.
206 ## of an authentication plugin also if it is disabled by it's settings.
204 ## This could be useful if you are unable to log in to the system due to broken
207 ## This could be useful if you are unable to log in to the system due to broken
205 ## authentication settings. Then you can enable e.g. the internal rhodecode auth
208 ## authentication settings. Then you can enable e.g. the internal rhodecode auth
206 ## module to log in again and fix the settings.
209 ## module to log in again and fix the settings.
207 ##
210 ##
208 ## Available builtin plugin IDs (hash is part of the ID):
211 ## Available builtin plugin IDs (hash is part of the ID):
209 ## egg:rhodecode-enterprise-ce#rhodecode
212 ## egg:rhodecode-enterprise-ce#rhodecode
210 ## egg:rhodecode-enterprise-ce#pam
213 ## egg:rhodecode-enterprise-ce#pam
211 ## egg:rhodecode-enterprise-ce#ldap
214 ## egg:rhodecode-enterprise-ce#ldap
212 ## egg:rhodecode-enterprise-ce#jasig_cas
215 ## egg:rhodecode-enterprise-ce#jasig_cas
213 ## egg:rhodecode-enterprise-ce#headers
216 ## egg:rhodecode-enterprise-ce#headers
214 ## egg:rhodecode-enterprise-ce#crowd
217 ## egg:rhodecode-enterprise-ce#crowd
215 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
218 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
216
219
217 ## alternative return HTTP header for failed authentication. Default HTTP
220 ## alternative return HTTP header for failed authentication. Default HTTP
218 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
221 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
219 ## handling that causing a series of failed authentication calls.
222 ## handling that causing a series of failed authentication calls.
220 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
223 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
221 ## This will be served instead of default 401 on bad authnetication
224 ## This will be served instead of default 401 on bad authnetication
222 auth_ret_code =
225 auth_ret_code =
223
226
224 ## use special detection method when serving auth_ret_code, instead of serving
227 ## use special detection method when serving auth_ret_code, instead of serving
225 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
228 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
226 ## and then serve auth_ret_code to clients
229 ## and then serve auth_ret_code to clients
227 auth_ret_code_detection = false
230 auth_ret_code_detection = false
228
231
229 ## locking return code. When repository is locked return this HTTP code. 2XX
232 ## locking return code. When repository is locked return this HTTP code. 2XX
230 ## codes don't break the transactions while 4XX codes do
233 ## codes don't break the transactions while 4XX codes do
231 lock_ret_code = 423
234 lock_ret_code = 423
232
235
233 ## allows to change the repository location in settings page
236 ## allows to change the repository location in settings page
234 allow_repo_location_change = true
237 allow_repo_location_change = true
235
238
236 ## allows to setup custom hooks in settings page
239 ## allows to setup custom hooks in settings page
237 allow_custom_hooks_settings = true
240 allow_custom_hooks_settings = true
238
241
239 ## generated license token, goto license page in RhodeCode settings to obtain
242 ## generated license token, goto license page in RhodeCode settings to obtain
240 ## new token
243 ## new token
241 license_token =
244 license_token =
242
245
243 ## supervisor connection uri, for managing supervisor and logs.
246 ## supervisor connection uri, for managing supervisor and logs.
244 supervisor.uri =
247 supervisor.uri =
245 ## supervisord group name/id we only want this RC instance to handle
248 ## supervisord group name/id we only want this RC instance to handle
246 supervisor.group_id = dev
249 supervisor.group_id = dev
247
250
248 ## Display extended labs settings
251 ## Display extended labs settings
249 labs_settings_active = true
252 labs_settings_active = true
250
253
251 ####################################
254 ####################################
252 ### CELERY CONFIG ####
255 ### CELERY CONFIG ####
253 ####################################
256 ####################################
254 use_celery = false
257 use_celery = false
255 broker.host = localhost
258 broker.host = localhost
256 broker.vhost = rabbitmqhost
259 broker.vhost = rabbitmqhost
257 broker.port = 5672
260 broker.port = 5672
258 broker.user = rabbitmq
261 broker.user = rabbitmq
259 broker.password = qweqwe
262 broker.password = qweqwe
260
263
261 celery.imports = rhodecode.lib.celerylib.tasks
264 celery.imports = rhodecode.lib.celerylib.tasks
262
265
263 celery.result.backend = amqp
266 celery.result.backend = amqp
264 celery.result.dburi = amqp://
267 celery.result.dburi = amqp://
265 celery.result.serialier = json
268 celery.result.serialier = json
266
269
267 #celery.send.task.error.emails = true
270 #celery.send.task.error.emails = true
268 #celery.amqp.task.result.expires = 18000
271 #celery.amqp.task.result.expires = 18000
269
272
270 celeryd.concurrency = 2
273 celeryd.concurrency = 2
271 #celeryd.log.file = celeryd.log
274 #celeryd.log.file = celeryd.log
272 celeryd.log.level = debug
275 celeryd.log.level = debug
273 celeryd.max.tasks.per.child = 1
276 celeryd.max.tasks.per.child = 1
274
277
275 ## tasks will never be sent to the queue, but executed locally instead.
278 ## tasks will never be sent to the queue, but executed locally instead.
276 celery.always.eager = false
279 celery.always.eager = false
277
280
278 ####################################
281 ####################################
279 ### BEAKER CACHE ####
282 ### BEAKER CACHE ####
280 ####################################
283 ####################################
281 # default cache dir for templates. Putting this into a ramdisk
284 # default cache dir for templates. Putting this into a ramdisk
282 ## can boost performance, eg. %(here)s/data_ramdisk
285 ## can boost performance, eg. %(here)s/data_ramdisk
283 cache_dir = %(here)s/data
286 cache_dir = %(here)s/data
284
287
285 ## locking and default file storage for Beaker. Putting this into a ramdisk
288 ## locking and default file storage for Beaker. Putting this into a ramdisk
286 ## can boost performance, eg. %(here)s/data_ramdisk/cache/beaker_data
289 ## can boost performance, eg. %(here)s/data_ramdisk/cache/beaker_data
287 beaker.cache.data_dir = %(here)s/data/cache/beaker_data
290 beaker.cache.data_dir = %(here)s/data/cache/beaker_data
288 beaker.cache.lock_dir = %(here)s/data/cache/beaker_lock
291 beaker.cache.lock_dir = %(here)s/data/cache/beaker_lock
289
292
290 beaker.cache.regions = super_short_term, short_term, long_term, sql_cache_short, auth_plugins, repo_cache_long
293 beaker.cache.regions = super_short_term, short_term, long_term, sql_cache_short, auth_plugins, repo_cache_long
291
294
292 beaker.cache.super_short_term.type = memory
295 beaker.cache.super_short_term.type = memory
293 beaker.cache.super_short_term.expire = 10
296 beaker.cache.super_short_term.expire = 10
294 beaker.cache.super_short_term.key_length = 256
297 beaker.cache.super_short_term.key_length = 256
295
298
296 beaker.cache.short_term.type = memory
299 beaker.cache.short_term.type = memory
297 beaker.cache.short_term.expire = 60
300 beaker.cache.short_term.expire = 60
298 beaker.cache.short_term.key_length = 256
301 beaker.cache.short_term.key_length = 256
299
302
300 beaker.cache.long_term.type = memory
303 beaker.cache.long_term.type = memory
301 beaker.cache.long_term.expire = 36000
304 beaker.cache.long_term.expire = 36000
302 beaker.cache.long_term.key_length = 256
305 beaker.cache.long_term.key_length = 256
303
306
304 beaker.cache.sql_cache_short.type = memory
307 beaker.cache.sql_cache_short.type = memory
305 beaker.cache.sql_cache_short.expire = 10
308 beaker.cache.sql_cache_short.expire = 10
306 beaker.cache.sql_cache_short.key_length = 256
309 beaker.cache.sql_cache_short.key_length = 256
307
310
308 # default is memory cache, configure only if required
311 # default is memory cache, configure only if required
309 # using multi-node or multi-worker setup
312 # using multi-node or multi-worker setup
310 #beaker.cache.auth_plugins.type = ext:database
313 #beaker.cache.auth_plugins.type = ext:database
311 #beaker.cache.auth_plugins.lock_dir = %(here)s/data/cache/auth_plugin_lock
314 #beaker.cache.auth_plugins.lock_dir = %(here)s/data/cache/auth_plugin_lock
312 #beaker.cache.auth_plugins.url = postgresql://postgres:secret@localhost/rhodecode
315 #beaker.cache.auth_plugins.url = postgresql://postgres:secret@localhost/rhodecode
313 #beaker.cache.auth_plugins.url = mysql://root:secret@127.0.0.1/rhodecode
316 #beaker.cache.auth_plugins.url = mysql://root:secret@127.0.0.1/rhodecode
314 #beaker.cache.auth_plugins.sa.pool_recycle = 3600
317 #beaker.cache.auth_plugins.sa.pool_recycle = 3600
315 #beaker.cache.auth_plugins.sa.pool_size = 10
318 #beaker.cache.auth_plugins.sa.pool_size = 10
316 #beaker.cache.auth_plugins.sa.max_overflow = 0
319 #beaker.cache.auth_plugins.sa.max_overflow = 0
317
320
318 beaker.cache.repo_cache_long.type = memorylru_base
321 beaker.cache.repo_cache_long.type = memorylru_base
319 beaker.cache.repo_cache_long.max_items = 4096
322 beaker.cache.repo_cache_long.max_items = 4096
320 beaker.cache.repo_cache_long.expire = 2592000
323 beaker.cache.repo_cache_long.expire = 2592000
321
324
322 # default is memorylru_base cache, configure only if required
325 # default is memorylru_base cache, configure only if required
323 # using multi-node or multi-worker setup
326 # using multi-node or multi-worker setup
324 #beaker.cache.repo_cache_long.type = ext:memcached
327 #beaker.cache.repo_cache_long.type = ext:memcached
325 #beaker.cache.repo_cache_long.url = localhost:11211
328 #beaker.cache.repo_cache_long.url = localhost:11211
326 #beaker.cache.repo_cache_long.expire = 1209600
329 #beaker.cache.repo_cache_long.expire = 1209600
327 #beaker.cache.repo_cache_long.key_length = 256
330 #beaker.cache.repo_cache_long.key_length = 256
328
331
329 ####################################
332 ####################################
330 ### BEAKER SESSION ####
333 ### BEAKER SESSION ####
331 ####################################
334 ####################################
332
335
333 ## .session.type is type of storage options for the session, current allowed
336 ## .session.type is type of storage options for the session, current allowed
334 ## types are file, ext:memcached, ext:database, and memory (default).
337 ## types are file, ext:memcached, ext:database, and memory (default).
335 beaker.session.type = file
338 beaker.session.type = file
336 beaker.session.data_dir = %(here)s/data/sessions/data
339 beaker.session.data_dir = %(here)s/data/sessions/data
337
340
338 ## db based session, fast, and allows easy management over logged in users ##
341 ## db based session, fast, and allows easy management over logged in users ##
339 #beaker.session.type = ext:database
342 #beaker.session.type = ext:database
340 #beaker.session.table_name = db_session
343 #beaker.session.table_name = db_session
341 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
344 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
342 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
345 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
343 #beaker.session.sa.pool_recycle = 3600
346 #beaker.session.sa.pool_recycle = 3600
344 #beaker.session.sa.echo = false
347 #beaker.session.sa.echo = false
345
348
346 beaker.session.key = rhodecode
349 beaker.session.key = rhodecode
347 beaker.session.secret = develop-rc-uytcxaz
350 beaker.session.secret = develop-rc-uytcxaz
348 beaker.session.lock_dir = %(here)s/data/sessions/lock
351 beaker.session.lock_dir = %(here)s/data/sessions/lock
349
352
350 ## Secure encrypted cookie. Requires AES and AES python libraries
353 ## Secure encrypted cookie. Requires AES and AES python libraries
351 ## you must disable beaker.session.secret to use this
354 ## you must disable beaker.session.secret to use this
352 #beaker.session.encrypt_key = <key_for_encryption>
355 #beaker.session.encrypt_key = <key_for_encryption>
353 #beaker.session.validate_key = <validation_key>
356 #beaker.session.validate_key = <validation_key>
354
357
355 ## sets session as invalid(also logging out user) if it haven not been
358 ## sets session as invalid(also logging out user) if it haven not been
356 ## accessed for given amount of time in seconds
359 ## accessed for given amount of time in seconds
357 beaker.session.timeout = 2592000
360 beaker.session.timeout = 2592000
358 beaker.session.httponly = true
361 beaker.session.httponly = true
359 #beaker.session.cookie_path = /<your-prefix>
362 #beaker.session.cookie_path = /<your-prefix>
360
363
361 ## uncomment for https secure cookie
364 ## uncomment for https secure cookie
362 beaker.session.secure = false
365 beaker.session.secure = false
363
366
364 ## auto save the session to not to use .save()
367 ## auto save the session to not to use .save()
365 beaker.session.auto = false
368 beaker.session.auto = false
366
369
367 ## default cookie expiration time in seconds, set to `true` to set expire
370 ## default cookie expiration time in seconds, set to `true` to set expire
368 ## at browser close
371 ## at browser close
369 #beaker.session.cookie_expires = 3600
372 #beaker.session.cookie_expires = 3600
370
373
371 ###################################
374 ###################################
372 ## SEARCH INDEXING CONFIGURATION ##
375 ## SEARCH INDEXING CONFIGURATION ##
373 ###################################
376 ###################################
374 ## Full text search indexer is available in rhodecode-tools under
377 ## Full text search indexer is available in rhodecode-tools under
375 ## `rhodecode-tools index` command
378 ## `rhodecode-tools index` command
376
379
377 # WHOOSH Backend, doesn't require additional services to run
380 # WHOOSH Backend, doesn't require additional services to run
378 # it works good with few dozen repos
381 # it works good with few dozen repos
379 search.module = rhodecode.lib.index.whoosh
382 search.module = rhodecode.lib.index.whoosh
380 search.location = %(here)s/data/index
383 search.location = %(here)s/data/index
381
384
382
383 ###################################
385 ###################################
384 ## APPENLIGHT CONFIG ##
386 ## APPENLIGHT CONFIG ##
385 ###################################
387 ###################################
386
388
387 ## Appenlight is tailored to work with RhodeCode, see
389 ## Appenlight is tailored to work with RhodeCode, see
388 ## http://appenlight.com for details how to obtain an account
390 ## http://appenlight.com for details how to obtain an account
389
391
390 ## appenlight integration enabled
392 ## appenlight integration enabled
391 appenlight = false
393 appenlight = false
392
394
393 appenlight.server_url = https://api.appenlight.com
395 appenlight.server_url = https://api.appenlight.com
394 appenlight.api_key = YOUR_API_KEY
396 appenlight.api_key = YOUR_API_KEY
395 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
397 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
396
398
397 # used for JS client
399 # used for JS client
398 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
400 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
399
401
400 ## TWEAK AMOUNT OF INFO SENT HERE
402 ## TWEAK AMOUNT OF INFO SENT HERE
401
403
402 ## enables 404 error logging (default False)
404 ## enables 404 error logging (default False)
403 appenlight.report_404 = false
405 appenlight.report_404 = false
404
406
405 ## time in seconds after request is considered being slow (default 1)
407 ## time in seconds after request is considered being slow (default 1)
406 appenlight.slow_request_time = 1
408 appenlight.slow_request_time = 1
407
409
408 ## record slow requests in application
410 ## record slow requests in application
409 ## (needs to be enabled for slow datastore recording and time tracking)
411 ## (needs to be enabled for slow datastore recording and time tracking)
410 appenlight.slow_requests = true
412 appenlight.slow_requests = true
411
413
412 ## enable hooking to application loggers
414 ## enable hooking to application loggers
413 appenlight.logging = true
415 appenlight.logging = true
414
416
415 ## minimum log level for log capture
417 ## minimum log level for log capture
416 appenlight.logging.level = WARNING
418 appenlight.logging.level = WARNING
417
419
418 ## send logs only from erroneous/slow requests
420 ## send logs only from erroneous/slow requests
419 ## (saves API quota for intensive logging)
421 ## (saves API quota for intensive logging)
420 appenlight.logging_on_error = false
422 appenlight.logging_on_error = false
421
423
422 ## list of additonal keywords that should be grabbed from environ object
424 ## list of additonal keywords that should be grabbed from environ object
423 ## can be string with comma separated list of words in lowercase
425 ## can be string with comma separated list of words in lowercase
424 ## (by default client will always send following info:
426 ## (by default client will always send following info:
425 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
427 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
426 ## start with HTTP* this list be extended with additional keywords here
428 ## start with HTTP* this list be extended with additional keywords here
427 appenlight.environ_keys_whitelist =
429 appenlight.environ_keys_whitelist =
428
430
429 ## list of keywords that should be blanked from request object
431 ## list of keywords that should be blanked from request object
430 ## can be string with comma separated list of words in lowercase
432 ## can be string with comma separated list of words in lowercase
431 ## (by default client will always blank keys that contain following words
433 ## (by default client will always blank keys that contain following words
432 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
434 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
433 ## this list be extended with additional keywords set here
435 ## this list be extended with additional keywords set here
434 appenlight.request_keys_blacklist =
436 appenlight.request_keys_blacklist =
435
437
436 ## list of namespaces that should be ignores when gathering log entries
438 ## list of namespaces that should be ignores when gathering log entries
437 ## can be string with comma separated list of namespaces
439 ## can be string with comma separated list of namespaces
438 ## (by default the client ignores own entries: appenlight_client.client)
440 ## (by default the client ignores own entries: appenlight_client.client)
439 appenlight.log_namespace_blacklist =
441 appenlight.log_namespace_blacklist =
440
442
441
443
442 ################################################################################
444 ################################################################################
443 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
445 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
444 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
446 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
445 ## execute malicious code after an exception is raised. ##
447 ## execute malicious code after an exception is raised. ##
446 ################################################################################
448 ################################################################################
447 #set debug = false
449 #set debug = false
448
450
449
451
450 ##############
452 ##############
451 ## STYLING ##
453 ## STYLING ##
452 ##############
454 ##############
453 debug_style = true
455 debug_style = true
454
456
455 #########################################################
457 #########################################################
456 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
458 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
457 #########################################################
459 #########################################################
458 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
460 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
459 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
461 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
460 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode
462 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode
461
463
462 # see sqlalchemy docs for other advanced settings
464 # see sqlalchemy docs for other advanced settings
463
465
464 ## print the sql statements to output
466 ## print the sql statements to output
465 sqlalchemy.db1.echo = false
467 sqlalchemy.db1.echo = false
466 ## recycle the connections after this ammount of seconds
468 ## recycle the connections after this ammount of seconds
467 sqlalchemy.db1.pool_recycle = 3600
469 sqlalchemy.db1.pool_recycle = 3600
468 sqlalchemy.db1.convert_unicode = true
470 sqlalchemy.db1.convert_unicode = true
469
471
470 ## the number of connections to keep open inside the connection pool.
472 ## the number of connections to keep open inside the connection pool.
471 ## 0 indicates no limit
473 ## 0 indicates no limit
472 #sqlalchemy.db1.pool_size = 5
474 #sqlalchemy.db1.pool_size = 5
473
475
474 ## the number of connections to allow in connection pool "overflow", that is
476 ## the number of connections to allow in connection pool "overflow", that is
475 ## connections that can be opened above and beyond the pool_size setting,
477 ## connections that can be opened above and beyond the pool_size setting,
476 ## which defaults to five.
478 ## which defaults to five.
477 #sqlalchemy.db1.max_overflow = 10
479 #sqlalchemy.db1.max_overflow = 10
478
480
479
481
480 ##################
482 ##################
481 ### VCS CONFIG ###
483 ### VCS CONFIG ###
482 ##################
484 ##################
483 vcs.server.enable = true
485 vcs.server.enable = true
484 vcs.server = localhost:9900
486 vcs.server = localhost:9900
485
487
486 ## Web server connectivity protocol, responsible for web based VCS operatations
488 ## Web server connectivity protocol, responsible for web based VCS operatations
487 ## Available protocols are:
489 ## Available protocols are:
488 ## `pyro4` - using pyro4 server
490 ## `pyro4` - using pyro4 server
489 ## `http` - using http-rpc backend
491 ## `http` - using http-rpc backend
490 #vcs.server.protocol = http
492 #vcs.server.protocol = http
491
493
492 ## Push/Pull operations protocol, available options are:
494 ## Push/Pull operations protocol, available options are:
493 ## `pyro4` - using pyro4 server
495 ## `pyro4` - using pyro4 server
494 ## `rhodecode.lib.middleware.utils.scm_app_http` - Http based, recommended
496 ## `rhodecode.lib.middleware.utils.scm_app_http` - Http based, recommended
495 ## `vcsserver.scm_app` - internal app (EE only)
497 ## `vcsserver.scm_app` - internal app (EE only)
496 #vcs.scm_app_implementation = rhodecode.lib.middleware.utils.scm_app_http
498 #vcs.scm_app_implementation = rhodecode.lib.middleware.utils.scm_app_http
497
499
498 ## Push/Pull operations hooks protocol, available options are:
500 ## Push/Pull operations hooks protocol, available options are:
499 ## `pyro4` - using pyro4 server
501 ## `pyro4` - using pyro4 server
500 ## `http` - using http-rpc backend
502 ## `http` - using http-rpc backend
501 #vcs.hooks.protocol = http
503 #vcs.hooks.protocol = http
502
504
503 vcs.server.log_level = debug
505 vcs.server.log_level = debug
504 ## Start VCSServer with this instance as a subprocess, usefull for development
506 ## Start VCSServer with this instance as a subprocess, usefull for development
505 vcs.start_server = true
507 vcs.start_server = true
506 vcs.backends = hg, git, svn
508 vcs.backends = hg, git, svn
507 vcs.connection_timeout = 3600
509 vcs.connection_timeout = 3600
508 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
510 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
509 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible
511 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible
510 #vcs.svn.compatible_version = pre-1.8-compatible
512 #vcs.svn.compatible_version = pre-1.8-compatible
511
513
512 ################################
514 ################################
513 ### LOGGING CONFIGURATION ####
515 ### LOGGING CONFIGURATION ####
514 ################################
516 ################################
515 [loggers]
517 [loggers]
516 keys = root, routes, rhodecode, sqlalchemy, beaker, pyro4, templates, whoosh_indexer
518 keys = root, routes, rhodecode, sqlalchemy, beaker, pyro4, templates, whoosh_indexer
517
519
518 [handlers]
520 [handlers]
519 keys = console, console_sql
521 keys = console, console_sql
520
522
521 [formatters]
523 [formatters]
522 keys = generic, color_formatter, color_formatter_sql
524 keys = generic, color_formatter, color_formatter_sql
523
525
524 #############
526 #############
525 ## LOGGERS ##
527 ## LOGGERS ##
526 #############
528 #############
527 [logger_root]
529 [logger_root]
528 level = NOTSET
530 level = NOTSET
529 handlers = console
531 handlers = console
530
532
531 [logger_routes]
533 [logger_routes]
532 level = DEBUG
534 level = DEBUG
533 handlers =
535 handlers =
534 qualname = routes.middleware
536 qualname = routes.middleware
535 ## "level = DEBUG" logs the route matched and routing variables.
537 ## "level = DEBUG" logs the route matched and routing variables.
536 propagate = 1
538 propagate = 1
537
539
538 [logger_beaker]
540 [logger_beaker]
539 level = DEBUG
541 level = DEBUG
540 handlers =
542 handlers =
541 qualname = beaker.container
543 qualname = beaker.container
542 propagate = 1
544 propagate = 1
543
545
544 [logger_pyro4]
546 [logger_pyro4]
545 level = DEBUG
547 level = DEBUG
546 handlers =
548 handlers =
547 qualname = Pyro4
549 qualname = Pyro4
548 propagate = 1
550 propagate = 1
549
551
550 [logger_templates]
552 [logger_templates]
551 level = INFO
553 level = INFO
552 handlers =
554 handlers =
553 qualname = pylons.templating
555 qualname = pylons.templating
554 propagate = 1
556 propagate = 1
555
557
556 [logger_rhodecode]
558 [logger_rhodecode]
557 level = DEBUG
559 level = DEBUG
558 handlers =
560 handlers =
559 qualname = rhodecode
561 qualname = rhodecode
560 propagate = 1
562 propagate = 1
561
563
562 [logger_sqlalchemy]
564 [logger_sqlalchemy]
563 level = INFO
565 level = INFO
564 handlers = console_sql
566 handlers = console_sql
565 qualname = sqlalchemy.engine
567 qualname = sqlalchemy.engine
566 propagate = 0
568 propagate = 0
567
569
568 [logger_whoosh_indexer]
570 [logger_whoosh_indexer]
569 level = DEBUG
571 level = DEBUG
570 handlers =
572 handlers =
571 qualname = whoosh_indexer
573 qualname = whoosh_indexer
572 propagate = 1
574 propagate = 1
573
575
574 ##############
576 ##############
575 ## HANDLERS ##
577 ## HANDLERS ##
576 ##############
578 ##############
577
579
578 [handler_console]
580 [handler_console]
579 class = StreamHandler
581 class = StreamHandler
580 args = (sys.stderr,)
582 args = (sys.stderr,)
581 level = DEBUG
583 level = DEBUG
582 formatter = color_formatter
584 formatter = color_formatter
583
585
584 [handler_console_sql]
586 [handler_console_sql]
585 class = StreamHandler
587 class = StreamHandler
586 args = (sys.stderr,)
588 args = (sys.stderr,)
587 level = DEBUG
589 level = DEBUG
588 formatter = color_formatter_sql
590 formatter = color_formatter_sql
589
591
590 ################
592 ################
591 ## FORMATTERS ##
593 ## FORMATTERS ##
592 ################
594 ################
593
595
594 [formatter_generic]
596 [formatter_generic]
595 class = rhodecode.lib.logging_formatter.Pyro4AwareFormatter
597 class = rhodecode.lib.logging_formatter.Pyro4AwareFormatter
596 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
598 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
597 datefmt = %Y-%m-%d %H:%M:%S
599 datefmt = %Y-%m-%d %H:%M:%S
598
600
599 [formatter_color_formatter]
601 [formatter_color_formatter]
600 class = rhodecode.lib.logging_formatter.ColorFormatter
602 class = rhodecode.lib.logging_formatter.ColorFormatter
601 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
603 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
602 datefmt = %Y-%m-%d %H:%M:%S
604 datefmt = %Y-%m-%d %H:%M:%S
603
605
604 [formatter_color_formatter_sql]
606 [formatter_color_formatter_sql]
605 class = rhodecode.lib.logging_formatter.ColorFormatterSql
607 class = rhodecode.lib.logging_formatter.ColorFormatterSql
606 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
608 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
607 datefmt = %Y-%m-%d %H:%M:%S
609 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,192 +1,192 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2010-2016 RhodeCode GmbH
3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 """
21 """
22 Pylons environment configuration
22 Pylons environment configuration
23 """
23 """
24
24
25 import os
25 import os
26 import logging
26 import logging
27 import rhodecode
27 import rhodecode
28 import platform
28 import platform
29 import re
29 import re
30 import io
30 import io
31
31
32 from mako.lookup import TemplateLookup
32 from mako.lookup import TemplateLookup
33 from pylons.configuration import PylonsConfig
33 from pylons.configuration import PylonsConfig
34 from pylons.error import handle_mako_error
34 from pylons.error import handle_mako_error
35 from pyramid.settings import asbool
35 from pyramid.settings import asbool
36
36
37 # don't remove this import it does magic for celery
37 # don't remove this import it does magic for celery
38 from rhodecode.lib import celerypylons # noqa
38 from rhodecode.lib import celerypylons # noqa
39
39
40 import rhodecode.lib.app_globals as app_globals
40 import rhodecode.lib.app_globals as app_globals
41
41
42 from rhodecode.config import utils
42 from rhodecode.config import utils
43 from rhodecode.config.routing import make_map
43 from rhodecode.config.routing import make_map
44 from rhodecode.config.jsroutes import generate_jsroutes_content
44 from rhodecode.config.jsroutes import generate_jsroutes_content
45
45
46 from rhodecode.lib import helpers
46 from rhodecode.lib import helpers
47 from rhodecode.lib.auth import set_available_permissions
47 from rhodecode.lib.auth import set_available_permissions
48 from rhodecode.lib.utils import (
48 from rhodecode.lib.utils import (
49 repo2db_mapper, make_db_config, set_rhodecode_config,
49 repo2db_mapper, make_db_config, set_rhodecode_config,
50 load_rcextensions)
50 load_rcextensions)
51 from rhodecode.lib.utils2 import str2bool, aslist
51 from rhodecode.lib.utils2 import str2bool, aslist
52 from rhodecode.lib.vcs import connect_vcs, start_vcs_server
52 from rhodecode.lib.vcs import connect_vcs, start_vcs_server
53 from rhodecode.model.scm import ScmModel
53 from rhodecode.model.scm import ScmModel
54
54
55 log = logging.getLogger(__name__)
55 log = logging.getLogger(__name__)
56
56
57 def load_environment(global_conf, app_conf, initial=False,
57 def load_environment(global_conf, app_conf, initial=False,
58 test_env=None, test_index=None):
58 test_env=None, test_index=None):
59 """
59 """
60 Configure the Pylons environment via the ``pylons.config``
60 Configure the Pylons environment via the ``pylons.config``
61 object
61 object
62 """
62 """
63 config = PylonsConfig()
63 config = PylonsConfig()
64
64
65
65
66 # Pylons paths
66 # Pylons paths
67 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
67 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
68 paths = {
68 paths = {
69 'root': root,
69 'root': root,
70 'controllers': os.path.join(root, 'controllers'),
70 'controllers': os.path.join(root, 'controllers'),
71 'static_files': os.path.join(root, 'public'),
71 'static_files': os.path.join(root, 'public'),
72 'templates': [os.path.join(root, 'templates')],
72 'templates': [os.path.join(root, 'templates')],
73 }
73 }
74
74
75 # Initialize config with the basic options
75 # Initialize config with the basic options
76 config.init_app(global_conf, app_conf, package='rhodecode', paths=paths)
76 config.init_app(global_conf, app_conf, package='rhodecode', paths=paths)
77
77
78 # store some globals into rhodecode
78 # store some globals into rhodecode
79 rhodecode.CELERY_ENABLED = str2bool(config['app_conf'].get('use_celery'))
79 rhodecode.CELERY_ENABLED = str2bool(config['app_conf'].get('use_celery'))
80 rhodecode.CELERY_EAGER = str2bool(
80 rhodecode.CELERY_EAGER = str2bool(
81 config['app_conf'].get('celery.always.eager'))
81 config['app_conf'].get('celery.always.eager'))
82
82
83 config['routes.map'] = make_map(config)
83 config['routes.map'] = make_map(config)
84
84
85 if asbool(config['debug']):
85 if asbool(config['generate_js_files']):
86 jsroutes = config['routes.map'].jsroutes()
86 jsroutes = config['routes.map'].jsroutes()
87 jsroutes_file_content = generate_jsroutes_content(jsroutes)
87 jsroutes_file_content = generate_jsroutes_content(jsroutes)
88 jsroutes_file_path = os.path.join(
88 jsroutes_file_path = os.path.join(
89 paths['static_files'], 'js', 'rhodecode', 'routes.js')
89 paths['static_files'], 'js', 'rhodecode', 'routes.js')
90
90
91 with io.open(jsroutes_file_path, 'w', encoding='utf-8') as f:
91 with io.open(jsroutes_file_path, 'w', encoding='utf-8') as f:
92 f.write(jsroutes_file_content)
92 f.write(jsroutes_file_content)
93
93
94 config['pylons.app_globals'] = app_globals.Globals(config)
94 config['pylons.app_globals'] = app_globals.Globals(config)
95 config['pylons.h'] = helpers
95 config['pylons.h'] = helpers
96 rhodecode.CONFIG = config
96 rhodecode.CONFIG = config
97
97
98 load_rcextensions(root_path=config['here'])
98 load_rcextensions(root_path=config['here'])
99
99
100 # Setup cache object as early as possible
100 # Setup cache object as early as possible
101 import pylons
101 import pylons
102 pylons.cache._push_object(config['pylons.app_globals'].cache)
102 pylons.cache._push_object(config['pylons.app_globals'].cache)
103
103
104 # Create the Mako TemplateLookup, with the default auto-escaping
104 # Create the Mako TemplateLookup, with the default auto-escaping
105 config['pylons.app_globals'].mako_lookup = TemplateLookup(
105 config['pylons.app_globals'].mako_lookup = TemplateLookup(
106 directories=paths['templates'],
106 directories=paths['templates'],
107 error_handler=handle_mako_error,
107 error_handler=handle_mako_error,
108 module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
108 module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
109 input_encoding='utf-8', default_filters=['escape'],
109 input_encoding='utf-8', default_filters=['escape'],
110 imports=['from webhelpers.html import escape'])
110 imports=['from webhelpers.html import escape'])
111
111
112 # sets the c attribute access when don't existing attribute are accessed
112 # sets the c attribute access when don't existing attribute are accessed
113 config['pylons.strict_tmpl_context'] = True
113 config['pylons.strict_tmpl_context'] = True
114
114
115 # Limit backends to "vcs.backends" from configuration
115 # Limit backends to "vcs.backends" from configuration
116 backends = config['vcs.backends'] = aslist(
116 backends = config['vcs.backends'] = aslist(
117 config.get('vcs.backends', 'hg,git'), sep=',')
117 config.get('vcs.backends', 'hg,git'), sep=',')
118 for alias in rhodecode.BACKENDS.keys():
118 for alias in rhodecode.BACKENDS.keys():
119 if alias not in backends:
119 if alias not in backends:
120 del rhodecode.BACKENDS[alias]
120 del rhodecode.BACKENDS[alias]
121 log.info("Enabled backends: %s", backends)
121 log.info("Enabled backends: %s", backends)
122
122
123 # initialize vcs client and optionally run the server if enabled
123 # initialize vcs client and optionally run the server if enabled
124 vcs_server_uri = config.get('vcs.server', '')
124 vcs_server_uri = config.get('vcs.server', '')
125 vcs_server_enabled = str2bool(config.get('vcs.server.enable', 'true'))
125 vcs_server_enabled = str2bool(config.get('vcs.server.enable', 'true'))
126 start_server = (
126 start_server = (
127 str2bool(config.get('vcs.start_server', 'false')) and
127 str2bool(config.get('vcs.start_server', 'false')) and
128 not int(os.environ.get('RC_VCSSERVER_TEST_DISABLE', '0')))
128 not int(os.environ.get('RC_VCSSERVER_TEST_DISABLE', '0')))
129 if vcs_server_enabled and start_server:
129 if vcs_server_enabled and start_server:
130 log.info("Starting vcsserver")
130 log.info("Starting vcsserver")
131 start_vcs_server(server_and_port=vcs_server_uri,
131 start_vcs_server(server_and_port=vcs_server_uri,
132 protocol=utils.get_vcs_server_protocol(config),
132 protocol=utils.get_vcs_server_protocol(config),
133 log_level=config['vcs.server.log_level'])
133 log_level=config['vcs.server.log_level'])
134
134
135 set_available_permissions(config)
135 set_available_permissions(config)
136 db_cfg = make_db_config(clear_session=True)
136 db_cfg = make_db_config(clear_session=True)
137
137
138 repos_path = list(db_cfg.items('paths'))[0][1]
138 repos_path = list(db_cfg.items('paths'))[0][1]
139 config['base_path'] = repos_path
139 config['base_path'] = repos_path
140
140
141 config['vcs.hooks.direct_calls'] = _use_direct_hook_calls(config)
141 config['vcs.hooks.direct_calls'] = _use_direct_hook_calls(config)
142 config['vcs.hooks.protocol'] = _get_vcs_hooks_protocol(config)
142 config['vcs.hooks.protocol'] = _get_vcs_hooks_protocol(config)
143
143
144 # store db config also in main global CONFIG
144 # store db config also in main global CONFIG
145 set_rhodecode_config(config)
145 set_rhodecode_config(config)
146
146
147 # configure instance id
147 # configure instance id
148 utils.set_instance_id(config)
148 utils.set_instance_id(config)
149
149
150 # CONFIGURATION OPTIONS HERE (note: all config options will override
150 # CONFIGURATION OPTIONS HERE (note: all config options will override
151 # any Pylons config options)
151 # any Pylons config options)
152
152
153 # store config reference into our module to skip import magic of pylons
153 # store config reference into our module to skip import magic of pylons
154 rhodecode.CONFIG.update(config)
154 rhodecode.CONFIG.update(config)
155
155
156 utils.configure_pyro4(config)
156 utils.configure_pyro4(config)
157 utils.configure_vcs(config)
157 utils.configure_vcs(config)
158 if vcs_server_enabled:
158 if vcs_server_enabled:
159 connect_vcs(vcs_server_uri, utils.get_vcs_server_protocol(config))
159 connect_vcs(vcs_server_uri, utils.get_vcs_server_protocol(config))
160
160
161 import_on_startup = str2bool(config.get('startup.import_repos', False))
161 import_on_startup = str2bool(config.get('startup.import_repos', False))
162 if vcs_server_enabled and import_on_startup:
162 if vcs_server_enabled and import_on_startup:
163 repo2db_mapper(ScmModel().repo_scan(repos_path), remove_obsolete=False)
163 repo2db_mapper(ScmModel().repo_scan(repos_path), remove_obsolete=False)
164 return config
164 return config
165
165
166
166
167 def _use_direct_hook_calls(config):
167 def _use_direct_hook_calls(config):
168 default_direct_hook_calls = 'false'
168 default_direct_hook_calls = 'false'
169 direct_hook_calls = str2bool(
169 direct_hook_calls = str2bool(
170 config.get('vcs.hooks.direct_calls', default_direct_hook_calls))
170 config.get('vcs.hooks.direct_calls', default_direct_hook_calls))
171 return direct_hook_calls
171 return direct_hook_calls
172
172
173
173
174 def _get_vcs_hooks_protocol(config):
174 def _get_vcs_hooks_protocol(config):
175 protocol = config.get('vcs.hooks.protocol', 'pyro4').lower()
175 protocol = config.get('vcs.hooks.protocol', 'pyro4').lower()
176 return protocol
176 return protocol
177
177
178
178
179 def load_pyramid_environment(global_config, settings):
179 def load_pyramid_environment(global_config, settings):
180 # Some parts of the code expect a merge of global and app settings.
180 # Some parts of the code expect a merge of global and app settings.
181 settings_merged = global_config.copy()
181 settings_merged = global_config.copy()
182 settings_merged.update(settings)
182 settings_merged.update(settings)
183
183
184 # If this is a test run we prepare the test environment like
184 # If this is a test run we prepare the test environment like
185 # creating a test database, test search index and test repositories.
185 # creating a test database, test search index and test repositories.
186 # This has to be done before the database connection is initialized.
186 # This has to be done before the database connection is initialized.
187 if settings['is_test']:
187 if settings['is_test']:
188 rhodecode.is_test = True
188 rhodecode.is_test = True
189 utils.initialize_test_environment(settings_merged)
189 utils.initialize_test_environment(settings_merged)
190
190
191 # Initialize the database connection.
191 # Initialize the database connection.
192 utils.initialize_database(settings_merged)
192 utils.initialize_database(settings_merged)
@@ -1,42 +1,43 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2010-2016 RhodeCode GmbH
3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 def generate_jsroutes_content(jsroutes):
21 def generate_jsroutes_content(jsroutes):
22 statements = []
22 statements = []
23 for url_name, url, fields in jsroutes:
23 for url_name, url, fields in jsroutes:
24 statements.append(
24 statements.append(
25 "pyroutes.register('%s', '%s', %s);" % (url_name, url, fields))
25 "pyroutes.register('%s', '%s', %s);" % (url_name, url, fields))
26 return u'''
26 return u'''
27 /******************************************************************************
27 /******************************************************************************
28 * *
28 * *
29 * DO NOT CHANGE THIS FILE MANUALLY *
29 * DO NOT CHANGE THIS FILE MANUALLY *
30 * *
30 * *
31 * *
31 * *
32 * This file is automatically generated when the app starts up. *
32 * This file is automatically generated when the app starts up with *
33 * generate_js_files = true *
33 * *
34 * *
34 * To add a route here pass jsroute=True to the route definition in the app *
35 * To add a route here pass jsroute=True to the route definition in the app *
35 * *
36 * *
36 ******************************************************************************/
37 ******************************************************************************/
37 function registerRCRoutes() {
38 function registerRCRoutes() {
38 // routes registration
39 // routes registration
39 %s
40 %s
40 }
41 }
41 ''' % '\n '.join(statements)
42 ''' % '\n '.join(statements)
42
43
General Comments 0
You need to be logged in to leave comments. Login now