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