##// END OF EJS Templates
app-setup: allow skip of legacy plugin discovery.
marcink -
r4108:eaa05819 default
parent child Browse files
Show More
@@ -1,785 +1,788 b''
1
1
2
2
3 ################################################################################
3 ################################################################################
4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
5 ################################################################################
5 ################################################################################
6
6
7 [DEFAULT]
7 [DEFAULT]
8 ## Debug flag sets all loggers to debug, and enables request tracking
8 ## Debug flag sets all loggers to debug, and enables request tracking
9 debug = true
9 debug = true
10
10
11 ################################################################################
11 ################################################################################
12 ## EMAIL CONFIGURATION ##
12 ## EMAIL CONFIGURATION ##
13 ## Uncomment and replace with the email address which should receive ##
13 ## Uncomment and replace with the email address which should receive ##
14 ## any error reports after an application crash ##
14 ## any error reports after an application crash ##
15 ## Additionally these settings will be used by the RhodeCode mailing system ##
15 ## Additionally these settings will be used by the RhodeCode mailing system ##
16 ################################################################################
16 ################################################################################
17
17
18 ## prefix all emails subjects with given prefix, helps filtering out emails
18 ## prefix all emails subjects with given prefix, helps filtering out emails
19 #email_prefix = [RhodeCode]
19 #email_prefix = [RhodeCode]
20
20
21 ## email FROM address all mails will be sent
21 ## email FROM address all mails will be sent
22 #app_email_from = rhodecode-noreply@localhost
22 #app_email_from = rhodecode-noreply@localhost
23
23
24 #smtp_server = mail.server.com
24 #smtp_server = mail.server.com
25 #smtp_username =
25 #smtp_username =
26 #smtp_password =
26 #smtp_password =
27 #smtp_port =
27 #smtp_port =
28 #smtp_use_tls = false
28 #smtp_use_tls = false
29 #smtp_use_ssl = true
29 #smtp_use_ssl = true
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 - Recommended for Development ####
37 ## WAITRESS WSGI SERVER - Recommended for Development ####
38 ###########################################################
38 ###########################################################
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 rhodecode.ini --paste rhodecode.ini
53 ## run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
54
54
55 #use = egg:gunicorn#main
55 #use = egg:gunicorn#main
56 ## Sets the number of process workers. More workers means more concurrent connections
56 ## Sets the number of process workers. More workers means more concurrent connections
57 ## RhodeCode can handle at the same time. Each additional worker also it increases
57 ## RhodeCode can handle at the same time. Each additional worker also it increases
58 ## memory usage as each has it's own set of caches.
58 ## memory usage as each has it's own set of caches.
59 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
59 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
60 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
60 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
61 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
61 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
62 ## when using more than 1 worker.
62 ## when using more than 1 worker.
63 #workers = 2
63 #workers = 2
64
64
65 ## Gunicorn access log level
65 ## Gunicorn access log level
66 #loglevel = info
66 #loglevel = info
67
67
68 ## process name visible in process list
68 ## process name visible in process list
69 #proc_name = rhodecode
69 #proc_name = rhodecode
70
70
71 ## type of worker class, one of sync, gevent
71 ## type of worker class, one of sync, gevent
72 ## recommended for bigger setup is using of of other than sync one
72 ## recommended for bigger setup is using of of other than sync one
73 #worker_class = gevent
73 #worker_class = gevent
74
74
75 ## The maximum number of simultaneous clients. Valid only for Gevent
75 ## The maximum number of simultaneous clients. Valid only for Gevent
76 #worker_connections = 10
76 #worker_connections = 10
77
77
78 ## max number of requests that worker will handle before being gracefully
78 ## max number of requests that worker will handle before being gracefully
79 ## restarted, could prevent memory leaks
79 ## restarted, could prevent memory leaks
80 #max_requests = 1000
80 #max_requests = 1000
81 #max_requests_jitter = 30
81 #max_requests_jitter = 30
82
82
83 ## amount of time a worker can spend with handling a request before it
83 ## amount of time a worker can spend with handling a request before it
84 ## gets killed and restarted. Set to 6hrs
84 ## gets killed and restarted. Set to 6hrs
85 #timeout = 21600
85 #timeout = 21600
86
86
87 ## The maximum size of HTTP request line in bytes.
87 ## The maximum size of HTTP request line in bytes.
88 ## 0 for unlimited
88 ## 0 for unlimited
89 #limit_request_line = 0
89 #limit_request_line = 0
90
90
91 ## Limit the number of HTTP headers fields in a request.
91 ## Limit the number of HTTP headers fields in a request.
92 ## By default this value is 100 and can't be larger than 32768.
92 ## By default this value is 100 and can't be larger than 32768.
93 #limit_request_fields = 32768
93 #limit_request_fields = 32768
94
94
95 ## Limit the allowed size of an HTTP request header field.
95 ## Limit the allowed size of an HTTP request header field.
96 ## Value is a positive number or 0.
96 ## Value is a positive number or 0.
97 ## Setting it to 0 will allow unlimited header field sizes.
97 ## Setting it to 0 will allow unlimited header field sizes.
98 #limit_request_field_size = 0
98 #limit_request_field_size = 0
99
99
100 ## Timeout for graceful workers restart.
100 ## Timeout for graceful workers restart.
101 ## After receiving a restart signal, workers have this much time to finish
101 ## After receiving a restart signal, workers have this much time to finish
102 ## serving requests. Workers still alive after the timeout (starting from the
102 ## serving requests. Workers still alive after the timeout (starting from the
103 ## receipt of the restart signal) are force killed.
103 ## receipt of the restart signal) are force killed.
104 #graceful_timeout = 3600
104 #graceful_timeout = 3600
105
105
106 # The number of seconds to wait for requests on a Keep-Alive connection.
106 # The number of seconds to wait for requests on a Keep-Alive connection.
107 # Generally set in the 1-5 seconds range.
107 # Generally set in the 1-5 seconds range.
108 #keepalive = 2
108 #keepalive = 2
109
109
110 ## Maximum memory usage that each worker can use before it will receive a
110 ## Maximum memory usage that each worker can use before it will receive a
111 ## graceful restart signal, e.g 10MB = 10485760 (10 * 1024 * 1024)
111 ## graceful restart signal, e.g 10MB = 10485760 (10 * 1024 * 1024)
112 # 0 = memory monitoring is disabled
112 # 0 = memory monitoring is disabled
113 #memory_max_usage = 0
113 #memory_max_usage = 0
114
114
115 ## How often in seconds to check for memory usage for each gunicorn worker
115 ## How often in seconds to check for memory usage for each gunicorn worker
116 #memory_usage_check_interval = 60
116 #memory_usage_check_interval = 60
117
117
118 ## Threshold value for which we don't recycle worker if GarbageCollection
118 ## Threshold value for which we don't recycle worker if GarbageCollection
119 ## frees up enough resources. Before each restart we try to run GC on worker
119 ## frees up enough resources. Before each restart we try to run GC on worker
120 ## in case we get enough free memory after that, restart will not happen.
120 ## in case we get enough free memory after that, restart will not happen.
121 #memory_usage_recovery_threshold = 0.8
121 #memory_usage_recovery_threshold = 0.8
122
122
123 ## prefix middleware for RhodeCode.
123 ## prefix middleware for RhodeCode.
124 ## recommended when using proxy setup.
124 ## recommended when using proxy setup.
125 ## allows to set RhodeCode under a prefix in server.
125 ## allows to set RhodeCode under a prefix in server.
126 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
126 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
127 ## And set your prefix like: `prefix = /custom_prefix`
127 ## And set your prefix like: `prefix = /custom_prefix`
128 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
128 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
129 ## to make your cookies only work on prefix url
129 ## to make your cookies only work on prefix url
130 [filter:proxy-prefix]
130 [filter:proxy-prefix]
131 use = egg:PasteDeploy#prefix
131 use = egg:PasteDeploy#prefix
132 prefix = /
132 prefix = /
133
133
134 [app:main]
134 [app:main]
135 ## The %(here)s variable will be replaced with the absolute path of parent directory
135 ## The %(here)s variable will be replaced with the absolute path of parent directory
136 ## of this file
136 ## of this file
137 ## In addition ENVIRONMENT variables usage is possible, e.g
137 ## In addition ENVIRONMENT variables usage is possible, e.g
138 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
138 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
139
139
140 use = egg:rhodecode-enterprise-ce
140 use = egg:rhodecode-enterprise-ce
141
141
142 ## enable proxy prefix middleware, defined above
142 ## enable proxy prefix middleware, defined above
143 #filter-with = proxy-prefix
143 #filter-with = proxy-prefix
144
144
145 # During development the we want to have the debug toolbar enabled
145 # During development the we want to have the debug toolbar enabled
146 pyramid.includes =
146 pyramid.includes =
147 pyramid_debugtoolbar
147 pyramid_debugtoolbar
148 rhodecode.lib.middleware.request_wrapper
148 rhodecode.lib.middleware.request_wrapper
149
149
150 pyramid.reload_templates = true
150 pyramid.reload_templates = true
151
151
152 debugtoolbar.hosts = 0.0.0.0/0
152 debugtoolbar.hosts = 0.0.0.0/0
153 debugtoolbar.exclude_prefixes =
153 debugtoolbar.exclude_prefixes =
154 /css
154 /css
155 /fonts
155 /fonts
156 /images
156 /images
157 /js
157 /js
158
158
159 ## RHODECODE PLUGINS ##
159 ## RHODECODE PLUGINS ##
160 rhodecode.includes =
160 rhodecode.includes =
161 rhodecode.api
161 rhodecode.api
162
162
163
163
164 # api prefix url
164 # api prefix url
165 rhodecode.api.url = /_admin/api
165 rhodecode.api.url = /_admin/api
166
166
167
167
168 ## END RHODECODE PLUGINS ##
168 ## END RHODECODE PLUGINS ##
169
169
170 ## encryption key used to encrypt social plugin tokens,
170 ## encryption key used to encrypt social plugin tokens,
171 ## remote_urls with credentials etc, if not set it defaults to
171 ## remote_urls with credentials etc, if not set it defaults to
172 ## `beaker.session.secret`
172 ## `beaker.session.secret`
173 #rhodecode.encrypted_values.secret =
173 #rhodecode.encrypted_values.secret =
174
174
175 ## decryption strict mode (enabled by default). It controls if decryption raises
175 ## decryption strict mode (enabled by default). It controls if decryption raises
176 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
176 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
177 #rhodecode.encrypted_values.strict = false
177 #rhodecode.encrypted_values.strict = false
178
178
179 ## Pick algorithm for encryption. Either fernet (more secure) or aes (default)
179 ## Pick algorithm for encryption. Either fernet (more secure) or aes (default)
180 ## fernet is safer, and we strongly recommend switching to it.
180 ## fernet is safer, and we strongly recommend switching to it.
181 ## Due to backward compatibility aes is used as default.
181 ## Due to backward compatibility aes is used as default.
182 #rhodecode.encrypted_values.algorithm = fernet
182 #rhodecode.encrypted_values.algorithm = fernet
183
183
184 ## return gzipped responses from RhodeCode (static files/application)
184 ## return gzipped responses from RhodeCode (static files/application)
185 gzip_responses = false
185 gzip_responses = false
186
186
187 ## auto-generate javascript routes file on startup
187 ## auto-generate javascript routes file on startup
188 generate_js_files = false
188 generate_js_files = false
189
189
190 ## System global default language.
190 ## System global default language.
191 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
191 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
192 lang = en
192 lang = en
193
193
194 ## Perform a full repository scan and import on each server start.
194 ## Perform a full repository scan and import on each server start.
195 ## Settings this to true could lead to very long startup time.
195 ## Settings this to true could lead to very long startup time.
196 startup.import_repos = false
196 startup.import_repos = false
197
197
198 ## Uncomment and set this path to use archive download cache.
198 ## Uncomment and set this path to use archive download cache.
199 ## Once enabled, generated archives will be cached at this location
199 ## Once enabled, generated archives will be cached at this location
200 ## and served from the cache during subsequent requests for the same archive of
200 ## and served from the cache during subsequent requests for the same archive of
201 ## the repository.
201 ## the repository.
202 #archive_cache_dir = /tmp/tarballcache
202 #archive_cache_dir = /tmp/tarballcache
203
203
204 ## URL at which the application is running. This is used for Bootstrapping
204 ## URL at which the application is running. This is used for Bootstrapping
205 ## requests in context when no web request is available. Used in ishell, or
205 ## requests in context when no web request is available. Used in ishell, or
206 ## SSH calls. Set this for events to receive proper url for SSH calls.
206 ## SSH calls. Set this for events to receive proper url for SSH calls.
207 app.base_url = http://rhodecode.local
207 app.base_url = http://rhodecode.local
208
208
209 ## Unique application ID. Should be a random unique string for security.
209 ## Unique application ID. Should be a random unique string for security.
210 app_instance_uuid = rc-production
210 app_instance_uuid = rc-production
211
211
212 ## Cut off limit for large diffs (size in bytes). If overall diff size on
212 ## Cut off limit for large diffs (size in bytes). If overall diff size on
213 ## commit, or pull request exceeds this limit this diff will be displayed
213 ## commit, or pull request exceeds this limit this diff will be displayed
214 ## partially. E.g 512000 == 512Kb
214 ## partially. E.g 512000 == 512Kb
215 cut_off_limit_diff = 512000
215 cut_off_limit_diff = 512000
216
216
217 ## Cut off limit for large files inside diffs (size in bytes). Each individual
217 ## Cut off limit for large files inside diffs (size in bytes). Each individual
218 ## file inside diff which exceeds this limit will be displayed partially.
218 ## file inside diff which exceeds this limit will be displayed partially.
219 ## E.g 128000 == 128Kb
219 ## E.g 128000 == 128Kb
220 cut_off_limit_file = 128000
220 cut_off_limit_file = 128000
221
221
222 ## use cached version of vcs repositories everywhere. Recommended to be `true`
222 ## use cached version of vcs repositories everywhere. Recommended to be `true`
223 vcs_full_cache = true
223 vcs_full_cache = true
224
224
225 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
225 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
226 ## Normally this is controlled by proper http flags sent from http server
226 ## Normally this is controlled by proper http flags sent from http server
227 force_https = false
227 force_https = false
228
228
229 ## use Strict-Transport-Security headers
229 ## use Strict-Transport-Security headers
230 use_htsts = false
230 use_htsts = false
231
231
232 # Set to true if your repos are exposed using the dumb protocol
232 # Set to true if your repos are exposed using the dumb protocol
233 git_update_server_info = false
233 git_update_server_info = false
234
234
235 ## RSS/ATOM feed options
235 ## RSS/ATOM feed options
236 rss_cut_off_limit = 256000
236 rss_cut_off_limit = 256000
237 rss_items_per_page = 10
237 rss_items_per_page = 10
238 rss_include_diff = false
238 rss_include_diff = false
239
239
240 ## gist URL alias, used to create nicer urls for gist. This should be an
240 ## gist URL alias, used to create nicer urls for gist. This should be an
241 ## url that does rewrites to _admin/gists/{gistid}.
241 ## url that does rewrites to _admin/gists/{gistid}.
242 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
242 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
243 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
243 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
244 gist_alias_url =
244 gist_alias_url =
245
245
246 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
246 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
247 ## used for access.
247 ## used for access.
248 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
248 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
249 ## came from the the logged in user who own this authentication token.
249 ## came from the the logged in user who own this authentication token.
250 ## Additionally @TOKEN syntax can be used to bound the view to specific
250 ## Additionally @TOKEN syntax can be used to bound the view to specific
251 ## authentication token. Such view would be only accessible when used together
251 ## authentication token. Such view would be only accessible when used together
252 ## with this authentication token
252 ## with this authentication token
253 ##
253 ##
254 ## list of all views can be found under `/_admin/permissions/auth_token_access`
254 ## list of all views can be found under `/_admin/permissions/auth_token_access`
255 ## The list should be "," separated and on a single line.
255 ## The list should be "," separated and on a single line.
256 ##
256 ##
257 ## Most common views to enable:
257 ## Most common views to enable:
258 # RepoCommitsView:repo_commit_download
258 # RepoCommitsView:repo_commit_download
259 # RepoCommitsView:repo_commit_patch
259 # RepoCommitsView:repo_commit_patch
260 # RepoCommitsView:repo_commit_raw
260 # RepoCommitsView:repo_commit_raw
261 # RepoCommitsView:repo_commit_raw@TOKEN
261 # RepoCommitsView:repo_commit_raw@TOKEN
262 # RepoFilesView:repo_files_diff
262 # RepoFilesView:repo_files_diff
263 # RepoFilesView:repo_archivefile
263 # RepoFilesView:repo_archivefile
264 # RepoFilesView:repo_file_raw
264 # RepoFilesView:repo_file_raw
265 # GistView:*
265 # GistView:*
266 api_access_controllers_whitelist =
266 api_access_controllers_whitelist =
267
267
268 ## Default encoding used to convert from and to unicode
268 ## Default encoding used to convert from and to unicode
269 ## can be also a comma separated list of encoding in case of mixed encodings
269 ## can be also a comma separated list of encoding in case of mixed encodings
270 default_encoding = UTF-8
270 default_encoding = UTF-8
271
271
272 ## instance-id prefix
272 ## instance-id prefix
273 ## a prefix key for this instance used for cache invalidation when running
273 ## a prefix key for this instance used for cache invalidation when running
274 ## multiple instances of RhodeCode, make sure it's globally unique for
274 ## multiple instances of RhodeCode, make sure it's globally unique for
275 ## all running RhodeCode instances. Leave empty if you don't use it
275 ## all running RhodeCode instances. Leave empty if you don't use it
276 instance_id =
276 instance_id =
277
277
278 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
278 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
279 ## of an authentication plugin also if it is disabled by it's settings.
279 ## of an authentication plugin also if it is disabled by it's settings.
280 ## This could be useful if you are unable to log in to the system due to broken
280 ## This could be useful if you are unable to log in to the system due to broken
281 ## authentication settings. Then you can enable e.g. the internal RhodeCode auth
281 ## authentication settings. Then you can enable e.g. the internal RhodeCode auth
282 ## module to log in again and fix the settings.
282 ## module to log in again and fix the settings.
283 ##
283 ##
284 ## Available builtin plugin IDs (hash is part of the ID):
284 ## Available builtin plugin IDs (hash is part of the ID):
285 ## egg:rhodecode-enterprise-ce#rhodecode
285 ## egg:rhodecode-enterprise-ce#rhodecode
286 ## egg:rhodecode-enterprise-ce#pam
286 ## egg:rhodecode-enterprise-ce#pam
287 ## egg:rhodecode-enterprise-ce#ldap
287 ## egg:rhodecode-enterprise-ce#ldap
288 ## egg:rhodecode-enterprise-ce#jasig_cas
288 ## egg:rhodecode-enterprise-ce#jasig_cas
289 ## egg:rhodecode-enterprise-ce#headers
289 ## egg:rhodecode-enterprise-ce#headers
290 ## egg:rhodecode-enterprise-ce#crowd
290 ## egg:rhodecode-enterprise-ce#crowd
291 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
291 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
292
292
293 ## Flag to control loading of legacy plugins in py:/path format
294 auth_plugin.import_legacy_plugins = true
295
293 ## alternative return HTTP header for failed authentication. Default HTTP
296 ## alternative return HTTP header for failed authentication. Default HTTP
294 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
297 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
295 ## handling that causing a series of failed authentication calls.
298 ## handling that causing a series of failed authentication calls.
296 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
299 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
297 ## This will be served instead of default 401 on bad authentication
300 ## This will be served instead of default 401 on bad authentication
298 auth_ret_code =
301 auth_ret_code =
299
302
300 ## use special detection method when serving auth_ret_code, instead of serving
303 ## use special detection method when serving auth_ret_code, instead of serving
301 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
304 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
302 ## and then serve auth_ret_code to clients
305 ## and then serve auth_ret_code to clients
303 auth_ret_code_detection = false
306 auth_ret_code_detection = false
304
307
305 ## locking return code. When repository is locked return this HTTP code. 2XX
308 ## locking return code. When repository is locked return this HTTP code. 2XX
306 ## codes don't break the transactions while 4XX codes do
309 ## codes don't break the transactions while 4XX codes do
307 lock_ret_code = 423
310 lock_ret_code = 423
308
311
309 ## allows to change the repository location in settings page
312 ## allows to change the repository location in settings page
310 allow_repo_location_change = true
313 allow_repo_location_change = true
311
314
312 ## allows to setup custom hooks in settings page
315 ## allows to setup custom hooks in settings page
313 allow_custom_hooks_settings = true
316 allow_custom_hooks_settings = true
314
317
315 ## Generated license token required for EE edition license.
318 ## Generated license token required for EE edition license.
316 ## New generated token value can be found in Admin > settings > license page.
319 ## New generated token value can be found in Admin > settings > license page.
317 license_token =
320 license_token =
318
321
319 ## This flag would hide sensitive information on the license page
322 ## This flag would hide sensitive information on the license page
320 license.hide_license_info = false
323 license.hide_license_info = false
321
324
322 ## supervisor connection uri, for managing supervisor and logs.
325 ## supervisor connection uri, for managing supervisor and logs.
323 supervisor.uri =
326 supervisor.uri =
324 ## supervisord group name/id we only want this RC instance to handle
327 ## supervisord group name/id we only want this RC instance to handle
325 supervisor.group_id = dev
328 supervisor.group_id = dev
326
329
327 ## Display extended labs settings
330 ## Display extended labs settings
328 labs_settings_active = true
331 labs_settings_active = true
329
332
330 ## Custom exception store path, defaults to TMPDIR
333 ## Custom exception store path, defaults to TMPDIR
331 ## This is used to store exception from RhodeCode in shared directory
334 ## This is used to store exception from RhodeCode in shared directory
332 #exception_tracker.store_path =
335 #exception_tracker.store_path =
333
336
334 ## File store configuration. This is used to store and serve uploaded files
337 ## File store configuration. This is used to store and serve uploaded files
335 file_store.enabled = true
338 file_store.enabled = true
336 ## Storage backend, available options are: local
339 ## Storage backend, available options are: local
337 file_store.backend = local
340 file_store.backend = local
338 ## path to store the uploaded binaries
341 ## path to store the uploaded binaries
339 file_store.storage_path = %(here)s/data/file_store
342 file_store.storage_path = %(here)s/data/file_store
340
343
341
344
342 ####################################
345 ####################################
343 ### CELERY CONFIG ####
346 ### CELERY CONFIG ####
344 ####################################
347 ####################################
345 ## run: /path/to/celery worker \
348 ## run: /path/to/celery worker \
346 ## -E --beat --app rhodecode.lib.celerylib.loader \
349 ## -E --beat --app rhodecode.lib.celerylib.loader \
347 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
350 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
348 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
351 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
349
352
350 use_celery = false
353 use_celery = false
351
354
352 ## connection url to the message broker (default redis)
355 ## connection url to the message broker (default redis)
353 celery.broker_url = redis://localhost:6379/8
356 celery.broker_url = redis://localhost:6379/8
354
357
355 ## rabbitmq example
358 ## rabbitmq example
356 #celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
359 #celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
357
360
358 ## maximum tasks to execute before worker restart
361 ## maximum tasks to execute before worker restart
359 celery.max_tasks_per_child = 100
362 celery.max_tasks_per_child = 100
360
363
361 ## tasks will never be sent to the queue, but executed locally instead.
364 ## tasks will never be sent to the queue, but executed locally instead.
362 celery.task_always_eager = false
365 celery.task_always_eager = false
363
366
364 #####################################
367 #####################################
365 ### DOGPILE CACHE ####
368 ### DOGPILE CACHE ####
366 #####################################
369 #####################################
367 ## Default cache dir for caches. Putting this into a ramdisk
370 ## Default cache dir for caches. Putting this into a ramdisk
368 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
371 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
369 ## large amount of space
372 ## large amount of space
370 cache_dir = %(here)s/data
373 cache_dir = %(here)s/data
371
374
372 ## `cache_perms` cache settings for permission tree, auth TTL.
375 ## `cache_perms` cache settings for permission tree, auth TTL.
373 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
376 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
374 rc_cache.cache_perms.expiration_time = 300
377 rc_cache.cache_perms.expiration_time = 300
375
378
376 ## alternative `cache_perms` redis backend with distributed lock
379 ## alternative `cache_perms` redis backend with distributed lock
377 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
380 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
378 #rc_cache.cache_perms.expiration_time = 300
381 #rc_cache.cache_perms.expiration_time = 300
379 ## redis_expiration_time needs to be greater then expiration_time
382 ## redis_expiration_time needs to be greater then expiration_time
380 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
383 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
381 #rc_cache.cache_perms.arguments.socket_timeout = 30
384 #rc_cache.cache_perms.arguments.socket_timeout = 30
382 #rc_cache.cache_perms.arguments.host = localhost
385 #rc_cache.cache_perms.arguments.host = localhost
383 #rc_cache.cache_perms.arguments.port = 6379
386 #rc_cache.cache_perms.arguments.port = 6379
384 #rc_cache.cache_perms.arguments.db = 0
387 #rc_cache.cache_perms.arguments.db = 0
385 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
388 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
386 #rc_cache.cache_perms.arguments.distributed_lock = true
389 #rc_cache.cache_perms.arguments.distributed_lock = true
387
390
388 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
391 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
389 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
392 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
390 rc_cache.cache_repo.expiration_time = 2592000
393 rc_cache.cache_repo.expiration_time = 2592000
391
394
392 ## alternative `cache_repo` redis backend with distributed lock
395 ## alternative `cache_repo` redis backend with distributed lock
393 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
396 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
394 #rc_cache.cache_repo.expiration_time = 2592000
397 #rc_cache.cache_repo.expiration_time = 2592000
395 ## redis_expiration_time needs to be greater then expiration_time
398 ## redis_expiration_time needs to be greater then expiration_time
396 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
399 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
397 #rc_cache.cache_repo.arguments.socket_timeout = 30
400 #rc_cache.cache_repo.arguments.socket_timeout = 30
398 #rc_cache.cache_repo.arguments.host = localhost
401 #rc_cache.cache_repo.arguments.host = localhost
399 #rc_cache.cache_repo.arguments.port = 6379
402 #rc_cache.cache_repo.arguments.port = 6379
400 #rc_cache.cache_repo.arguments.db = 1
403 #rc_cache.cache_repo.arguments.db = 1
401 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
404 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
402 #rc_cache.cache_repo.arguments.distributed_lock = true
405 #rc_cache.cache_repo.arguments.distributed_lock = true
403
406
404 ## cache settings for SQL queries, this needs to use memory type backend
407 ## cache settings for SQL queries, this needs to use memory type backend
405 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
408 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
406 rc_cache.sql_cache_short.expiration_time = 30
409 rc_cache.sql_cache_short.expiration_time = 30
407
410
408 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
411 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
409 ## type backend as the objects kept are not pickle serializable
412 ## type backend as the objects kept are not pickle serializable
410 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
413 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
411 ## by default we use 96H, this is using invalidation on push anyway
414 ## by default we use 96H, this is using invalidation on push anyway
412 rc_cache.cache_repo_longterm.expiration_time = 345600
415 rc_cache.cache_repo_longterm.expiration_time = 345600
413 ## max items in LRU cache, reduce this number to save memory, and expire last used
416 ## max items in LRU cache, reduce this number to save memory, and expire last used
414 ## cached objects
417 ## cached objects
415 rc_cache.cache_repo_longterm.max_size = 10000
418 rc_cache.cache_repo_longterm.max_size = 10000
416
419
417
420
418 ####################################
421 ####################################
419 ### BEAKER SESSION ####
422 ### BEAKER SESSION ####
420 ####################################
423 ####################################
421
424
422 ## .session.type is type of storage options for the session, current allowed
425 ## .session.type is type of storage options for the session, current allowed
423 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
426 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
424 beaker.session.type = file
427 beaker.session.type = file
425 beaker.session.data_dir = %(here)s/data/sessions
428 beaker.session.data_dir = %(here)s/data/sessions
426
429
427 ## redis sessions
430 ## redis sessions
428 #beaker.session.type = ext:redis
431 #beaker.session.type = ext:redis
429 #beaker.session.url = redis://127.0.0.1:6379/2
432 #beaker.session.url = redis://127.0.0.1:6379/2
430
433
431 ## db based session, fast, and allows easy management over logged in users
434 ## db based session, fast, and allows easy management over logged in users
432 #beaker.session.type = ext:database
435 #beaker.session.type = ext:database
433 #beaker.session.table_name = db_session
436 #beaker.session.table_name = db_session
434 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
437 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
435 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
438 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
436 #beaker.session.sa.pool_recycle = 3600
439 #beaker.session.sa.pool_recycle = 3600
437 #beaker.session.sa.echo = false
440 #beaker.session.sa.echo = false
438
441
439 beaker.session.key = rhodecode
442 beaker.session.key = rhodecode
440 beaker.session.secret = develop-rc-uytcxaz
443 beaker.session.secret = develop-rc-uytcxaz
441 beaker.session.lock_dir = %(here)s/data/sessions/lock
444 beaker.session.lock_dir = %(here)s/data/sessions/lock
442
445
443 ## Secure encrypted cookie. Requires AES and AES python libraries
446 ## Secure encrypted cookie. Requires AES and AES python libraries
444 ## you must disable beaker.session.secret to use this
447 ## you must disable beaker.session.secret to use this
445 #beaker.session.encrypt_key = key_for_encryption
448 #beaker.session.encrypt_key = key_for_encryption
446 #beaker.session.validate_key = validation_key
449 #beaker.session.validate_key = validation_key
447
450
448 ## sets session as invalid(also logging out user) if it haven not been
451 ## sets session as invalid(also logging out user) if it haven not been
449 ## accessed for given amount of time in seconds
452 ## accessed for given amount of time in seconds
450 beaker.session.timeout = 2592000
453 beaker.session.timeout = 2592000
451 beaker.session.httponly = true
454 beaker.session.httponly = true
452 ## Path to use for the cookie. Set to prefix if you use prefix middleware
455 ## Path to use for the cookie. Set to prefix if you use prefix middleware
453 #beaker.session.cookie_path = /custom_prefix
456 #beaker.session.cookie_path = /custom_prefix
454
457
455 ## uncomment for https secure cookie
458 ## uncomment for https secure cookie
456 beaker.session.secure = false
459 beaker.session.secure = false
457
460
458 ## auto save the session to not to use .save()
461 ## auto save the session to not to use .save()
459 beaker.session.auto = false
462 beaker.session.auto = false
460
463
461 ## default cookie expiration time in seconds, set to `true` to set expire
464 ## default cookie expiration time in seconds, set to `true` to set expire
462 ## at browser close
465 ## at browser close
463 #beaker.session.cookie_expires = 3600
466 #beaker.session.cookie_expires = 3600
464
467
465 ###################################
468 ###################################
466 ## SEARCH INDEXING CONFIGURATION ##
469 ## SEARCH INDEXING CONFIGURATION ##
467 ###################################
470 ###################################
468 ## Full text search indexer is available in rhodecode-tools under
471 ## Full text search indexer is available in rhodecode-tools under
469 ## `rhodecode-tools index` command
472 ## `rhodecode-tools index` command
470
473
471 ## WHOOSH Backend, doesn't require additional services to run
474 ## WHOOSH Backend, doesn't require additional services to run
472 ## it works good with few dozen repos
475 ## it works good with few dozen repos
473 search.module = rhodecode.lib.index.whoosh
476 search.module = rhodecode.lib.index.whoosh
474 search.location = %(here)s/data/index
477 search.location = %(here)s/data/index
475
478
476 ########################################
479 ########################################
477 ### CHANNELSTREAM CONFIG ####
480 ### CHANNELSTREAM CONFIG ####
478 ########################################
481 ########################################
479 ## channelstream enables persistent connections and live notification
482 ## channelstream enables persistent connections and live notification
480 ## in the system. It's also used by the chat system
483 ## in the system. It's also used by the chat system
481
484
482 channelstream.enabled = false
485 channelstream.enabled = false
483
486
484 ## server address for channelstream server on the backend
487 ## server address for channelstream server on the backend
485 channelstream.server = 127.0.0.1:9800
488 channelstream.server = 127.0.0.1:9800
486
489
487 ## location of the channelstream server from outside world
490 ## location of the channelstream server from outside world
488 ## use ws:// for http or wss:// for https. This address needs to be handled
491 ## use ws:// for http or wss:// for https. This address needs to be handled
489 ## by external HTTP server such as Nginx or Apache
492 ## by external HTTP server such as Nginx or Apache
490 ## see Nginx/Apache configuration examples in our docs
493 ## see Nginx/Apache configuration examples in our docs
491 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
494 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
492 channelstream.secret = secret
495 channelstream.secret = secret
493 channelstream.history.location = %(here)s/channelstream_history
496 channelstream.history.location = %(here)s/channelstream_history
494
497
495 ## Internal application path that Javascript uses to connect into.
498 ## Internal application path that Javascript uses to connect into.
496 ## If you use proxy-prefix the prefix should be added before /_channelstream
499 ## If you use proxy-prefix the prefix should be added before /_channelstream
497 channelstream.proxy_path = /_channelstream
500 channelstream.proxy_path = /_channelstream
498
501
499
502
500 ###################################
503 ###################################
501 ## APPENLIGHT CONFIG ##
504 ## APPENLIGHT CONFIG ##
502 ###################################
505 ###################################
503
506
504 ## Appenlight is tailored to work with RhodeCode, see
507 ## Appenlight is tailored to work with RhodeCode, see
505 ## http://appenlight.com for details how to obtain an account
508 ## http://appenlight.com for details how to obtain an account
506
509
507 ## Appenlight integration enabled
510 ## Appenlight integration enabled
508 appenlight = false
511 appenlight = false
509
512
510 appenlight.server_url = https://api.appenlight.com
513 appenlight.server_url = https://api.appenlight.com
511 appenlight.api_key = YOUR_API_KEY
514 appenlight.api_key = YOUR_API_KEY
512 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
515 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
513
516
514 ## used for JS client
517 ## used for JS client
515 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
518 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
516
519
517 ## TWEAK AMOUNT OF INFO SENT HERE
520 ## TWEAK AMOUNT OF INFO SENT HERE
518
521
519 ## enables 404 error logging (default False)
522 ## enables 404 error logging (default False)
520 appenlight.report_404 = false
523 appenlight.report_404 = false
521
524
522 ## time in seconds after request is considered being slow (default 1)
525 ## time in seconds after request is considered being slow (default 1)
523 appenlight.slow_request_time = 1
526 appenlight.slow_request_time = 1
524
527
525 ## record slow requests in application
528 ## record slow requests in application
526 ## (needs to be enabled for slow datastore recording and time tracking)
529 ## (needs to be enabled for slow datastore recording and time tracking)
527 appenlight.slow_requests = true
530 appenlight.slow_requests = true
528
531
529 ## enable hooking to application loggers
532 ## enable hooking to application loggers
530 appenlight.logging = true
533 appenlight.logging = true
531
534
532 ## minimum log level for log capture
535 ## minimum log level for log capture
533 appenlight.logging.level = WARNING
536 appenlight.logging.level = WARNING
534
537
535 ## send logs only from erroneous/slow requests
538 ## send logs only from erroneous/slow requests
536 ## (saves API quota for intensive logging)
539 ## (saves API quota for intensive logging)
537 appenlight.logging_on_error = false
540 appenlight.logging_on_error = false
538
541
539 ## list of additional keywords that should be grabbed from environ object
542 ## list of additional keywords that should be grabbed from environ object
540 ## can be string with comma separated list of words in lowercase
543 ## can be string with comma separated list of words in lowercase
541 ## (by default client will always send following info:
544 ## (by default client will always send following info:
542 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
545 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
543 ## start with HTTP* this list be extended with additional keywords here
546 ## start with HTTP* this list be extended with additional keywords here
544 appenlight.environ_keys_whitelist =
547 appenlight.environ_keys_whitelist =
545
548
546 ## list of keywords that should be blanked from request object
549 ## list of keywords that should be blanked from request object
547 ## can be string with comma separated list of words in lowercase
550 ## can be string with comma separated list of words in lowercase
548 ## (by default client will always blank keys that contain following words
551 ## (by default client will always blank keys that contain following words
549 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
552 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
550 ## this list be extended with additional keywords set here
553 ## this list be extended with additional keywords set here
551 appenlight.request_keys_blacklist =
554 appenlight.request_keys_blacklist =
552
555
553 ## list of namespaces that should be ignores when gathering log entries
556 ## list of namespaces that should be ignores when gathering log entries
554 ## can be string with comma separated list of namespaces
557 ## can be string with comma separated list of namespaces
555 ## (by default the client ignores own entries: appenlight_client.client)
558 ## (by default the client ignores own entries: appenlight_client.client)
556 appenlight.log_namespace_blacklist =
559 appenlight.log_namespace_blacklist =
557
560
558 # enable debug style page
561 # enable debug style page
559 debug_style = true
562 debug_style = true
560
563
561 ###########################################
564 ###########################################
562 ### MAIN RHODECODE DATABASE CONFIG ###
565 ### MAIN RHODECODE DATABASE CONFIG ###
563 ###########################################
566 ###########################################
564 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
567 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
565 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
568 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
566 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8
569 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8
567 # pymysql is an alternative driver for MySQL, use in case of problems with default one
570 # pymysql is an alternative driver for MySQL, use in case of problems with default one
568 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
571 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
569
572
570 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
573 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
571
574
572 # see sqlalchemy docs for other advanced settings
575 # see sqlalchemy docs for other advanced settings
573
576
574 ## print the sql statements to output
577 ## print the sql statements to output
575 sqlalchemy.db1.echo = false
578 sqlalchemy.db1.echo = false
576 ## recycle the connections after this amount of seconds
579 ## recycle the connections after this amount of seconds
577 sqlalchemy.db1.pool_recycle = 3600
580 sqlalchemy.db1.pool_recycle = 3600
578
581
579 ## the number of connections to keep open inside the connection pool.
582 ## the number of connections to keep open inside the connection pool.
580 ## 0 indicates no limit
583 ## 0 indicates no limit
581 #sqlalchemy.db1.pool_size = 5
584 #sqlalchemy.db1.pool_size = 5
582
585
583 ## the number of connections to allow in connection pool "overflow", that is
586 ## the number of connections to allow in connection pool "overflow", that is
584 ## connections that can be opened above and beyond the pool_size setting,
587 ## connections that can be opened above and beyond the pool_size setting,
585 ## which defaults to five.
588 ## which defaults to five.
586 #sqlalchemy.db1.max_overflow = 10
589 #sqlalchemy.db1.max_overflow = 10
587
590
588 ## Connection check ping, used to detect broken database connections
591 ## Connection check ping, used to detect broken database connections
589 ## could be enabled to better handle cases if MySQL has gone away errors
592 ## could be enabled to better handle cases if MySQL has gone away errors
590 #sqlalchemy.db1.ping_connection = true
593 #sqlalchemy.db1.ping_connection = true
591
594
592 ##################
595 ##################
593 ### VCS CONFIG ###
596 ### VCS CONFIG ###
594 ##################
597 ##################
595 vcs.server.enable = true
598 vcs.server.enable = true
596 vcs.server = localhost:9900
599 vcs.server = localhost:9900
597
600
598 ## Web server connectivity protocol, responsible for web based VCS operations
601 ## Web server connectivity protocol, responsible for web based VCS operations
599 ## Available protocols are:
602 ## Available protocols are:
600 ## `http` - use http-rpc backend (default)
603 ## `http` - use http-rpc backend (default)
601 vcs.server.protocol = http
604 vcs.server.protocol = http
602
605
603 ## Push/Pull operations protocol, available options are:
606 ## Push/Pull operations protocol, available options are:
604 ## `http` - use http-rpc backend (default)
607 ## `http` - use http-rpc backend (default)
605 vcs.scm_app_implementation = http
608 vcs.scm_app_implementation = http
606
609
607 ## Push/Pull operations hooks protocol, available options are:
610 ## Push/Pull operations hooks protocol, available options are:
608 ## `http` - use http-rpc backend (default)
611 ## `http` - use http-rpc backend (default)
609 vcs.hooks.protocol = http
612 vcs.hooks.protocol = http
610
613
611 ## Host on which this instance is listening for hooks. If vcsserver is in other location
614 ## Host on which this instance is listening for hooks. If vcsserver is in other location
612 ## this should be adjusted.
615 ## this should be adjusted.
613 vcs.hooks.host = 127.0.0.1
616 vcs.hooks.host = 127.0.0.1
614
617
615 vcs.server.log_level = debug
618 vcs.server.log_level = debug
616 ## Start VCSServer with this instance as a subprocess, useful for development
619 ## Start VCSServer with this instance as a subprocess, useful for development
617 vcs.start_server = false
620 vcs.start_server = false
618
621
619 ## List of enabled VCS backends, available options are:
622 ## List of enabled VCS backends, available options are:
620 ## `hg` - mercurial
623 ## `hg` - mercurial
621 ## `git` - git
624 ## `git` - git
622 ## `svn` - subversion
625 ## `svn` - subversion
623 vcs.backends = hg, git, svn
626 vcs.backends = hg, git, svn
624
627
625 vcs.connection_timeout = 3600
628 vcs.connection_timeout = 3600
626 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
629 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
627 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
630 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
628 #vcs.svn.compatible_version = pre-1.8-compatible
631 #vcs.svn.compatible_version = pre-1.8-compatible
629
632
630
633
631 ############################################################
634 ############################################################
632 ### Subversion proxy support (mod_dav_svn) ###
635 ### Subversion proxy support (mod_dav_svn) ###
633 ### Maps RhodeCode repo groups into SVN paths for Apache ###
636 ### Maps RhodeCode repo groups into SVN paths for Apache ###
634 ############################################################
637 ############################################################
635 ## Enable or disable the config file generation.
638 ## Enable or disable the config file generation.
636 svn.proxy.generate_config = false
639 svn.proxy.generate_config = false
637 ## Generate config file with `SVNListParentPath` set to `On`.
640 ## Generate config file with `SVNListParentPath` set to `On`.
638 svn.proxy.list_parent_path = true
641 svn.proxy.list_parent_path = true
639 ## Set location and file name of generated config file.
642 ## Set location and file name of generated config file.
640 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
643 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
641 ## alternative mod_dav config template. This needs to be a mako template
644 ## alternative mod_dav config template. This needs to be a mako template
642 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
645 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
643 ## Used as a prefix to the `Location` block in the generated config file.
646 ## Used as a prefix to the `Location` block in the generated config file.
644 ## In most cases it should be set to `/`.
647 ## In most cases it should be set to `/`.
645 svn.proxy.location_root = /
648 svn.proxy.location_root = /
646 ## Command to reload the mod dav svn configuration on change.
649 ## Command to reload the mod dav svn configuration on change.
647 ## Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh
650 ## Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh
648 ## Make sure user who runs RhodeCode process is allowed to reload Apache
651 ## Make sure user who runs RhodeCode process is allowed to reload Apache
649 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
652 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
650 ## If the timeout expires before the reload command finishes, the command will
653 ## If the timeout expires before the reload command finishes, the command will
651 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
654 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
652 #svn.proxy.reload_timeout = 10
655 #svn.proxy.reload_timeout = 10
653
656
654 ############################################################
657 ############################################################
655 ### SSH Support Settings ###
658 ### SSH Support Settings ###
656 ############################################################
659 ############################################################
657
660
658 ## Defines if a custom authorized_keys file should be created and written on
661 ## Defines if a custom authorized_keys file should be created and written on
659 ## any change user ssh keys. Setting this to false also disables possibility
662 ## any change user ssh keys. Setting this to false also disables possibility
660 ## of adding SSH keys by users from web interface. Super admins can still
663 ## of adding SSH keys by users from web interface. Super admins can still
661 ## manage SSH Keys.
664 ## manage SSH Keys.
662 ssh.generate_authorized_keyfile = false
665 ssh.generate_authorized_keyfile = false
663
666
664 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
667 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
665 # ssh.authorized_keys_ssh_opts =
668 # ssh.authorized_keys_ssh_opts =
666
669
667 ## Path to the authorized_keys file where the generate entries are placed.
670 ## Path to the authorized_keys file where the generate entries are placed.
668 ## It is possible to have multiple key files specified in `sshd_config` e.g.
671 ## It is possible to have multiple key files specified in `sshd_config` e.g.
669 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
672 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
670 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
673 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
671
674
672 ## Command to execute the SSH wrapper. The binary is available in the
675 ## Command to execute the SSH wrapper. The binary is available in the
673 ## RhodeCode installation directory.
676 ## RhodeCode installation directory.
674 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
677 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
675 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
678 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
676
679
677 ## Allow shell when executing the ssh-wrapper command
680 ## Allow shell when executing the ssh-wrapper command
678 ssh.wrapper_cmd_allow_shell = false
681 ssh.wrapper_cmd_allow_shell = false
679
682
680 ## Enables logging, and detailed output send back to the client during SSH
683 ## Enables logging, and detailed output send back to the client during SSH
681 ## operations. Useful for debugging, shouldn't be used in production.
684 ## operations. Useful for debugging, shouldn't be used in production.
682 ssh.enable_debug_logging = true
685 ssh.enable_debug_logging = true
683
686
684 ## Paths to binary executable, by default they are the names, but we can
687 ## Paths to binary executable, by default they are the names, but we can
685 ## override them if we want to use a custom one
688 ## override them if we want to use a custom one
686 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
689 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
687 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
690 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
688 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
691 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
689
692
690 ## Enables SSH key generator web interface. Disabling this still allows users
693 ## Enables SSH key generator web interface. Disabling this still allows users
691 ## to add their own keys.
694 ## to add their own keys.
692 ssh.enable_ui_key_generator = true
695 ssh.enable_ui_key_generator = true
693
696
694
697
695 ## Dummy marker to add new entries after.
698 ## Dummy marker to add new entries after.
696 ## Add any custom entries below. Please don't remove.
699 ## Add any custom entries below. Please don't remove.
697 custom.conf = 1
700 custom.conf = 1
698
701
699
702
700 ################################
703 ################################
701 ### LOGGING CONFIGURATION ####
704 ### LOGGING CONFIGURATION ####
702 ################################
705 ################################
703 [loggers]
706 [loggers]
704 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
707 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
705
708
706 [handlers]
709 [handlers]
707 keys = console, console_sql
710 keys = console, console_sql
708
711
709 [formatters]
712 [formatters]
710 keys = generic, color_formatter, color_formatter_sql
713 keys = generic, color_formatter, color_formatter_sql
711
714
712 #############
715 #############
713 ## LOGGERS ##
716 ## LOGGERS ##
714 #############
717 #############
715 [logger_root]
718 [logger_root]
716 level = NOTSET
719 level = NOTSET
717 handlers = console
720 handlers = console
718
721
719 [logger_sqlalchemy]
722 [logger_sqlalchemy]
720 level = INFO
723 level = INFO
721 handlers = console_sql
724 handlers = console_sql
722 qualname = sqlalchemy.engine
725 qualname = sqlalchemy.engine
723 propagate = 0
726 propagate = 0
724
727
725 [logger_beaker]
728 [logger_beaker]
726 level = DEBUG
729 level = DEBUG
727 handlers =
730 handlers =
728 qualname = beaker.container
731 qualname = beaker.container
729 propagate = 1
732 propagate = 1
730
733
731 [logger_rhodecode]
734 [logger_rhodecode]
732 level = DEBUG
735 level = DEBUG
733 handlers =
736 handlers =
734 qualname = rhodecode
737 qualname = rhodecode
735 propagate = 1
738 propagate = 1
736
739
737 [logger_ssh_wrapper]
740 [logger_ssh_wrapper]
738 level = DEBUG
741 level = DEBUG
739 handlers =
742 handlers =
740 qualname = ssh_wrapper
743 qualname = ssh_wrapper
741 propagate = 1
744 propagate = 1
742
745
743 [logger_celery]
746 [logger_celery]
744 level = DEBUG
747 level = DEBUG
745 handlers =
748 handlers =
746 qualname = celery
749 qualname = celery
747
750
748
751
749 ##############
752 ##############
750 ## HANDLERS ##
753 ## HANDLERS ##
751 ##############
754 ##############
752
755
753 [handler_console]
756 [handler_console]
754 class = StreamHandler
757 class = StreamHandler
755 args = (sys.stderr, )
758 args = (sys.stderr, )
756 level = DEBUG
759 level = DEBUG
757 formatter = color_formatter
760 formatter = color_formatter
758
761
759 [handler_console_sql]
762 [handler_console_sql]
760 # "level = DEBUG" logs SQL queries and results.
763 # "level = DEBUG" logs SQL queries and results.
761 # "level = INFO" logs SQL queries.
764 # "level = INFO" logs SQL queries.
762 # "level = WARN" logs neither. (Recommended for production systems.)
765 # "level = WARN" logs neither. (Recommended for production systems.)
763 class = StreamHandler
766 class = StreamHandler
764 args = (sys.stderr, )
767 args = (sys.stderr, )
765 level = WARN
768 level = WARN
766 formatter = color_formatter_sql
769 formatter = color_formatter_sql
767
770
768 ################
771 ################
769 ## FORMATTERS ##
772 ## FORMATTERS ##
770 ################
773 ################
771
774
772 [formatter_generic]
775 [formatter_generic]
773 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
776 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
774 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
777 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
775 datefmt = %Y-%m-%d %H:%M:%S
778 datefmt = %Y-%m-%d %H:%M:%S
776
779
777 [formatter_color_formatter]
780 [formatter_color_formatter]
778 class = rhodecode.lib.logging_formatter.ColorFormatter
781 class = rhodecode.lib.logging_formatter.ColorFormatter
779 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
782 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
780 datefmt = %Y-%m-%d %H:%M:%S
783 datefmt = %Y-%m-%d %H:%M:%S
781
784
782 [formatter_color_formatter_sql]
785 [formatter_color_formatter_sql]
783 class = rhodecode.lib.logging_formatter.ColorFormatterSql
786 class = rhodecode.lib.logging_formatter.ColorFormatterSql
784 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
787 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
785 datefmt = %Y-%m-%d %H:%M:%S
788 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,762 +1,765 b''
1
1
2
2
3 ################################################################################
3 ################################################################################
4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
5 ################################################################################
5 ################################################################################
6
6
7 [DEFAULT]
7 [DEFAULT]
8 ## Debug flag sets all loggers to debug, and enables request tracking
8 ## Debug flag sets all loggers to debug, and enables request tracking
9 debug = false
9 debug = false
10
10
11 ################################################################################
11 ################################################################################
12 ## EMAIL CONFIGURATION ##
12 ## EMAIL CONFIGURATION ##
13 ## Uncomment and replace with the email address which should receive ##
13 ## Uncomment and replace with the email address which should receive ##
14 ## any error reports after an application crash ##
14 ## any error reports after an application crash ##
15 ## Additionally these settings will be used by the RhodeCode mailing system ##
15 ## Additionally these settings will be used by the RhodeCode mailing system ##
16 ################################################################################
16 ################################################################################
17
17
18 ## prefix all emails subjects with given prefix, helps filtering out emails
18 ## prefix all emails subjects with given prefix, helps filtering out emails
19 #email_prefix = [RhodeCode]
19 #email_prefix = [RhodeCode]
20
20
21 ## email FROM address all mails will be sent
21 ## email FROM address all mails will be sent
22 #app_email_from = rhodecode-noreply@localhost
22 #app_email_from = rhodecode-noreply@localhost
23
23
24 #smtp_server = mail.server.com
24 #smtp_server = mail.server.com
25 #smtp_username =
25 #smtp_username =
26 #smtp_password =
26 #smtp_password =
27 #smtp_port =
27 #smtp_port =
28 #smtp_use_tls = false
28 #smtp_use_tls = false
29 #smtp_use_ssl = true
29 #smtp_use_ssl = true
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 - Recommended for Development ####
37 ## WAITRESS WSGI SERVER - Recommended for Development ####
38 ###########################################################
38 ###########################################################
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 rhodecode.ini --paste rhodecode.ini
53 ## run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
54
54
55 use = egg:gunicorn#main
55 use = egg:gunicorn#main
56 ## Sets the number of process workers. More workers means more concurrent connections
56 ## Sets the number of process workers. More workers means more concurrent connections
57 ## RhodeCode can handle at the same time. Each additional worker also it increases
57 ## RhodeCode can handle at the same time. Each additional worker also it increases
58 ## memory usage as each has it's own set of caches.
58 ## memory usage as each has it's own set of caches.
59 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
59 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
60 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
60 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
61 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
61 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
62 ## when using more than 1 worker.
62 ## when using more than 1 worker.
63 workers = 2
63 workers = 2
64
64
65 ## Gunicorn access log level
65 ## Gunicorn access log level
66 loglevel = info
66 loglevel = info
67
67
68 ## process name visible in process list
68 ## process name visible in process list
69 proc_name = rhodecode
69 proc_name = rhodecode
70
70
71 ## type of worker class, one of sync, gevent
71 ## type of worker class, one of sync, gevent
72 ## recommended for bigger setup is using of of other than sync one
72 ## recommended for bigger setup is using of of other than sync one
73 worker_class = gevent
73 worker_class = gevent
74
74
75 ## The maximum number of simultaneous clients. Valid only for Gevent
75 ## The maximum number of simultaneous clients. Valid only for Gevent
76 worker_connections = 10
76 worker_connections = 10
77
77
78 ## max number of requests that worker will handle before being gracefully
78 ## max number of requests that worker will handle before being gracefully
79 ## restarted, could prevent memory leaks
79 ## restarted, could prevent memory leaks
80 max_requests = 1000
80 max_requests = 1000
81 max_requests_jitter = 30
81 max_requests_jitter = 30
82
82
83 ## amount of time a worker can spend with handling a request before it
83 ## amount of time a worker can spend with handling a request before it
84 ## gets killed and restarted. Set to 6hrs
84 ## gets killed and restarted. Set to 6hrs
85 timeout = 21600
85 timeout = 21600
86
86
87 ## The maximum size of HTTP request line in bytes.
87 ## The maximum size of HTTP request line in bytes.
88 ## 0 for unlimited
88 ## 0 for unlimited
89 limit_request_line = 0
89 limit_request_line = 0
90
90
91 ## Limit the number of HTTP headers fields in a request.
91 ## Limit the number of HTTP headers fields in a request.
92 ## By default this value is 100 and can't be larger than 32768.
92 ## By default this value is 100 and can't be larger than 32768.
93 limit_request_fields = 32768
93 limit_request_fields = 32768
94
94
95 ## Limit the allowed size of an HTTP request header field.
95 ## Limit the allowed size of an HTTP request header field.
96 ## Value is a positive number or 0.
96 ## Value is a positive number or 0.
97 ## Setting it to 0 will allow unlimited header field sizes.
97 ## Setting it to 0 will allow unlimited header field sizes.
98 limit_request_field_size = 0
98 limit_request_field_size = 0
99
99
100 ## Timeout for graceful workers restart.
100 ## Timeout for graceful workers restart.
101 ## After receiving a restart signal, workers have this much time to finish
101 ## After receiving a restart signal, workers have this much time to finish
102 ## serving requests. Workers still alive after the timeout (starting from the
102 ## serving requests. Workers still alive after the timeout (starting from the
103 ## receipt of the restart signal) are force killed.
103 ## receipt of the restart signal) are force killed.
104 graceful_timeout = 3600
104 graceful_timeout = 3600
105
105
106 # The number of seconds to wait for requests on a Keep-Alive connection.
106 # The number of seconds to wait for requests on a Keep-Alive connection.
107 # Generally set in the 1-5 seconds range.
107 # Generally set in the 1-5 seconds range.
108 keepalive = 2
108 keepalive = 2
109
109
110 ## Maximum memory usage that each worker can use before it will receive a
110 ## Maximum memory usage that each worker can use before it will receive a
111 ## graceful restart signal, e.g 10MB = 10485760 (10 * 1024 * 1024)
111 ## graceful restart signal, e.g 10MB = 10485760 (10 * 1024 * 1024)
112 # 0 = memory monitoring is disabled
112 # 0 = memory monitoring is disabled
113 memory_max_usage = 0
113 memory_max_usage = 0
114
114
115 ## How often in seconds to check for memory usage for each gunicorn worker
115 ## How often in seconds to check for memory usage for each gunicorn worker
116 memory_usage_check_interval = 60
116 memory_usage_check_interval = 60
117
117
118 ## Threshold value for which we don't recycle worker if GarbageCollection
118 ## Threshold value for which we don't recycle worker if GarbageCollection
119 ## frees up enough resources. Before each restart we try to run GC on worker
119 ## frees up enough resources. Before each restart we try to run GC on worker
120 ## in case we get enough free memory after that, restart will not happen.
120 ## in case we get enough free memory after that, restart will not happen.
121 memory_usage_recovery_threshold = 0.8
121 memory_usage_recovery_threshold = 0.8
122
122
123 ## prefix middleware for RhodeCode.
123 ## prefix middleware for RhodeCode.
124 ## recommended when using proxy setup.
124 ## recommended when using proxy setup.
125 ## allows to set RhodeCode under a prefix in server.
125 ## allows to set RhodeCode under a prefix in server.
126 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
126 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
127 ## And set your prefix like: `prefix = /custom_prefix`
127 ## And set your prefix like: `prefix = /custom_prefix`
128 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
128 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
129 ## to make your cookies only work on prefix url
129 ## to make your cookies only work on prefix url
130 [filter:proxy-prefix]
130 [filter:proxy-prefix]
131 use = egg:PasteDeploy#prefix
131 use = egg:PasteDeploy#prefix
132 prefix = /
132 prefix = /
133
133
134 [app:main]
134 [app:main]
135 ## The %(here)s variable will be replaced with the absolute path of parent directory
135 ## The %(here)s variable will be replaced with the absolute path of parent directory
136 ## of this file
136 ## of this file
137 ## In addition ENVIRONMENT variables usage is possible, e.g
137 ## In addition ENVIRONMENT variables usage is possible, e.g
138 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
138 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
139
139
140 use = egg:rhodecode-enterprise-ce
140 use = egg:rhodecode-enterprise-ce
141
141
142 ## enable proxy prefix middleware, defined above
142 ## enable proxy prefix middleware, defined above
143 #filter-with = proxy-prefix
143 #filter-with = proxy-prefix
144
144
145 ## encryption key used to encrypt social plugin tokens,
145 ## encryption key used to encrypt social plugin tokens,
146 ## remote_urls with credentials etc, if not set it defaults to
146 ## remote_urls with credentials etc, if not set it defaults to
147 ## `beaker.session.secret`
147 ## `beaker.session.secret`
148 #rhodecode.encrypted_values.secret =
148 #rhodecode.encrypted_values.secret =
149
149
150 ## decryption strict mode (enabled by default). It controls if decryption raises
150 ## decryption strict mode (enabled by default). It controls if decryption raises
151 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
151 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
152 #rhodecode.encrypted_values.strict = false
152 #rhodecode.encrypted_values.strict = false
153
153
154 ## Pick algorithm for encryption. Either fernet (more secure) or aes (default)
154 ## Pick algorithm for encryption. Either fernet (more secure) or aes (default)
155 ## fernet is safer, and we strongly recommend switching to it.
155 ## fernet is safer, and we strongly recommend switching to it.
156 ## Due to backward compatibility aes is used as default.
156 ## Due to backward compatibility aes is used as default.
157 #rhodecode.encrypted_values.algorithm = fernet
157 #rhodecode.encrypted_values.algorithm = fernet
158
158
159 ## return gzipped responses from RhodeCode (static files/application)
159 ## return gzipped responses from RhodeCode (static files/application)
160 gzip_responses = false
160 gzip_responses = false
161
161
162 ## auto-generate javascript routes file on startup
162 ## auto-generate javascript routes file on startup
163 generate_js_files = false
163 generate_js_files = false
164
164
165 ## System global default language.
165 ## System global default language.
166 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
166 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
167 lang = en
167 lang = en
168
168
169 ## Perform a full repository scan and import on each server start.
169 ## Perform a full repository scan and import on each server start.
170 ## Settings this to true could lead to very long startup time.
170 ## Settings this to true could lead to very long startup time.
171 startup.import_repos = false
171 startup.import_repos = false
172
172
173 ## Uncomment and set this path to use archive download cache.
173 ## Uncomment and set this path to use archive download cache.
174 ## Once enabled, generated archives will be cached at this location
174 ## Once enabled, generated archives will be cached at this location
175 ## and served from the cache during subsequent requests for the same archive of
175 ## and served from the cache during subsequent requests for the same archive of
176 ## the repository.
176 ## the repository.
177 #archive_cache_dir = /tmp/tarballcache
177 #archive_cache_dir = /tmp/tarballcache
178
178
179 ## URL at which the application is running. This is used for Bootstrapping
179 ## URL at which the application is running. This is used for Bootstrapping
180 ## requests in context when no web request is available. Used in ishell, or
180 ## requests in context when no web request is available. Used in ishell, or
181 ## SSH calls. Set this for events to receive proper url for SSH calls.
181 ## SSH calls. Set this for events to receive proper url for SSH calls.
182 app.base_url = http://rhodecode.local
182 app.base_url = http://rhodecode.local
183
183
184 ## Unique application ID. Should be a random unique string for security.
184 ## Unique application ID. Should be a random unique string for security.
185 app_instance_uuid = rc-production
185 app_instance_uuid = rc-production
186
186
187 ## Cut off limit for large diffs (size in bytes). If overall diff size on
187 ## Cut off limit for large diffs (size in bytes). If overall diff size on
188 ## commit, or pull request exceeds this limit this diff will be displayed
188 ## commit, or pull request exceeds this limit this diff will be displayed
189 ## partially. E.g 512000 == 512Kb
189 ## partially. E.g 512000 == 512Kb
190 cut_off_limit_diff = 512000
190 cut_off_limit_diff = 512000
191
191
192 ## Cut off limit for large files inside diffs (size in bytes). Each individual
192 ## Cut off limit for large files inside diffs (size in bytes). Each individual
193 ## file inside diff which exceeds this limit will be displayed partially.
193 ## file inside diff which exceeds this limit will be displayed partially.
194 ## E.g 128000 == 128Kb
194 ## E.g 128000 == 128Kb
195 cut_off_limit_file = 128000
195 cut_off_limit_file = 128000
196
196
197 ## use cached version of vcs repositories everywhere. Recommended to be `true`
197 ## use cached version of vcs repositories everywhere. Recommended to be `true`
198 vcs_full_cache = true
198 vcs_full_cache = true
199
199
200 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
200 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
201 ## Normally this is controlled by proper http flags sent from http server
201 ## Normally this is controlled by proper http flags sent from http server
202 force_https = false
202 force_https = false
203
203
204 ## use Strict-Transport-Security headers
204 ## use Strict-Transport-Security headers
205 use_htsts = false
205 use_htsts = false
206
206
207 # Set to true if your repos are exposed using the dumb protocol
207 # Set to true if your repos are exposed using the dumb protocol
208 git_update_server_info = false
208 git_update_server_info = false
209
209
210 ## RSS/ATOM feed options
210 ## RSS/ATOM feed options
211 rss_cut_off_limit = 256000
211 rss_cut_off_limit = 256000
212 rss_items_per_page = 10
212 rss_items_per_page = 10
213 rss_include_diff = false
213 rss_include_diff = false
214
214
215 ## gist URL alias, used to create nicer urls for gist. This should be an
215 ## gist URL alias, used to create nicer urls for gist. This should be an
216 ## url that does rewrites to _admin/gists/{gistid}.
216 ## url that does rewrites to _admin/gists/{gistid}.
217 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
217 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
218 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
218 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
219 gist_alias_url =
219 gist_alias_url =
220
220
221 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
221 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
222 ## used for access.
222 ## used for access.
223 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
223 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
224 ## came from the the logged in user who own this authentication token.
224 ## came from the the logged in user who own this authentication token.
225 ## Additionally @TOKEN syntax can be used to bound the view to specific
225 ## Additionally @TOKEN syntax can be used to bound the view to specific
226 ## authentication token. Such view would be only accessible when used together
226 ## authentication token. Such view would be only accessible when used together
227 ## with this authentication token
227 ## with this authentication token
228 ##
228 ##
229 ## list of all views can be found under `/_admin/permissions/auth_token_access`
229 ## list of all views can be found under `/_admin/permissions/auth_token_access`
230 ## The list should be "," separated and on a single line.
230 ## The list should be "," separated and on a single line.
231 ##
231 ##
232 ## Most common views to enable:
232 ## Most common views to enable:
233 # RepoCommitsView:repo_commit_download
233 # RepoCommitsView:repo_commit_download
234 # RepoCommitsView:repo_commit_patch
234 # RepoCommitsView:repo_commit_patch
235 # RepoCommitsView:repo_commit_raw
235 # RepoCommitsView:repo_commit_raw
236 # RepoCommitsView:repo_commit_raw@TOKEN
236 # RepoCommitsView:repo_commit_raw@TOKEN
237 # RepoFilesView:repo_files_diff
237 # RepoFilesView:repo_files_diff
238 # RepoFilesView:repo_archivefile
238 # RepoFilesView:repo_archivefile
239 # RepoFilesView:repo_file_raw
239 # RepoFilesView:repo_file_raw
240 # GistView:*
240 # GistView:*
241 api_access_controllers_whitelist =
241 api_access_controllers_whitelist =
242
242
243 ## Default encoding used to convert from and to unicode
243 ## Default encoding used to convert from and to unicode
244 ## can be also a comma separated list of encoding in case of mixed encodings
244 ## can be also a comma separated list of encoding in case of mixed encodings
245 default_encoding = UTF-8
245 default_encoding = UTF-8
246
246
247 ## instance-id prefix
247 ## instance-id prefix
248 ## a prefix key for this instance used for cache invalidation when running
248 ## a prefix key for this instance used for cache invalidation when running
249 ## multiple instances of RhodeCode, make sure it's globally unique for
249 ## multiple instances of RhodeCode, make sure it's globally unique for
250 ## all running RhodeCode instances. Leave empty if you don't use it
250 ## all running RhodeCode instances. Leave empty if you don't use it
251 instance_id =
251 instance_id =
252
252
253 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
253 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
254 ## of an authentication plugin also if it is disabled by it's settings.
254 ## of an authentication plugin also if it is disabled by it's settings.
255 ## This could be useful if you are unable to log in to the system due to broken
255 ## This could be useful if you are unable to log in to the system due to broken
256 ## authentication settings. Then you can enable e.g. the internal RhodeCode auth
256 ## authentication settings. Then you can enable e.g. the internal RhodeCode auth
257 ## module to log in again and fix the settings.
257 ## module to log in again and fix the settings.
258 ##
258 ##
259 ## Available builtin plugin IDs (hash is part of the ID):
259 ## Available builtin plugin IDs (hash is part of the ID):
260 ## egg:rhodecode-enterprise-ce#rhodecode
260 ## egg:rhodecode-enterprise-ce#rhodecode
261 ## egg:rhodecode-enterprise-ce#pam
261 ## egg:rhodecode-enterprise-ce#pam
262 ## egg:rhodecode-enterprise-ce#ldap
262 ## egg:rhodecode-enterprise-ce#ldap
263 ## egg:rhodecode-enterprise-ce#jasig_cas
263 ## egg:rhodecode-enterprise-ce#jasig_cas
264 ## egg:rhodecode-enterprise-ce#headers
264 ## egg:rhodecode-enterprise-ce#headers
265 ## egg:rhodecode-enterprise-ce#crowd
265 ## egg:rhodecode-enterprise-ce#crowd
266 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
266 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
267
267
268 ## Flag to control loading of legacy plugins in py:/path format
269 auth_plugin.import_legacy_plugins = true
270
268 ## alternative return HTTP header for failed authentication. Default HTTP
271 ## alternative return HTTP header for failed authentication. Default HTTP
269 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
272 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
270 ## handling that causing a series of failed authentication calls.
273 ## handling that causing a series of failed authentication calls.
271 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
274 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
272 ## This will be served instead of default 401 on bad authentication
275 ## This will be served instead of default 401 on bad authentication
273 auth_ret_code =
276 auth_ret_code =
274
277
275 ## use special detection method when serving auth_ret_code, instead of serving
278 ## use special detection method when serving auth_ret_code, instead of serving
276 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
279 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
277 ## and then serve auth_ret_code to clients
280 ## and then serve auth_ret_code to clients
278 auth_ret_code_detection = false
281 auth_ret_code_detection = false
279
282
280 ## locking return code. When repository is locked return this HTTP code. 2XX
283 ## locking return code. When repository is locked return this HTTP code. 2XX
281 ## codes don't break the transactions while 4XX codes do
284 ## codes don't break the transactions while 4XX codes do
282 lock_ret_code = 423
285 lock_ret_code = 423
283
286
284 ## allows to change the repository location in settings page
287 ## allows to change the repository location in settings page
285 allow_repo_location_change = true
288 allow_repo_location_change = true
286
289
287 ## allows to setup custom hooks in settings page
290 ## allows to setup custom hooks in settings page
288 allow_custom_hooks_settings = true
291 allow_custom_hooks_settings = true
289
292
290 ## Generated license token required for EE edition license.
293 ## Generated license token required for EE edition license.
291 ## New generated token value can be found in Admin > settings > license page.
294 ## New generated token value can be found in Admin > settings > license page.
292 license_token =
295 license_token =
293
296
294 ## This flag would hide sensitive information on the license page
297 ## This flag would hide sensitive information on the license page
295 license.hide_license_info = false
298 license.hide_license_info = false
296
299
297 ## supervisor connection uri, for managing supervisor and logs.
300 ## supervisor connection uri, for managing supervisor and logs.
298 supervisor.uri =
301 supervisor.uri =
299 ## supervisord group name/id we only want this RC instance to handle
302 ## supervisord group name/id we only want this RC instance to handle
300 supervisor.group_id = prod
303 supervisor.group_id = prod
301
304
302 ## Display extended labs settings
305 ## Display extended labs settings
303 labs_settings_active = true
306 labs_settings_active = true
304
307
305 ## Custom exception store path, defaults to TMPDIR
308 ## Custom exception store path, defaults to TMPDIR
306 ## This is used to store exception from RhodeCode in shared directory
309 ## This is used to store exception from RhodeCode in shared directory
307 #exception_tracker.store_path =
310 #exception_tracker.store_path =
308
311
309 ## File store configuration. This is used to store and serve uploaded files
312 ## File store configuration. This is used to store and serve uploaded files
310 file_store.enabled = true
313 file_store.enabled = true
311 ## Storage backend, available options are: local
314 ## Storage backend, available options are: local
312 file_store.backend = local
315 file_store.backend = local
313 ## path to store the uploaded binaries
316 ## path to store the uploaded binaries
314 file_store.storage_path = %(here)s/data/file_store
317 file_store.storage_path = %(here)s/data/file_store
315
318
316
319
317 ####################################
320 ####################################
318 ### CELERY CONFIG ####
321 ### CELERY CONFIG ####
319 ####################################
322 ####################################
320 ## run: /path/to/celery worker \
323 ## run: /path/to/celery worker \
321 ## -E --beat --app rhodecode.lib.celerylib.loader \
324 ## -E --beat --app rhodecode.lib.celerylib.loader \
322 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
325 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
323 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
326 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
324
327
325 use_celery = false
328 use_celery = false
326
329
327 ## connection url to the message broker (default redis)
330 ## connection url to the message broker (default redis)
328 celery.broker_url = redis://localhost:6379/8
331 celery.broker_url = redis://localhost:6379/8
329
332
330 ## rabbitmq example
333 ## rabbitmq example
331 #celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
334 #celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
332
335
333 ## maximum tasks to execute before worker restart
336 ## maximum tasks to execute before worker restart
334 celery.max_tasks_per_child = 100
337 celery.max_tasks_per_child = 100
335
338
336 ## tasks will never be sent to the queue, but executed locally instead.
339 ## tasks will never be sent to the queue, but executed locally instead.
337 celery.task_always_eager = false
340 celery.task_always_eager = false
338
341
339 #####################################
342 #####################################
340 ### DOGPILE CACHE ####
343 ### DOGPILE CACHE ####
341 #####################################
344 #####################################
342 ## Default cache dir for caches. Putting this into a ramdisk
345 ## Default cache dir for caches. Putting this into a ramdisk
343 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
346 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
344 ## large amount of space
347 ## large amount of space
345 cache_dir = %(here)s/data
348 cache_dir = %(here)s/data
346
349
347 ## `cache_perms` cache settings for permission tree, auth TTL.
350 ## `cache_perms` cache settings for permission tree, auth TTL.
348 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
351 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
349 rc_cache.cache_perms.expiration_time = 300
352 rc_cache.cache_perms.expiration_time = 300
350
353
351 ## alternative `cache_perms` redis backend with distributed lock
354 ## alternative `cache_perms` redis backend with distributed lock
352 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
355 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
353 #rc_cache.cache_perms.expiration_time = 300
356 #rc_cache.cache_perms.expiration_time = 300
354 ## redis_expiration_time needs to be greater then expiration_time
357 ## redis_expiration_time needs to be greater then expiration_time
355 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
358 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
356 #rc_cache.cache_perms.arguments.socket_timeout = 30
359 #rc_cache.cache_perms.arguments.socket_timeout = 30
357 #rc_cache.cache_perms.arguments.host = localhost
360 #rc_cache.cache_perms.arguments.host = localhost
358 #rc_cache.cache_perms.arguments.port = 6379
361 #rc_cache.cache_perms.arguments.port = 6379
359 #rc_cache.cache_perms.arguments.db = 0
362 #rc_cache.cache_perms.arguments.db = 0
360 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
363 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
361 #rc_cache.cache_perms.arguments.distributed_lock = true
364 #rc_cache.cache_perms.arguments.distributed_lock = true
362
365
363 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
366 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
364 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
367 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
365 rc_cache.cache_repo.expiration_time = 2592000
368 rc_cache.cache_repo.expiration_time = 2592000
366
369
367 ## alternative `cache_repo` redis backend with distributed lock
370 ## alternative `cache_repo` redis backend with distributed lock
368 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
371 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
369 #rc_cache.cache_repo.expiration_time = 2592000
372 #rc_cache.cache_repo.expiration_time = 2592000
370 ## redis_expiration_time needs to be greater then expiration_time
373 ## redis_expiration_time needs to be greater then expiration_time
371 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
374 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
372 #rc_cache.cache_repo.arguments.socket_timeout = 30
375 #rc_cache.cache_repo.arguments.socket_timeout = 30
373 #rc_cache.cache_repo.arguments.host = localhost
376 #rc_cache.cache_repo.arguments.host = localhost
374 #rc_cache.cache_repo.arguments.port = 6379
377 #rc_cache.cache_repo.arguments.port = 6379
375 #rc_cache.cache_repo.arguments.db = 1
378 #rc_cache.cache_repo.arguments.db = 1
376 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
379 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
377 #rc_cache.cache_repo.arguments.distributed_lock = true
380 #rc_cache.cache_repo.arguments.distributed_lock = true
378
381
379 ## cache settings for SQL queries, this needs to use memory type backend
382 ## cache settings for SQL queries, this needs to use memory type backend
380 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
383 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
381 rc_cache.sql_cache_short.expiration_time = 30
384 rc_cache.sql_cache_short.expiration_time = 30
382
385
383 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
386 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
384 ## type backend as the objects kept are not pickle serializable
387 ## type backend as the objects kept are not pickle serializable
385 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
388 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
386 ## by default we use 96H, this is using invalidation on push anyway
389 ## by default we use 96H, this is using invalidation on push anyway
387 rc_cache.cache_repo_longterm.expiration_time = 345600
390 rc_cache.cache_repo_longterm.expiration_time = 345600
388 ## max items in LRU cache, reduce this number to save memory, and expire last used
391 ## max items in LRU cache, reduce this number to save memory, and expire last used
389 ## cached objects
392 ## cached objects
390 rc_cache.cache_repo_longterm.max_size = 10000
393 rc_cache.cache_repo_longterm.max_size = 10000
391
394
392
395
393 ####################################
396 ####################################
394 ### BEAKER SESSION ####
397 ### BEAKER SESSION ####
395 ####################################
398 ####################################
396
399
397 ## .session.type is type of storage options for the session, current allowed
400 ## .session.type is type of storage options for the session, current allowed
398 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
401 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
399 beaker.session.type = file
402 beaker.session.type = file
400 beaker.session.data_dir = %(here)s/data/sessions
403 beaker.session.data_dir = %(here)s/data/sessions
401
404
402 ## redis sessions
405 ## redis sessions
403 #beaker.session.type = ext:redis
406 #beaker.session.type = ext:redis
404 #beaker.session.url = redis://127.0.0.1:6379/2
407 #beaker.session.url = redis://127.0.0.1:6379/2
405
408
406 ## db based session, fast, and allows easy management over logged in users
409 ## db based session, fast, and allows easy management over logged in users
407 #beaker.session.type = ext:database
410 #beaker.session.type = ext:database
408 #beaker.session.table_name = db_session
411 #beaker.session.table_name = db_session
409 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
412 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
410 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
413 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
411 #beaker.session.sa.pool_recycle = 3600
414 #beaker.session.sa.pool_recycle = 3600
412 #beaker.session.sa.echo = false
415 #beaker.session.sa.echo = false
413
416
414 beaker.session.key = rhodecode
417 beaker.session.key = rhodecode
415 beaker.session.secret = production-rc-uytcxaz
418 beaker.session.secret = production-rc-uytcxaz
416 beaker.session.lock_dir = %(here)s/data/sessions/lock
419 beaker.session.lock_dir = %(here)s/data/sessions/lock
417
420
418 ## Secure encrypted cookie. Requires AES and AES python libraries
421 ## Secure encrypted cookie. Requires AES and AES python libraries
419 ## you must disable beaker.session.secret to use this
422 ## you must disable beaker.session.secret to use this
420 #beaker.session.encrypt_key = key_for_encryption
423 #beaker.session.encrypt_key = key_for_encryption
421 #beaker.session.validate_key = validation_key
424 #beaker.session.validate_key = validation_key
422
425
423 ## sets session as invalid(also logging out user) if it haven not been
426 ## sets session as invalid(also logging out user) if it haven not been
424 ## accessed for given amount of time in seconds
427 ## accessed for given amount of time in seconds
425 beaker.session.timeout = 2592000
428 beaker.session.timeout = 2592000
426 beaker.session.httponly = true
429 beaker.session.httponly = true
427 ## Path to use for the cookie. Set to prefix if you use prefix middleware
430 ## Path to use for the cookie. Set to prefix if you use prefix middleware
428 #beaker.session.cookie_path = /custom_prefix
431 #beaker.session.cookie_path = /custom_prefix
429
432
430 ## uncomment for https secure cookie
433 ## uncomment for https secure cookie
431 beaker.session.secure = false
434 beaker.session.secure = false
432
435
433 ## auto save the session to not to use .save()
436 ## auto save the session to not to use .save()
434 beaker.session.auto = false
437 beaker.session.auto = false
435
438
436 ## default cookie expiration time in seconds, set to `true` to set expire
439 ## default cookie expiration time in seconds, set to `true` to set expire
437 ## at browser close
440 ## at browser close
438 #beaker.session.cookie_expires = 3600
441 #beaker.session.cookie_expires = 3600
439
442
440 ###################################
443 ###################################
441 ## SEARCH INDEXING CONFIGURATION ##
444 ## SEARCH INDEXING CONFIGURATION ##
442 ###################################
445 ###################################
443 ## Full text search indexer is available in rhodecode-tools under
446 ## Full text search indexer is available in rhodecode-tools under
444 ## `rhodecode-tools index` command
447 ## `rhodecode-tools index` command
445
448
446 ## WHOOSH Backend, doesn't require additional services to run
449 ## WHOOSH Backend, doesn't require additional services to run
447 ## it works good with few dozen repos
450 ## it works good with few dozen repos
448 search.module = rhodecode.lib.index.whoosh
451 search.module = rhodecode.lib.index.whoosh
449 search.location = %(here)s/data/index
452 search.location = %(here)s/data/index
450
453
451 ########################################
454 ########################################
452 ### CHANNELSTREAM CONFIG ####
455 ### CHANNELSTREAM CONFIG ####
453 ########################################
456 ########################################
454 ## channelstream enables persistent connections and live notification
457 ## channelstream enables persistent connections and live notification
455 ## in the system. It's also used by the chat system
458 ## in the system. It's also used by the chat system
456
459
457 channelstream.enabled = false
460 channelstream.enabled = false
458
461
459 ## server address for channelstream server on the backend
462 ## server address for channelstream server on the backend
460 channelstream.server = 127.0.0.1:9800
463 channelstream.server = 127.0.0.1:9800
461
464
462 ## location of the channelstream server from outside world
465 ## location of the channelstream server from outside world
463 ## use ws:// for http or wss:// for https. This address needs to be handled
466 ## use ws:// for http or wss:// for https. This address needs to be handled
464 ## by external HTTP server such as Nginx or Apache
467 ## by external HTTP server such as Nginx or Apache
465 ## see Nginx/Apache configuration examples in our docs
468 ## see Nginx/Apache configuration examples in our docs
466 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
469 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
467 channelstream.secret = secret
470 channelstream.secret = secret
468 channelstream.history.location = %(here)s/channelstream_history
471 channelstream.history.location = %(here)s/channelstream_history
469
472
470 ## Internal application path that Javascript uses to connect into.
473 ## Internal application path that Javascript uses to connect into.
471 ## If you use proxy-prefix the prefix should be added before /_channelstream
474 ## If you use proxy-prefix the prefix should be added before /_channelstream
472 channelstream.proxy_path = /_channelstream
475 channelstream.proxy_path = /_channelstream
473
476
474 ## Live chat for commits/pull requests. Requires CHANNELSTREAM to be enabled
477 ## Live chat for commits/pull requests. Requires CHANNELSTREAM to be enabled
475 ## and configured. (EE edition only)
478 ## and configured. (EE edition only)
476 chat.enabled = true
479 chat.enabled = true
477
480
478
481
479 ###################################
482 ###################################
480 ## APPENLIGHT CONFIG ##
483 ## APPENLIGHT CONFIG ##
481 ###################################
484 ###################################
482
485
483 ## Appenlight is tailored to work with RhodeCode, see
486 ## Appenlight is tailored to work with RhodeCode, see
484 ## http://appenlight.com for details how to obtain an account
487 ## http://appenlight.com for details how to obtain an account
485
488
486 ## Appenlight integration enabled
489 ## Appenlight integration enabled
487 appenlight = false
490 appenlight = false
488
491
489 appenlight.server_url = https://api.appenlight.com
492 appenlight.server_url = https://api.appenlight.com
490 appenlight.api_key = YOUR_API_KEY
493 appenlight.api_key = YOUR_API_KEY
491 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
494 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
492
495
493 ## used for JS client
496 ## used for JS client
494 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
497 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
495
498
496 ## TWEAK AMOUNT OF INFO SENT HERE
499 ## TWEAK AMOUNT OF INFO SENT HERE
497
500
498 ## enables 404 error logging (default False)
501 ## enables 404 error logging (default False)
499 appenlight.report_404 = false
502 appenlight.report_404 = false
500
503
501 ## time in seconds after request is considered being slow (default 1)
504 ## time in seconds after request is considered being slow (default 1)
502 appenlight.slow_request_time = 1
505 appenlight.slow_request_time = 1
503
506
504 ## record slow requests in application
507 ## record slow requests in application
505 ## (needs to be enabled for slow datastore recording and time tracking)
508 ## (needs to be enabled for slow datastore recording and time tracking)
506 appenlight.slow_requests = true
509 appenlight.slow_requests = true
507
510
508 ## enable hooking to application loggers
511 ## enable hooking to application loggers
509 appenlight.logging = true
512 appenlight.logging = true
510
513
511 ## minimum log level for log capture
514 ## minimum log level for log capture
512 appenlight.logging.level = WARNING
515 appenlight.logging.level = WARNING
513
516
514 ## send logs only from erroneous/slow requests
517 ## send logs only from erroneous/slow requests
515 ## (saves API quota for intensive logging)
518 ## (saves API quota for intensive logging)
516 appenlight.logging_on_error = false
519 appenlight.logging_on_error = false
517
520
518 ## list of additional keywords that should be grabbed from environ object
521 ## list of additional keywords that should be grabbed from environ object
519 ## can be string with comma separated list of words in lowercase
522 ## can be string with comma separated list of words in lowercase
520 ## (by default client will always send following info:
523 ## (by default client will always send following info:
521 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
524 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
522 ## start with HTTP* this list be extended with additional keywords here
525 ## start with HTTP* this list be extended with additional keywords here
523 appenlight.environ_keys_whitelist =
526 appenlight.environ_keys_whitelist =
524
527
525 ## list of keywords that should be blanked from request object
528 ## list of keywords that should be blanked from request object
526 ## can be string with comma separated list of words in lowercase
529 ## can be string with comma separated list of words in lowercase
527 ## (by default client will always blank keys that contain following words
530 ## (by default client will always blank keys that contain following words
528 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
531 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
529 ## this list be extended with additional keywords set here
532 ## this list be extended with additional keywords set here
530 appenlight.request_keys_blacklist =
533 appenlight.request_keys_blacklist =
531
534
532 ## list of namespaces that should be ignores when gathering log entries
535 ## list of namespaces that should be ignores when gathering log entries
533 ## can be string with comma separated list of namespaces
536 ## can be string with comma separated list of namespaces
534 ## (by default the client ignores own entries: appenlight_client.client)
537 ## (by default the client ignores own entries: appenlight_client.client)
535 appenlight.log_namespace_blacklist =
538 appenlight.log_namespace_blacklist =
536
539
537
540
538 ###########################################
541 ###########################################
539 ### MAIN RHODECODE DATABASE CONFIG ###
542 ### MAIN RHODECODE DATABASE CONFIG ###
540 ###########################################
543 ###########################################
541 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
544 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
542 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
545 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
543 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8
546 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8
544 # pymysql is an alternative driver for MySQL, use in case of problems with default one
547 # pymysql is an alternative driver for MySQL, use in case of problems with default one
545 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
548 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
546
549
547 sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
550 sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
548
551
549 # see sqlalchemy docs for other advanced settings
552 # see sqlalchemy docs for other advanced settings
550
553
551 ## print the sql statements to output
554 ## print the sql statements to output
552 sqlalchemy.db1.echo = false
555 sqlalchemy.db1.echo = false
553 ## recycle the connections after this amount of seconds
556 ## recycle the connections after this amount of seconds
554 sqlalchemy.db1.pool_recycle = 3600
557 sqlalchemy.db1.pool_recycle = 3600
555
558
556 ## the number of connections to keep open inside the connection pool.
559 ## the number of connections to keep open inside the connection pool.
557 ## 0 indicates no limit
560 ## 0 indicates no limit
558 #sqlalchemy.db1.pool_size = 5
561 #sqlalchemy.db1.pool_size = 5
559
562
560 ## the number of connections to allow in connection pool "overflow", that is
563 ## the number of connections to allow in connection pool "overflow", that is
561 ## connections that can be opened above and beyond the pool_size setting,
564 ## connections that can be opened above and beyond the pool_size setting,
562 ## which defaults to five.
565 ## which defaults to five.
563 #sqlalchemy.db1.max_overflow = 10
566 #sqlalchemy.db1.max_overflow = 10
564
567
565 ## Connection check ping, used to detect broken database connections
568 ## Connection check ping, used to detect broken database connections
566 ## could be enabled to better handle cases if MySQL has gone away errors
569 ## could be enabled to better handle cases if MySQL has gone away errors
567 #sqlalchemy.db1.ping_connection = true
570 #sqlalchemy.db1.ping_connection = true
568
571
569 ##################
572 ##################
570 ### VCS CONFIG ###
573 ### VCS CONFIG ###
571 ##################
574 ##################
572 vcs.server.enable = true
575 vcs.server.enable = true
573 vcs.server = localhost:9900
576 vcs.server = localhost:9900
574
577
575 ## Web server connectivity protocol, responsible for web based VCS operations
578 ## Web server connectivity protocol, responsible for web based VCS operations
576 ## Available protocols are:
579 ## Available protocols are:
577 ## `http` - use http-rpc backend (default)
580 ## `http` - use http-rpc backend (default)
578 vcs.server.protocol = http
581 vcs.server.protocol = http
579
582
580 ## Push/Pull operations protocol, available options are:
583 ## Push/Pull operations protocol, available options are:
581 ## `http` - use http-rpc backend (default)
584 ## `http` - use http-rpc backend (default)
582 vcs.scm_app_implementation = http
585 vcs.scm_app_implementation = http
583
586
584 ## Push/Pull operations hooks protocol, available options are:
587 ## Push/Pull operations hooks protocol, available options are:
585 ## `http` - use http-rpc backend (default)
588 ## `http` - use http-rpc backend (default)
586 vcs.hooks.protocol = http
589 vcs.hooks.protocol = http
587
590
588 ## Host on which this instance is listening for hooks. If vcsserver is in other location
591 ## Host on which this instance is listening for hooks. If vcsserver is in other location
589 ## this should be adjusted.
592 ## this should be adjusted.
590 vcs.hooks.host = 127.0.0.1
593 vcs.hooks.host = 127.0.0.1
591
594
592 vcs.server.log_level = info
595 vcs.server.log_level = info
593 ## Start VCSServer with this instance as a subprocess, useful for development
596 ## Start VCSServer with this instance as a subprocess, useful for development
594 vcs.start_server = false
597 vcs.start_server = false
595
598
596 ## List of enabled VCS backends, available options are:
599 ## List of enabled VCS backends, available options are:
597 ## `hg` - mercurial
600 ## `hg` - mercurial
598 ## `git` - git
601 ## `git` - git
599 ## `svn` - subversion
602 ## `svn` - subversion
600 vcs.backends = hg, git, svn
603 vcs.backends = hg, git, svn
601
604
602 vcs.connection_timeout = 3600
605 vcs.connection_timeout = 3600
603 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
606 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
604 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
607 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
605 #vcs.svn.compatible_version = pre-1.8-compatible
608 #vcs.svn.compatible_version = pre-1.8-compatible
606
609
607
610
608 ############################################################
611 ############################################################
609 ### Subversion proxy support (mod_dav_svn) ###
612 ### Subversion proxy support (mod_dav_svn) ###
610 ### Maps RhodeCode repo groups into SVN paths for Apache ###
613 ### Maps RhodeCode repo groups into SVN paths for Apache ###
611 ############################################################
614 ############################################################
612 ## Enable or disable the config file generation.
615 ## Enable or disable the config file generation.
613 svn.proxy.generate_config = false
616 svn.proxy.generate_config = false
614 ## Generate config file with `SVNListParentPath` set to `On`.
617 ## Generate config file with `SVNListParentPath` set to `On`.
615 svn.proxy.list_parent_path = true
618 svn.proxy.list_parent_path = true
616 ## Set location and file name of generated config file.
619 ## Set location and file name of generated config file.
617 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
620 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
618 ## alternative mod_dav config template. This needs to be a mako template
621 ## alternative mod_dav config template. This needs to be a mako template
619 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
622 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
620 ## Used as a prefix to the `Location` block in the generated config file.
623 ## Used as a prefix to the `Location` block in the generated config file.
621 ## In most cases it should be set to `/`.
624 ## In most cases it should be set to `/`.
622 svn.proxy.location_root = /
625 svn.proxy.location_root = /
623 ## Command to reload the mod dav svn configuration on change.
626 ## Command to reload the mod dav svn configuration on change.
624 ## Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh
627 ## Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh
625 ## Make sure user who runs RhodeCode process is allowed to reload Apache
628 ## Make sure user who runs RhodeCode process is allowed to reload Apache
626 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
629 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
627 ## If the timeout expires before the reload command finishes, the command will
630 ## If the timeout expires before the reload command finishes, the command will
628 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
631 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
629 #svn.proxy.reload_timeout = 10
632 #svn.proxy.reload_timeout = 10
630
633
631 ############################################################
634 ############################################################
632 ### SSH Support Settings ###
635 ### SSH Support Settings ###
633 ############################################################
636 ############################################################
634
637
635 ## Defines if a custom authorized_keys file should be created and written on
638 ## Defines if a custom authorized_keys file should be created and written on
636 ## any change user ssh keys. Setting this to false also disables possibility
639 ## any change user ssh keys. Setting this to false also disables possibility
637 ## of adding SSH keys by users from web interface. Super admins can still
640 ## of adding SSH keys by users from web interface. Super admins can still
638 ## manage SSH Keys.
641 ## manage SSH Keys.
639 ssh.generate_authorized_keyfile = false
642 ssh.generate_authorized_keyfile = false
640
643
641 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
644 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
642 # ssh.authorized_keys_ssh_opts =
645 # ssh.authorized_keys_ssh_opts =
643
646
644 ## Path to the authorized_keys file where the generate entries are placed.
647 ## Path to the authorized_keys file where the generate entries are placed.
645 ## It is possible to have multiple key files specified in `sshd_config` e.g.
648 ## It is possible to have multiple key files specified in `sshd_config` e.g.
646 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
649 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
647 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
650 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
648
651
649 ## Command to execute the SSH wrapper. The binary is available in the
652 ## Command to execute the SSH wrapper. The binary is available in the
650 ## RhodeCode installation directory.
653 ## RhodeCode installation directory.
651 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
654 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
652 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
655 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
653
656
654 ## Allow shell when executing the ssh-wrapper command
657 ## Allow shell when executing the ssh-wrapper command
655 ssh.wrapper_cmd_allow_shell = false
658 ssh.wrapper_cmd_allow_shell = false
656
659
657 ## Enables logging, and detailed output send back to the client during SSH
660 ## Enables logging, and detailed output send back to the client during SSH
658 ## operations. Useful for debugging, shouldn't be used in production.
661 ## operations. Useful for debugging, shouldn't be used in production.
659 ssh.enable_debug_logging = false
662 ssh.enable_debug_logging = false
660
663
661 ## Paths to binary executable, by default they are the names, but we can
664 ## Paths to binary executable, by default they are the names, but we can
662 ## override them if we want to use a custom one
665 ## override them if we want to use a custom one
663 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
666 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
664 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
667 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
665 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
668 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
666
669
667 ## Enables SSH key generator web interface. Disabling this still allows users
670 ## Enables SSH key generator web interface. Disabling this still allows users
668 ## to add their own keys.
671 ## to add their own keys.
669 ssh.enable_ui_key_generator = true
672 ssh.enable_ui_key_generator = true
670
673
671
674
672 ## Dummy marker to add new entries after.
675 ## Dummy marker to add new entries after.
673 ## Add any custom entries below. Please don't remove.
676 ## Add any custom entries below. Please don't remove.
674 custom.conf = 1
677 custom.conf = 1
675
678
676
679
677 ################################
680 ################################
678 ### LOGGING CONFIGURATION ####
681 ### LOGGING CONFIGURATION ####
679 ################################
682 ################################
680 [loggers]
683 [loggers]
681 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
684 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
682
685
683 [handlers]
686 [handlers]
684 keys = console, console_sql
687 keys = console, console_sql
685
688
686 [formatters]
689 [formatters]
687 keys = generic, color_formatter, color_formatter_sql
690 keys = generic, color_formatter, color_formatter_sql
688
691
689 #############
692 #############
690 ## LOGGERS ##
693 ## LOGGERS ##
691 #############
694 #############
692 [logger_root]
695 [logger_root]
693 level = NOTSET
696 level = NOTSET
694 handlers = console
697 handlers = console
695
698
696 [logger_sqlalchemy]
699 [logger_sqlalchemy]
697 level = INFO
700 level = INFO
698 handlers = console_sql
701 handlers = console_sql
699 qualname = sqlalchemy.engine
702 qualname = sqlalchemy.engine
700 propagate = 0
703 propagate = 0
701
704
702 [logger_beaker]
705 [logger_beaker]
703 level = DEBUG
706 level = DEBUG
704 handlers =
707 handlers =
705 qualname = beaker.container
708 qualname = beaker.container
706 propagate = 1
709 propagate = 1
707
710
708 [logger_rhodecode]
711 [logger_rhodecode]
709 level = DEBUG
712 level = DEBUG
710 handlers =
713 handlers =
711 qualname = rhodecode
714 qualname = rhodecode
712 propagate = 1
715 propagate = 1
713
716
714 [logger_ssh_wrapper]
717 [logger_ssh_wrapper]
715 level = DEBUG
718 level = DEBUG
716 handlers =
719 handlers =
717 qualname = ssh_wrapper
720 qualname = ssh_wrapper
718 propagate = 1
721 propagate = 1
719
722
720 [logger_celery]
723 [logger_celery]
721 level = DEBUG
724 level = DEBUG
722 handlers =
725 handlers =
723 qualname = celery
726 qualname = celery
724
727
725
728
726 ##############
729 ##############
727 ## HANDLERS ##
730 ## HANDLERS ##
728 ##############
731 ##############
729
732
730 [handler_console]
733 [handler_console]
731 class = StreamHandler
734 class = StreamHandler
732 args = (sys.stderr, )
735 args = (sys.stderr, )
733 level = INFO
736 level = INFO
734 formatter = generic
737 formatter = generic
735
738
736 [handler_console_sql]
739 [handler_console_sql]
737 # "level = DEBUG" logs SQL queries and results.
740 # "level = DEBUG" logs SQL queries and results.
738 # "level = INFO" logs SQL queries.
741 # "level = INFO" logs SQL queries.
739 # "level = WARN" logs neither. (Recommended for production systems.)
742 # "level = WARN" logs neither. (Recommended for production systems.)
740 class = StreamHandler
743 class = StreamHandler
741 args = (sys.stderr, )
744 args = (sys.stderr, )
742 level = WARN
745 level = WARN
743 formatter = generic
746 formatter = generic
744
747
745 ################
748 ################
746 ## FORMATTERS ##
749 ## FORMATTERS ##
747 ################
750 ################
748
751
749 [formatter_generic]
752 [formatter_generic]
750 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
753 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
751 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
754 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
752 datefmt = %Y-%m-%d %H:%M:%S
755 datefmt = %Y-%m-%d %H:%M:%S
753
756
754 [formatter_color_formatter]
757 [formatter_color_formatter]
755 class = rhodecode.lib.logging_formatter.ColorFormatter
758 class = rhodecode.lib.logging_formatter.ColorFormatter
756 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
759 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
757 datefmt = %Y-%m-%d %H:%M:%S
760 datefmt = %Y-%m-%d %H:%M:%S
758
761
759 [formatter_color_formatter_sql]
762 [formatter_color_formatter_sql]
760 class = rhodecode.lib.logging_formatter.ColorFormatterSql
763 class = rhodecode.lib.logging_formatter.ColorFormatterSql
761 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
764 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
762 datefmt = %Y-%m-%d %H:%M:%S
765 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,755 +1,756 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2010-2019 RhodeCode GmbH
3 # Copyright (C) 2010-2019 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 import os
21 import os
22 import sys
22 import sys
23 import logging
23 import logging
24 import collections
24 import collections
25 import tempfile
25 import tempfile
26 import time
26 import time
27
27
28 from paste.gzipper import make_gzip_middleware
28 from paste.gzipper import make_gzip_middleware
29 import pyramid.events
29 import pyramid.events
30 from pyramid.wsgi import wsgiapp
30 from pyramid.wsgi import wsgiapp
31 from pyramid.authorization import ACLAuthorizationPolicy
31 from pyramid.authorization import ACLAuthorizationPolicy
32 from pyramid.config import Configurator
32 from pyramid.config import Configurator
33 from pyramid.settings import asbool, aslist
33 from pyramid.settings import asbool, aslist
34 from pyramid.httpexceptions import (
34 from pyramid.httpexceptions import (
35 HTTPException, HTTPError, HTTPInternalServerError, HTTPFound, HTTPNotFound)
35 HTTPException, HTTPError, HTTPInternalServerError, HTTPFound, HTTPNotFound)
36 from pyramid.renderers import render_to_response
36 from pyramid.renderers import render_to_response
37
37
38 from rhodecode.model import meta
38 from rhodecode.model import meta
39 from rhodecode.config import patches
39 from rhodecode.config import patches
40 from rhodecode.config import utils as config_utils
40 from rhodecode.config import utils as config_utils
41 from rhodecode.config.environment import load_pyramid_environment
41 from rhodecode.config.environment import load_pyramid_environment
42
42
43 import rhodecode.events
43 import rhodecode.events
44 from rhodecode.lib.middleware.vcs import VCSMiddleware
44 from rhodecode.lib.middleware.vcs import VCSMiddleware
45 from rhodecode.lib.request import Request
45 from rhodecode.lib.request import Request
46 from rhodecode.lib.vcs import VCSCommunicationError
46 from rhodecode.lib.vcs import VCSCommunicationError
47 from rhodecode.lib.exceptions import VCSServerUnavailable
47 from rhodecode.lib.exceptions import VCSServerUnavailable
48 from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled
48 from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled
49 from rhodecode.lib.middleware.https_fixup import HttpsFixup
49 from rhodecode.lib.middleware.https_fixup import HttpsFixup
50 from rhodecode.lib.celerylib.loader import configure_celery
50 from rhodecode.lib.celerylib.loader import configure_celery
51 from rhodecode.lib.plugins.utils import register_rhodecode_plugin
51 from rhodecode.lib.plugins.utils import register_rhodecode_plugin
52 from rhodecode.lib.utils2 import aslist as rhodecode_aslist, AttributeDict
52 from rhodecode.lib.utils2 import aslist as rhodecode_aslist, AttributeDict
53 from rhodecode.lib.exc_tracking import store_exception
53 from rhodecode.lib.exc_tracking import store_exception
54 from rhodecode.subscribers import (
54 from rhodecode.subscribers import (
55 scan_repositories_if_enabled, write_js_routes_if_enabled,
55 scan_repositories_if_enabled, write_js_routes_if_enabled,
56 write_metadata_if_needed, inject_app_settings)
56 write_metadata_if_needed, inject_app_settings)
57
57
58
58
59 log = logging.getLogger(__name__)
59 log = logging.getLogger(__name__)
60
60
61
61
62 def is_http_error(response):
62 def is_http_error(response):
63 # error which should have traceback
63 # error which should have traceback
64 return response.status_code > 499
64 return response.status_code > 499
65
65
66
66
67 def should_load_all():
67 def should_load_all():
68 """
68 """
69 Returns if all application components should be loaded. In some cases it's
69 Returns if all application components should be loaded. In some cases it's
70 desired to skip apps loading for faster shell script execution
70 desired to skip apps loading for faster shell script execution
71 """
71 """
72 ssh_cmd = os.environ.get('RC_CMD_SSH_WRAPPER')
72 ssh_cmd = os.environ.get('RC_CMD_SSH_WRAPPER')
73 if ssh_cmd:
73 if ssh_cmd:
74 return False
74 return False
75
75
76 return True
76 return True
77
77
78
78
79 def make_pyramid_app(global_config, **settings):
79 def make_pyramid_app(global_config, **settings):
80 """
80 """
81 Constructs the WSGI application based on Pyramid.
81 Constructs the WSGI application based on Pyramid.
82
82
83 Specials:
83 Specials:
84
84
85 * The application can also be integrated like a plugin via the call to
85 * The application can also be integrated like a plugin via the call to
86 `includeme`. This is accompanied with the other utility functions which
86 `includeme`. This is accompanied with the other utility functions which
87 are called. Changing this should be done with great care to not break
87 are called. Changing this should be done with great care to not break
88 cases when these fragments are assembled from another place.
88 cases when these fragments are assembled from another place.
89
89
90 """
90 """
91
91
92 # Allows to use format style "{ENV_NAME}" placeholders in the configuration. It
92 # Allows to use format style "{ENV_NAME}" placeholders in the configuration. It
93 # will be replaced by the value of the environment variable "NAME" in this case.
93 # will be replaced by the value of the environment variable "NAME" in this case.
94 start_time = time.time()
94 start_time = time.time()
95
95
96 debug = asbool(global_config.get('debug'))
96 debug = asbool(global_config.get('debug'))
97 if debug:
97 if debug:
98 enable_debug()
98 enable_debug()
99
99
100 environ = {'ENV_{}'.format(key): value for key, value in os.environ.items()}
100 environ = {'ENV_{}'.format(key): value for key, value in os.environ.items()}
101
101
102 global_config = _substitute_values(global_config, environ)
102 global_config = _substitute_values(global_config, environ)
103 settings = _substitute_values(settings, environ)
103 settings = _substitute_values(settings, environ)
104
104
105 sanitize_settings_and_apply_defaults(global_config, settings)
105 sanitize_settings_and_apply_defaults(global_config, settings)
106
106
107 config = Configurator(settings=settings)
107 config = Configurator(settings=settings)
108
108
109 # Apply compatibility patches
109 # Apply compatibility patches
110 patches.inspect_getargspec()
110 patches.inspect_getargspec()
111
111
112 load_pyramid_environment(global_config, settings)
112 load_pyramid_environment(global_config, settings)
113
113
114 # Static file view comes first
114 # Static file view comes first
115 includeme_first(config)
115 includeme_first(config)
116
116
117 includeme(config)
117 includeme(config)
118
118
119 pyramid_app = config.make_wsgi_app()
119 pyramid_app = config.make_wsgi_app()
120 pyramid_app = wrap_app_in_wsgi_middlewares(pyramid_app, config)
120 pyramid_app = wrap_app_in_wsgi_middlewares(pyramid_app, config)
121 pyramid_app.config = config
121 pyramid_app.config = config
122
122
123 config.configure_celery(global_config['__file__'])
123 config.configure_celery(global_config['__file__'])
124 # creating the app uses a connection - return it after we are done
124 # creating the app uses a connection - return it after we are done
125 meta.Session.remove()
125 meta.Session.remove()
126 total_time = time.time() - start_time
126 total_time = time.time() - start_time
127 log.info('Pyramid app `%s` created and configured in %.2fs',
127 log.info('Pyramid app `%s` created and configured in %.2fs',
128 pyramid_app.func_name, total_time)
128 pyramid_app.func_name, total_time)
129
129
130 return pyramid_app
130 return pyramid_app
131
131
132
132
133 def not_found_view(request):
133 def not_found_view(request):
134 """
134 """
135 This creates the view which should be registered as not-found-view to
135 This creates the view which should be registered as not-found-view to
136 pyramid.
136 pyramid.
137 """
137 """
138
138
139 if not getattr(request, 'vcs_call', None):
139 if not getattr(request, 'vcs_call', None):
140 # handle like regular case with our error_handler
140 # handle like regular case with our error_handler
141 return error_handler(HTTPNotFound(), request)
141 return error_handler(HTTPNotFound(), request)
142
142
143 # handle not found view as a vcs call
143 # handle not found view as a vcs call
144 settings = request.registry.settings
144 settings = request.registry.settings
145 ae_client = getattr(request, 'ae_client', None)
145 ae_client = getattr(request, 'ae_client', None)
146 vcs_app = VCSMiddleware(
146 vcs_app = VCSMiddleware(
147 HTTPNotFound(), request.registry, settings,
147 HTTPNotFound(), request.registry, settings,
148 appenlight_client=ae_client)
148 appenlight_client=ae_client)
149
149
150 return wsgiapp(vcs_app)(None, request)
150 return wsgiapp(vcs_app)(None, request)
151
151
152
152
153 def error_handler(exception, request):
153 def error_handler(exception, request):
154 import rhodecode
154 import rhodecode
155 from rhodecode.lib import helpers
155 from rhodecode.lib import helpers
156
156
157 rhodecode_title = rhodecode.CONFIG.get('rhodecode_title') or 'RhodeCode'
157 rhodecode_title = rhodecode.CONFIG.get('rhodecode_title') or 'RhodeCode'
158
158
159 base_response = HTTPInternalServerError()
159 base_response = HTTPInternalServerError()
160 # prefer original exception for the response since it may have headers set
160 # prefer original exception for the response since it may have headers set
161 if isinstance(exception, HTTPException):
161 if isinstance(exception, HTTPException):
162 base_response = exception
162 base_response = exception
163 elif isinstance(exception, VCSCommunicationError):
163 elif isinstance(exception, VCSCommunicationError):
164 base_response = VCSServerUnavailable()
164 base_response = VCSServerUnavailable()
165
165
166 if is_http_error(base_response):
166 if is_http_error(base_response):
167 log.exception(
167 log.exception(
168 'error occurred handling this request for path: %s', request.path)
168 'error occurred handling this request for path: %s', request.path)
169
169
170 error_explanation = base_response.explanation or str(base_response)
170 error_explanation = base_response.explanation or str(base_response)
171 if base_response.status_code == 404:
171 if base_response.status_code == 404:
172 error_explanation += " Optionally you don't have permission to access this page."
172 error_explanation += " Optionally you don't have permission to access this page."
173 c = AttributeDict()
173 c = AttributeDict()
174 c.error_message = base_response.status
174 c.error_message = base_response.status
175 c.error_explanation = error_explanation
175 c.error_explanation = error_explanation
176 c.visual = AttributeDict()
176 c.visual = AttributeDict()
177
177
178 c.visual.rhodecode_support_url = (
178 c.visual.rhodecode_support_url = (
179 request.registry.settings.get('rhodecode_support_url') or
179 request.registry.settings.get('rhodecode_support_url') or
180 request.route_url('rhodecode_support')
180 request.route_url('rhodecode_support')
181 )
181 )
182 c.redirect_time = 0
182 c.redirect_time = 0
183 c.rhodecode_name = rhodecode_title
183 c.rhodecode_name = rhodecode_title
184 if not c.rhodecode_name:
184 if not c.rhodecode_name:
185 c.rhodecode_name = 'Rhodecode'
185 c.rhodecode_name = 'Rhodecode'
186
186
187 c.causes = []
187 c.causes = []
188 if is_http_error(base_response):
188 if is_http_error(base_response):
189 c.causes.append('Server is overloaded.')
189 c.causes.append('Server is overloaded.')
190 c.causes.append('Server database connection is lost.')
190 c.causes.append('Server database connection is lost.')
191 c.causes.append('Server expected unhandled error.')
191 c.causes.append('Server expected unhandled error.')
192
192
193 if hasattr(base_response, 'causes'):
193 if hasattr(base_response, 'causes'):
194 c.causes = base_response.causes
194 c.causes = base_response.causes
195
195
196 c.messages = helpers.flash.pop_messages(request=request)
196 c.messages = helpers.flash.pop_messages(request=request)
197
197
198 exc_info = sys.exc_info()
198 exc_info = sys.exc_info()
199 c.exception_id = id(exc_info)
199 c.exception_id = id(exc_info)
200 c.show_exception_id = isinstance(base_response, VCSServerUnavailable) \
200 c.show_exception_id = isinstance(base_response, VCSServerUnavailable) \
201 or base_response.status_code > 499
201 or base_response.status_code > 499
202 c.exception_id_url = request.route_url(
202 c.exception_id_url = request.route_url(
203 'admin_settings_exception_tracker_show', exception_id=c.exception_id)
203 'admin_settings_exception_tracker_show', exception_id=c.exception_id)
204
204
205 if c.show_exception_id:
205 if c.show_exception_id:
206 store_exception(c.exception_id, exc_info)
206 store_exception(c.exception_id, exc_info)
207
207
208 response = render_to_response(
208 response = render_to_response(
209 '/errors/error_document.mako', {'c': c, 'h': helpers}, request=request,
209 '/errors/error_document.mako', {'c': c, 'h': helpers}, request=request,
210 response=base_response)
210 response=base_response)
211
211
212 return response
212 return response
213
213
214
214
215 def includeme_first(config):
215 def includeme_first(config):
216 # redirect automatic browser favicon.ico requests to correct place
216 # redirect automatic browser favicon.ico requests to correct place
217 def favicon_redirect(context, request):
217 def favicon_redirect(context, request):
218 return HTTPFound(
218 return HTTPFound(
219 request.static_path('rhodecode:public/images/favicon.ico'))
219 request.static_path('rhodecode:public/images/favicon.ico'))
220
220
221 config.add_view(favicon_redirect, route_name='favicon')
221 config.add_view(favicon_redirect, route_name='favicon')
222 config.add_route('favicon', '/favicon.ico')
222 config.add_route('favicon', '/favicon.ico')
223
223
224 def robots_redirect(context, request):
224 def robots_redirect(context, request):
225 return HTTPFound(
225 return HTTPFound(
226 request.static_path('rhodecode:public/robots.txt'))
226 request.static_path('rhodecode:public/robots.txt'))
227
227
228 config.add_view(robots_redirect, route_name='robots')
228 config.add_view(robots_redirect, route_name='robots')
229 config.add_route('robots', '/robots.txt')
229 config.add_route('robots', '/robots.txt')
230
230
231 config.add_static_view(
231 config.add_static_view(
232 '_static/deform', 'deform:static')
232 '_static/deform', 'deform:static')
233 config.add_static_view(
233 config.add_static_view(
234 '_static/rhodecode', path='rhodecode:public', cache_max_age=3600 * 24)
234 '_static/rhodecode', path='rhodecode:public', cache_max_age=3600 * 24)
235
235
236
236
237 def includeme(config):
237 def includeme(config):
238 log.debug('Initializing main includeme from %s', os.path.basename(__file__))
238 log.debug('Initializing main includeme from %s', os.path.basename(__file__))
239 settings = config.registry.settings
239 settings = config.registry.settings
240 config.set_request_factory(Request)
240 config.set_request_factory(Request)
241
241
242 # plugin information
242 # plugin information
243 config.registry.rhodecode_plugins = collections.OrderedDict()
243 config.registry.rhodecode_plugins = collections.OrderedDict()
244
244
245 config.add_directive(
245 config.add_directive(
246 'register_rhodecode_plugin', register_rhodecode_plugin)
246 'register_rhodecode_plugin', register_rhodecode_plugin)
247
247
248 config.add_directive('configure_celery', configure_celery)
248 config.add_directive('configure_celery', configure_celery)
249
249
250 if asbool(settings.get('appenlight', 'false')):
250 if asbool(settings.get('appenlight', 'false')):
251 config.include('appenlight_client.ext.pyramid_tween')
251 config.include('appenlight_client.ext.pyramid_tween')
252
252
253 load_all = should_load_all()
253 load_all = should_load_all()
254
254
255 # Includes which are required. The application would fail without them.
255 # Includes which are required. The application would fail without them.
256 config.include('pyramid_mako')
256 config.include('pyramid_mako')
257 config.include('rhodecode.lib.rc_beaker')
257 config.include('rhodecode.lib.rc_beaker')
258 config.include('rhodecode.lib.rc_cache')
258 config.include('rhodecode.lib.rc_cache')
259
259
260 config.include('rhodecode.apps._base.navigation')
260 config.include('rhodecode.apps._base.navigation')
261 config.include('rhodecode.apps._base.subscribers')
261 config.include('rhodecode.apps._base.subscribers')
262 config.include('rhodecode.tweens')
262 config.include('rhodecode.tweens')
263 config.include('rhodecode.authentication')
263 config.include('rhodecode.authentication')
264
264
265 if load_all:
265 if load_all:
266 config.include('rhodecode.integrations')
266 config.include('rhodecode.integrations')
267
267
268 if load_all:
268 if load_all:
269 from rhodecode.authentication import discover_legacy_plugins
270 # load CE authentication plugins
269 # load CE authentication plugins
271 config.include('rhodecode.authentication.plugins.auth_crowd')
270 config.include('rhodecode.authentication.plugins.auth_crowd')
272 config.include('rhodecode.authentication.plugins.auth_headers')
271 config.include('rhodecode.authentication.plugins.auth_headers')
273 config.include('rhodecode.authentication.plugins.auth_jasig_cas')
272 config.include('rhodecode.authentication.plugins.auth_jasig_cas')
274 config.include('rhodecode.authentication.plugins.auth_ldap')
273 config.include('rhodecode.authentication.plugins.auth_ldap')
275 config.include('rhodecode.authentication.plugins.auth_pam')
274 config.include('rhodecode.authentication.plugins.auth_pam')
276 config.include('rhodecode.authentication.plugins.auth_rhodecode')
275 config.include('rhodecode.authentication.plugins.auth_rhodecode')
277 config.include('rhodecode.authentication.plugins.auth_token')
276 config.include('rhodecode.authentication.plugins.auth_token')
278
277
279 # Auto discover authentication plugins and include their configuration.
278 # Auto discover authentication plugins and include their configuration.
280 discover_legacy_plugins(config)
279 if asbool(settings.get('auth_plugin.import_legacy_plugins', 'true')):
280 from rhodecode.authentication import discover_legacy_plugins
281 discover_legacy_plugins(config)
281
282
282 # apps
283 # apps
283 if load_all:
284 if load_all:
284 config.include('rhodecode.apps._base')
285 config.include('rhodecode.apps._base')
285 config.include('rhodecode.apps.hovercards')
286 config.include('rhodecode.apps.hovercards')
286 config.include('rhodecode.apps.ops')
287 config.include('rhodecode.apps.ops')
287 config.include('rhodecode.apps.admin')
288 config.include('rhodecode.apps.admin')
288 config.include('rhodecode.apps.channelstream')
289 config.include('rhodecode.apps.channelstream')
289 config.include('rhodecode.apps.file_store')
290 config.include('rhodecode.apps.file_store')
290 config.include('rhodecode.apps.login')
291 config.include('rhodecode.apps.login')
291 config.include('rhodecode.apps.home')
292 config.include('rhodecode.apps.home')
292 config.include('rhodecode.apps.journal')
293 config.include('rhodecode.apps.journal')
293 config.include('rhodecode.apps.repository')
294 config.include('rhodecode.apps.repository')
294 config.include('rhodecode.apps.repo_group')
295 config.include('rhodecode.apps.repo_group')
295 config.include('rhodecode.apps.user_group')
296 config.include('rhodecode.apps.user_group')
296 config.include('rhodecode.apps.search')
297 config.include('rhodecode.apps.search')
297 config.include('rhodecode.apps.user_profile')
298 config.include('rhodecode.apps.user_profile')
298 config.include('rhodecode.apps.user_group_profile')
299 config.include('rhodecode.apps.user_group_profile')
299 config.include('rhodecode.apps.my_account')
300 config.include('rhodecode.apps.my_account')
300 config.include('rhodecode.apps.svn_support')
301 config.include('rhodecode.apps.svn_support')
301 config.include('rhodecode.apps.ssh_support')
302 config.include('rhodecode.apps.ssh_support')
302 config.include('rhodecode.apps.gist')
303 config.include('rhodecode.apps.gist')
303 config.include('rhodecode.apps.debug_style')
304 config.include('rhodecode.apps.debug_style')
304 config.include('rhodecode.api')
305 config.include('rhodecode.api')
305
306
306 config.add_route('rhodecode_support', 'https://rhodecode.com/help/', static=True)
307 config.add_route('rhodecode_support', 'https://rhodecode.com/help/', static=True)
307 config.add_translation_dirs('rhodecode:i18n/')
308 config.add_translation_dirs('rhodecode:i18n/')
308 settings['default_locale_name'] = settings.get('lang', 'en')
309 settings['default_locale_name'] = settings.get('lang', 'en')
309
310
310 # Add subscribers.
311 # Add subscribers.
311 if load_all:
312 if load_all:
312 config.add_subscriber(inject_app_settings,
313 config.add_subscriber(inject_app_settings,
313 pyramid.events.ApplicationCreated)
314 pyramid.events.ApplicationCreated)
314 config.add_subscriber(scan_repositories_if_enabled,
315 config.add_subscriber(scan_repositories_if_enabled,
315 pyramid.events.ApplicationCreated)
316 pyramid.events.ApplicationCreated)
316 config.add_subscriber(write_metadata_if_needed,
317 config.add_subscriber(write_metadata_if_needed,
317 pyramid.events.ApplicationCreated)
318 pyramid.events.ApplicationCreated)
318 config.add_subscriber(write_js_routes_if_enabled,
319 config.add_subscriber(write_js_routes_if_enabled,
319 pyramid.events.ApplicationCreated)
320 pyramid.events.ApplicationCreated)
320
321
321 # request custom methods
322 # request custom methods
322 config.add_request_method(
323 config.add_request_method(
323 'rhodecode.lib.partial_renderer.get_partial_renderer',
324 'rhodecode.lib.partial_renderer.get_partial_renderer',
324 'get_partial_renderer')
325 'get_partial_renderer')
325
326
326 config.add_request_method(
327 config.add_request_method(
327 'rhodecode.lib.request_counter.get_request_counter',
328 'rhodecode.lib.request_counter.get_request_counter',
328 'request_count')
329 'request_count')
329
330
330 # Set the authorization policy.
331 # Set the authorization policy.
331 authz_policy = ACLAuthorizationPolicy()
332 authz_policy = ACLAuthorizationPolicy()
332 config.set_authorization_policy(authz_policy)
333 config.set_authorization_policy(authz_policy)
333
334
334 # Set the default renderer for HTML templates to mako.
335 # Set the default renderer for HTML templates to mako.
335 config.add_mako_renderer('.html')
336 config.add_mako_renderer('.html')
336
337
337 config.add_renderer(
338 config.add_renderer(
338 name='json_ext',
339 name='json_ext',
339 factory='rhodecode.lib.ext_json_renderer.pyramid_ext_json')
340 factory='rhodecode.lib.ext_json_renderer.pyramid_ext_json')
340
341
341 # include RhodeCode plugins
342 # include RhodeCode plugins
342 includes = aslist(settings.get('rhodecode.includes', []))
343 includes = aslist(settings.get('rhodecode.includes', []))
343 for inc in includes:
344 for inc in includes:
344 config.include(inc)
345 config.include(inc)
345
346
346 # custom not found view, if our pyramid app doesn't know how to handle
347 # custom not found view, if our pyramid app doesn't know how to handle
347 # the request pass it to potential VCS handling ap
348 # the request pass it to potential VCS handling ap
348 config.add_notfound_view(not_found_view)
349 config.add_notfound_view(not_found_view)
349 if not settings.get('debugtoolbar.enabled', False):
350 if not settings.get('debugtoolbar.enabled', False):
350 # disabled debugtoolbar handle all exceptions via the error_handlers
351 # disabled debugtoolbar handle all exceptions via the error_handlers
351 config.add_view(error_handler, context=Exception)
352 config.add_view(error_handler, context=Exception)
352
353
353 # all errors including 403/404/50X
354 # all errors including 403/404/50X
354 config.add_view(error_handler, context=HTTPError)
355 config.add_view(error_handler, context=HTTPError)
355
356
356
357
357 def wrap_app_in_wsgi_middlewares(pyramid_app, config):
358 def wrap_app_in_wsgi_middlewares(pyramid_app, config):
358 """
359 """
359 Apply outer WSGI middlewares around the application.
360 Apply outer WSGI middlewares around the application.
360 """
361 """
361 registry = config.registry
362 registry = config.registry
362 settings = registry.settings
363 settings = registry.settings
363
364
364 # enable https redirects based on HTTP_X_URL_SCHEME set by proxy
365 # enable https redirects based on HTTP_X_URL_SCHEME set by proxy
365 pyramid_app = HttpsFixup(pyramid_app, settings)
366 pyramid_app = HttpsFixup(pyramid_app, settings)
366
367
367 pyramid_app, _ae_client = wrap_in_appenlight_if_enabled(
368 pyramid_app, _ae_client = wrap_in_appenlight_if_enabled(
368 pyramid_app, settings)
369 pyramid_app, settings)
369 registry.ae_client = _ae_client
370 registry.ae_client = _ae_client
370
371
371 if settings['gzip_responses']:
372 if settings['gzip_responses']:
372 pyramid_app = make_gzip_middleware(
373 pyramid_app = make_gzip_middleware(
373 pyramid_app, settings, compress_level=1)
374 pyramid_app, settings, compress_level=1)
374
375
375 # this should be the outer most middleware in the wsgi stack since
376 # this should be the outer most middleware in the wsgi stack since
376 # middleware like Routes make database calls
377 # middleware like Routes make database calls
377 def pyramid_app_with_cleanup(environ, start_response):
378 def pyramid_app_with_cleanup(environ, start_response):
378 try:
379 try:
379 return pyramid_app(environ, start_response)
380 return pyramid_app(environ, start_response)
380 finally:
381 finally:
381 # Dispose current database session and rollback uncommitted
382 # Dispose current database session and rollback uncommitted
382 # transactions.
383 # transactions.
383 meta.Session.remove()
384 meta.Session.remove()
384
385
385 # In a single threaded mode server, on non sqlite db we should have
386 # In a single threaded mode server, on non sqlite db we should have
386 # '0 Current Checked out connections' at the end of a request,
387 # '0 Current Checked out connections' at the end of a request,
387 # if not, then something, somewhere is leaving a connection open
388 # if not, then something, somewhere is leaving a connection open
388 pool = meta.Base.metadata.bind.engine.pool
389 pool = meta.Base.metadata.bind.engine.pool
389 log.debug('sa pool status: %s', pool.status())
390 log.debug('sa pool status: %s', pool.status())
390 log.debug('Request processing finalized')
391 log.debug('Request processing finalized')
391
392
392 return pyramid_app_with_cleanup
393 return pyramid_app_with_cleanup
393
394
394
395
395 def sanitize_settings_and_apply_defaults(global_config, settings):
396 def sanitize_settings_and_apply_defaults(global_config, settings):
396 """
397 """
397 Applies settings defaults and does all type conversion.
398 Applies settings defaults and does all type conversion.
398
399
399 We would move all settings parsing and preparation into this place, so that
400 We would move all settings parsing and preparation into this place, so that
400 we have only one place left which deals with this part. The remaining parts
401 we have only one place left which deals with this part. The remaining parts
401 of the application would start to rely fully on well prepared settings.
402 of the application would start to rely fully on well prepared settings.
402
403
403 This piece would later be split up per topic to avoid a big fat monster
404 This piece would later be split up per topic to avoid a big fat monster
404 function.
405 function.
405 """
406 """
406
407
407 settings.setdefault('rhodecode.edition', 'Community Edition')
408 settings.setdefault('rhodecode.edition', 'Community Edition')
408
409
409 if 'mako.default_filters' not in settings:
410 if 'mako.default_filters' not in settings:
410 # set custom default filters if we don't have it defined
411 # set custom default filters if we don't have it defined
411 settings['mako.imports'] = 'from rhodecode.lib.base import h_filter'
412 settings['mako.imports'] = 'from rhodecode.lib.base import h_filter'
412 settings['mako.default_filters'] = 'h_filter'
413 settings['mako.default_filters'] = 'h_filter'
413
414
414 if 'mako.directories' not in settings:
415 if 'mako.directories' not in settings:
415 mako_directories = settings.setdefault('mako.directories', [
416 mako_directories = settings.setdefault('mako.directories', [
416 # Base templates of the original application
417 # Base templates of the original application
417 'rhodecode:templates',
418 'rhodecode:templates',
418 ])
419 ])
419 log.debug(
420 log.debug(
420 "Using the following Mako template directories: %s",
421 "Using the following Mako template directories: %s",
421 mako_directories)
422 mako_directories)
422
423
423 # NOTE(marcink): fix redis requirement for schema of connection since 3.X
424 # NOTE(marcink): fix redis requirement for schema of connection since 3.X
424 if 'beaker.session.type' in settings and settings['beaker.session.type'] == 'ext:redis':
425 if 'beaker.session.type' in settings and settings['beaker.session.type'] == 'ext:redis':
425 raw_url = settings['beaker.session.url']
426 raw_url = settings['beaker.session.url']
426 if not raw_url.startswith(('redis://', 'rediss://', 'unix://')):
427 if not raw_url.startswith(('redis://', 'rediss://', 'unix://')):
427 settings['beaker.session.url'] = 'redis://' + raw_url
428 settings['beaker.session.url'] = 'redis://' + raw_url
428
429
429 # Default includes, possible to change as a user
430 # Default includes, possible to change as a user
430 pyramid_includes = settings.setdefault('pyramid.includes', [
431 pyramid_includes = settings.setdefault('pyramid.includes', [
431 'rhodecode.lib.middleware.request_wrapper',
432 'rhodecode.lib.middleware.request_wrapper',
432 ])
433 ])
433 log.debug(
434 log.debug(
434 "Using the following pyramid.includes: %s",
435 "Using the following pyramid.includes: %s",
435 pyramid_includes)
436 pyramid_includes)
436
437
437 # TODO: johbo: Re-think this, usually the call to config.include
438 # TODO: johbo: Re-think this, usually the call to config.include
438 # should allow to pass in a prefix.
439 # should allow to pass in a prefix.
439 settings.setdefault('rhodecode.api.url', '/_admin/api')
440 settings.setdefault('rhodecode.api.url', '/_admin/api')
440 settings.setdefault('__file__', global_config.get('__file__'))
441 settings.setdefault('__file__', global_config.get('__file__'))
441
442
442 # Sanitize generic settings.
443 # Sanitize generic settings.
443 _list_setting(settings, 'default_encoding', 'UTF-8')
444 _list_setting(settings, 'default_encoding', 'UTF-8')
444 _bool_setting(settings, 'is_test', 'false')
445 _bool_setting(settings, 'is_test', 'false')
445 _bool_setting(settings, 'gzip_responses', 'false')
446 _bool_setting(settings, 'gzip_responses', 'false')
446
447
447 # Call split out functions that sanitize settings for each topic.
448 # Call split out functions that sanitize settings for each topic.
448 _sanitize_appenlight_settings(settings)
449 _sanitize_appenlight_settings(settings)
449 _sanitize_vcs_settings(settings)
450 _sanitize_vcs_settings(settings)
450 _sanitize_cache_settings(settings)
451 _sanitize_cache_settings(settings)
451
452
452 # configure instance id
453 # configure instance id
453 config_utils.set_instance_id(settings)
454 config_utils.set_instance_id(settings)
454
455
455 return settings
456 return settings
456
457
457
458
458 def enable_debug():
459 def enable_debug():
459 """
460 """
460 Helper to enable debug on running instance
461 Helper to enable debug on running instance
461 :return:
462 :return:
462 """
463 """
463 import tempfile
464 import tempfile
464 import textwrap
465 import textwrap
465 import logging.config
466 import logging.config
466
467
467 ini_template = textwrap.dedent("""
468 ini_template = textwrap.dedent("""
468 #####################################
469 #####################################
469 ### DEBUG LOGGING CONFIGURATION ####
470 ### DEBUG LOGGING CONFIGURATION ####
470 #####################################
471 #####################################
471 [loggers]
472 [loggers]
472 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
473 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
473
474
474 [handlers]
475 [handlers]
475 keys = console, console_sql
476 keys = console, console_sql
476
477
477 [formatters]
478 [formatters]
478 keys = generic, color_formatter, color_formatter_sql
479 keys = generic, color_formatter, color_formatter_sql
479
480
480 #############
481 #############
481 ## LOGGERS ##
482 ## LOGGERS ##
482 #############
483 #############
483 [logger_root]
484 [logger_root]
484 level = NOTSET
485 level = NOTSET
485 handlers = console
486 handlers = console
486
487
487 [logger_sqlalchemy]
488 [logger_sqlalchemy]
488 level = INFO
489 level = INFO
489 handlers = console_sql
490 handlers = console_sql
490 qualname = sqlalchemy.engine
491 qualname = sqlalchemy.engine
491 propagate = 0
492 propagate = 0
492
493
493 [logger_beaker]
494 [logger_beaker]
494 level = DEBUG
495 level = DEBUG
495 handlers =
496 handlers =
496 qualname = beaker.container
497 qualname = beaker.container
497 propagate = 1
498 propagate = 1
498
499
499 [logger_rhodecode]
500 [logger_rhodecode]
500 level = DEBUG
501 level = DEBUG
501 handlers =
502 handlers =
502 qualname = rhodecode
503 qualname = rhodecode
503 propagate = 1
504 propagate = 1
504
505
505 [logger_ssh_wrapper]
506 [logger_ssh_wrapper]
506 level = DEBUG
507 level = DEBUG
507 handlers =
508 handlers =
508 qualname = ssh_wrapper
509 qualname = ssh_wrapper
509 propagate = 1
510 propagate = 1
510
511
511 [logger_celery]
512 [logger_celery]
512 level = DEBUG
513 level = DEBUG
513 handlers =
514 handlers =
514 qualname = celery
515 qualname = celery
515
516
516
517
517 ##############
518 ##############
518 ## HANDLERS ##
519 ## HANDLERS ##
519 ##############
520 ##############
520
521
521 [handler_console]
522 [handler_console]
522 class = StreamHandler
523 class = StreamHandler
523 args = (sys.stderr, )
524 args = (sys.stderr, )
524 level = DEBUG
525 level = DEBUG
525 formatter = color_formatter
526 formatter = color_formatter
526
527
527 [handler_console_sql]
528 [handler_console_sql]
528 # "level = DEBUG" logs SQL queries and results.
529 # "level = DEBUG" logs SQL queries and results.
529 # "level = INFO" logs SQL queries.
530 # "level = INFO" logs SQL queries.
530 # "level = WARN" logs neither. (Recommended for production systems.)
531 # "level = WARN" logs neither. (Recommended for production systems.)
531 class = StreamHandler
532 class = StreamHandler
532 args = (sys.stderr, )
533 args = (sys.stderr, )
533 level = WARN
534 level = WARN
534 formatter = color_formatter_sql
535 formatter = color_formatter_sql
535
536
536 ################
537 ################
537 ## FORMATTERS ##
538 ## FORMATTERS ##
538 ################
539 ################
539
540
540 [formatter_generic]
541 [formatter_generic]
541 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
542 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
542 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s | %(req_id)s
543 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s | %(req_id)s
543 datefmt = %Y-%m-%d %H:%M:%S
544 datefmt = %Y-%m-%d %H:%M:%S
544
545
545 [formatter_color_formatter]
546 [formatter_color_formatter]
546 class = rhodecode.lib.logging_formatter.ColorRequestTrackingFormatter
547 class = rhodecode.lib.logging_formatter.ColorRequestTrackingFormatter
547 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s | %(req_id)s
548 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s | %(req_id)s
548 datefmt = %Y-%m-%d %H:%M:%S
549 datefmt = %Y-%m-%d %H:%M:%S
549
550
550 [formatter_color_formatter_sql]
551 [formatter_color_formatter_sql]
551 class = rhodecode.lib.logging_formatter.ColorFormatterSql
552 class = rhodecode.lib.logging_formatter.ColorFormatterSql
552 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
553 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
553 datefmt = %Y-%m-%d %H:%M:%S
554 datefmt = %Y-%m-%d %H:%M:%S
554 """)
555 """)
555
556
556 with tempfile.NamedTemporaryFile(prefix='rc_debug_logging_', suffix='.ini',
557 with tempfile.NamedTemporaryFile(prefix='rc_debug_logging_', suffix='.ini',
557 delete=False) as f:
558 delete=False) as f:
558 log.info('Saved Temporary DEBUG config at %s', f.name)
559 log.info('Saved Temporary DEBUG config at %s', f.name)
559 f.write(ini_template)
560 f.write(ini_template)
560
561
561 logging.config.fileConfig(f.name)
562 logging.config.fileConfig(f.name)
562 log.debug('DEBUG MODE ON')
563 log.debug('DEBUG MODE ON')
563 os.remove(f.name)
564 os.remove(f.name)
564
565
565
566
566 def _sanitize_appenlight_settings(settings):
567 def _sanitize_appenlight_settings(settings):
567 _bool_setting(settings, 'appenlight', 'false')
568 _bool_setting(settings, 'appenlight', 'false')
568
569
569
570
570 def _sanitize_vcs_settings(settings):
571 def _sanitize_vcs_settings(settings):
571 """
572 """
572 Applies settings defaults and does type conversion for all VCS related
573 Applies settings defaults and does type conversion for all VCS related
573 settings.
574 settings.
574 """
575 """
575 _string_setting(settings, 'vcs.svn.compatible_version', '')
576 _string_setting(settings, 'vcs.svn.compatible_version', '')
576 _string_setting(settings, 'vcs.hooks.protocol', 'http')
577 _string_setting(settings, 'vcs.hooks.protocol', 'http')
577 _string_setting(settings, 'vcs.hooks.host', '127.0.0.1')
578 _string_setting(settings, 'vcs.hooks.host', '127.0.0.1')
578 _string_setting(settings, 'vcs.scm_app_implementation', 'http')
579 _string_setting(settings, 'vcs.scm_app_implementation', 'http')
579 _string_setting(settings, 'vcs.server', '')
580 _string_setting(settings, 'vcs.server', '')
580 _string_setting(settings, 'vcs.server.log_level', 'debug')
581 _string_setting(settings, 'vcs.server.log_level', 'debug')
581 _string_setting(settings, 'vcs.server.protocol', 'http')
582 _string_setting(settings, 'vcs.server.protocol', 'http')
582 _bool_setting(settings, 'startup.import_repos', 'false')
583 _bool_setting(settings, 'startup.import_repos', 'false')
583 _bool_setting(settings, 'vcs.hooks.direct_calls', 'false')
584 _bool_setting(settings, 'vcs.hooks.direct_calls', 'false')
584 _bool_setting(settings, 'vcs.server.enable', 'true')
585 _bool_setting(settings, 'vcs.server.enable', 'true')
585 _bool_setting(settings, 'vcs.start_server', 'false')
586 _bool_setting(settings, 'vcs.start_server', 'false')
586 _list_setting(settings, 'vcs.backends', 'hg, git, svn')
587 _list_setting(settings, 'vcs.backends', 'hg, git, svn')
587 _int_setting(settings, 'vcs.connection_timeout', 3600)
588 _int_setting(settings, 'vcs.connection_timeout', 3600)
588
589
589 # Support legacy values of vcs.scm_app_implementation. Legacy
590 # Support legacy values of vcs.scm_app_implementation. Legacy
590 # configurations may use 'rhodecode.lib.middleware.utils.scm_app_http', or
591 # configurations may use 'rhodecode.lib.middleware.utils.scm_app_http', or
591 # disabled since 4.13 'vcsserver.scm_app' which is now mapped to 'http'.
592 # disabled since 4.13 'vcsserver.scm_app' which is now mapped to 'http'.
592 scm_app_impl = settings['vcs.scm_app_implementation']
593 scm_app_impl = settings['vcs.scm_app_implementation']
593 if scm_app_impl in ['rhodecode.lib.middleware.utils.scm_app_http', 'vcsserver.scm_app']:
594 if scm_app_impl in ['rhodecode.lib.middleware.utils.scm_app_http', 'vcsserver.scm_app']:
594 settings['vcs.scm_app_implementation'] = 'http'
595 settings['vcs.scm_app_implementation'] = 'http'
595
596
596
597
597 def _sanitize_cache_settings(settings):
598 def _sanitize_cache_settings(settings):
598 temp_store = tempfile.gettempdir()
599 temp_store = tempfile.gettempdir()
599 default_cache_dir = os.path.join(temp_store, 'rc_cache')
600 default_cache_dir = os.path.join(temp_store, 'rc_cache')
600
601
601 # save default, cache dir, and use it for all backends later.
602 # save default, cache dir, and use it for all backends later.
602 default_cache_dir = _string_setting(
603 default_cache_dir = _string_setting(
603 settings,
604 settings,
604 'cache_dir',
605 'cache_dir',
605 default_cache_dir, lower=False, default_when_empty=True)
606 default_cache_dir, lower=False, default_when_empty=True)
606
607
607 # ensure we have our dir created
608 # ensure we have our dir created
608 if not os.path.isdir(default_cache_dir):
609 if not os.path.isdir(default_cache_dir):
609 os.makedirs(default_cache_dir, mode=0o755)
610 os.makedirs(default_cache_dir, mode=0o755)
610
611
611 # exception store cache
612 # exception store cache
612 _string_setting(
613 _string_setting(
613 settings,
614 settings,
614 'exception_tracker.store_path',
615 'exception_tracker.store_path',
615 temp_store, lower=False, default_when_empty=True)
616 temp_store, lower=False, default_when_empty=True)
616
617
617 # cache_perms
618 # cache_perms
618 _string_setting(
619 _string_setting(
619 settings,
620 settings,
620 'rc_cache.cache_perms.backend',
621 'rc_cache.cache_perms.backend',
621 'dogpile.cache.rc.file_namespace', lower=False)
622 'dogpile.cache.rc.file_namespace', lower=False)
622 _int_setting(
623 _int_setting(
623 settings,
624 settings,
624 'rc_cache.cache_perms.expiration_time',
625 'rc_cache.cache_perms.expiration_time',
625 60)
626 60)
626 _string_setting(
627 _string_setting(
627 settings,
628 settings,
628 'rc_cache.cache_perms.arguments.filename',
629 'rc_cache.cache_perms.arguments.filename',
629 os.path.join(default_cache_dir, 'rc_cache_1'), lower=False)
630 os.path.join(default_cache_dir, 'rc_cache_1'), lower=False)
630
631
631 # cache_repo
632 # cache_repo
632 _string_setting(
633 _string_setting(
633 settings,
634 settings,
634 'rc_cache.cache_repo.backend',
635 'rc_cache.cache_repo.backend',
635 'dogpile.cache.rc.file_namespace', lower=False)
636 'dogpile.cache.rc.file_namespace', lower=False)
636 _int_setting(
637 _int_setting(
637 settings,
638 settings,
638 'rc_cache.cache_repo.expiration_time',
639 'rc_cache.cache_repo.expiration_time',
639 60)
640 60)
640 _string_setting(
641 _string_setting(
641 settings,
642 settings,
642 'rc_cache.cache_repo.arguments.filename',
643 'rc_cache.cache_repo.arguments.filename',
643 os.path.join(default_cache_dir, 'rc_cache_2'), lower=False)
644 os.path.join(default_cache_dir, 'rc_cache_2'), lower=False)
644
645
645 # cache_license
646 # cache_license
646 _string_setting(
647 _string_setting(
647 settings,
648 settings,
648 'rc_cache.cache_license.backend',
649 'rc_cache.cache_license.backend',
649 'dogpile.cache.rc.file_namespace', lower=False)
650 'dogpile.cache.rc.file_namespace', lower=False)
650 _int_setting(
651 _int_setting(
651 settings,
652 settings,
652 'rc_cache.cache_license.expiration_time',
653 'rc_cache.cache_license.expiration_time',
653 5*60)
654 5*60)
654 _string_setting(
655 _string_setting(
655 settings,
656 settings,
656 'rc_cache.cache_license.arguments.filename',
657 'rc_cache.cache_license.arguments.filename',
657 os.path.join(default_cache_dir, 'rc_cache_3'), lower=False)
658 os.path.join(default_cache_dir, 'rc_cache_3'), lower=False)
658
659
659 # cache_repo_longterm memory, 96H
660 # cache_repo_longterm memory, 96H
660 _string_setting(
661 _string_setting(
661 settings,
662 settings,
662 'rc_cache.cache_repo_longterm.backend',
663 'rc_cache.cache_repo_longterm.backend',
663 'dogpile.cache.rc.memory_lru', lower=False)
664 'dogpile.cache.rc.memory_lru', lower=False)
664 _int_setting(
665 _int_setting(
665 settings,
666 settings,
666 'rc_cache.cache_repo_longterm.expiration_time',
667 'rc_cache.cache_repo_longterm.expiration_time',
667 345600)
668 345600)
668 _int_setting(
669 _int_setting(
669 settings,
670 settings,
670 'rc_cache.cache_repo_longterm.max_size',
671 'rc_cache.cache_repo_longterm.max_size',
671 10000)
672 10000)
672
673
673 # sql_cache_short
674 # sql_cache_short
674 _string_setting(
675 _string_setting(
675 settings,
676 settings,
676 'rc_cache.sql_cache_short.backend',
677 'rc_cache.sql_cache_short.backend',
677 'dogpile.cache.rc.memory_lru', lower=False)
678 'dogpile.cache.rc.memory_lru', lower=False)
678 _int_setting(
679 _int_setting(
679 settings,
680 settings,
680 'rc_cache.sql_cache_short.expiration_time',
681 'rc_cache.sql_cache_short.expiration_time',
681 30)
682 30)
682 _int_setting(
683 _int_setting(
683 settings,
684 settings,
684 'rc_cache.sql_cache_short.max_size',
685 'rc_cache.sql_cache_short.max_size',
685 10000)
686 10000)
686
687
687
688
688 def _int_setting(settings, name, default):
689 def _int_setting(settings, name, default):
689 settings[name] = int(settings.get(name, default))
690 settings[name] = int(settings.get(name, default))
690 return settings[name]
691 return settings[name]
691
692
692
693
693 def _bool_setting(settings, name, default):
694 def _bool_setting(settings, name, default):
694 input_val = settings.get(name, default)
695 input_val = settings.get(name, default)
695 if isinstance(input_val, unicode):
696 if isinstance(input_val, unicode):
696 input_val = input_val.encode('utf8')
697 input_val = input_val.encode('utf8')
697 settings[name] = asbool(input_val)
698 settings[name] = asbool(input_val)
698 return settings[name]
699 return settings[name]
699
700
700
701
701 def _list_setting(settings, name, default):
702 def _list_setting(settings, name, default):
702 raw_value = settings.get(name, default)
703 raw_value = settings.get(name, default)
703
704
704 old_separator = ','
705 old_separator = ','
705 if old_separator in raw_value:
706 if old_separator in raw_value:
706 # If we get a comma separated list, pass it to our own function.
707 # If we get a comma separated list, pass it to our own function.
707 settings[name] = rhodecode_aslist(raw_value, sep=old_separator)
708 settings[name] = rhodecode_aslist(raw_value, sep=old_separator)
708 else:
709 else:
709 # Otherwise we assume it uses pyramids space/newline separation.
710 # Otherwise we assume it uses pyramids space/newline separation.
710 settings[name] = aslist(raw_value)
711 settings[name] = aslist(raw_value)
711 return settings[name]
712 return settings[name]
712
713
713
714
714 def _string_setting(settings, name, default, lower=True, default_when_empty=False):
715 def _string_setting(settings, name, default, lower=True, default_when_empty=False):
715 value = settings.get(name, default)
716 value = settings.get(name, default)
716
717
717 if default_when_empty and not value:
718 if default_when_empty and not value:
718 # use default value when value is empty
719 # use default value when value is empty
719 value = default
720 value = default
720
721
721 if lower:
722 if lower:
722 value = value.lower()
723 value = value.lower()
723 settings[name] = value
724 settings[name] = value
724 return settings[name]
725 return settings[name]
725
726
726
727
727 def _substitute_values(mapping, substitutions):
728 def _substitute_values(mapping, substitutions):
728 result = {}
729 result = {}
729
730
730 try:
731 try:
731 for key, value in mapping.items():
732 for key, value in mapping.items():
732 # initialize without substitution first
733 # initialize without substitution first
733 result[key] = value
734 result[key] = value
734
735
735 # Note: Cannot use regular replacements, since they would clash
736 # Note: Cannot use regular replacements, since they would clash
736 # with the implementation of ConfigParser. Using "format" instead.
737 # with the implementation of ConfigParser. Using "format" instead.
737 try:
738 try:
738 result[key] = value.format(**substitutions)
739 result[key] = value.format(**substitutions)
739 except KeyError as e:
740 except KeyError as e:
740 env_var = '{}'.format(e.args[0])
741 env_var = '{}'.format(e.args[0])
741
742
742 msg = 'Failed to substitute: `{key}={{{var}}}` with environment entry. ' \
743 msg = 'Failed to substitute: `{key}={{{var}}}` with environment entry. ' \
743 'Make sure your environment has {var} set, or remove this ' \
744 'Make sure your environment has {var} set, or remove this ' \
744 'variable from config file'.format(key=key, var=env_var)
745 'variable from config file'.format(key=key, var=env_var)
745
746
746 if env_var.startswith('ENV_'):
747 if env_var.startswith('ENV_'):
747 raise ValueError(msg)
748 raise ValueError(msg)
748 else:
749 else:
749 log.warning(msg)
750 log.warning(msg)
750
751
751 except ValueError as e:
752 except ValueError as e:
752 log.warning('Failed to substitute ENV variable: %s', e)
753 log.warning('Failed to substitute ENV variable: %s', e)
753 result = mapping
754 result = mapping
754
755
755 return result
756 return result
General Comments 0
You need to be logged in to leave comments. Login now