##// END OF EJS Templates
initial version of #788 tarball cache
marcink -
r3490:c0ac34b8 beta
parent child Browse files
Show More
@@ -1,447 +1,449 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # RhodeCode - Pylons environment configuration #
3 # RhodeCode - Pylons environment configuration #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 pdebug = false
10 pdebug = false
11 ################################################################################
11 ################################################################################
12 ## Uncomment and replace with the address which should receive ##
12 ## Uncomment and replace with the address which should receive ##
13 ## any error reports after application crash ##
13 ## any error reports after application crash ##
14 ## Additionally those settings will be used by RhodeCode mailing system ##
14 ## Additionally those settings will be used by RhodeCode mailing system ##
15 ################################################################################
15 ################################################################################
16 #email_to = admin@localhost
16 #email_to = admin@localhost
17 #error_email_from = paste_error@localhost
17 #error_email_from = paste_error@localhost
18 #app_email_from = rhodecode-noreply@localhost
18 #app_email_from = rhodecode-noreply@localhost
19 #error_message =
19 #error_message =
20 #email_prefix = [RhodeCode]
20 #email_prefix = [RhodeCode]
21
21
22 #smtp_server = mail.server.com
22 #smtp_server = mail.server.com
23 #smtp_username =
23 #smtp_username =
24 #smtp_password =
24 #smtp_password =
25 #smtp_port =
25 #smtp_port =
26 #smtp_use_tls = false
26 #smtp_use_tls = false
27 #smtp_use_ssl = true
27 #smtp_use_ssl = true
28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
29 #smtp_auth =
29 #smtp_auth =
30
30
31 [server:main]
31 [server:main]
32 ## PASTE
32 ## PASTE
33 ##nr of threads to spawn
33 ##nr of threads to spawn
34 #threadpool_workers = 5
34 #threadpool_workers = 5
35
35
36 ##max request before thread respawn
36 ##max request before thread respawn
37 #threadpool_max_requests = 10
37 #threadpool_max_requests = 10
38
38
39 ##option to use threads of process
39 ##option to use threads of process
40 #use_threadpool = true
40 #use_threadpool = true
41
41
42 #use = egg:Paste#http
42 #use = egg:Paste#http
43
43
44 #WAITRESS
44 #WAITRESS
45 threads = 5
45 threads = 5
46 #100GB
46 #100GB
47 max_request_body_size = 107374182400
47 max_request_body_size = 107374182400
48 use = egg:waitress#main
48 use = egg:waitress#main
49
49
50 host = 0.0.0.0
50 host = 0.0.0.0
51 port = 5000
51 port = 5000
52
52
53 [filter:proxy-prefix]
53 [filter:proxy-prefix]
54 # prefix middleware for rc
54 # prefix middleware for rc
55 use = egg:PasteDeploy#prefix
55 use = egg:PasteDeploy#prefix
56 prefix = /<your-prefix>
56 prefix = /<your-prefix>
57
57
58 [app:main]
58 [app:main]
59 use = egg:rhodecode
59 use = egg:rhodecode
60 #filter-with = proxy-prefix
60 #filter-with = proxy-prefix
61 full_stack = true
61 full_stack = true
62 static_files = true
62 static_files = true
63 # Optional Languages
63 # Optional Languages
64 # en, fr, ja, pt_BR, zh_CN, zh_TW, pl
64 # en, fr, ja, pt_BR, zh_CN, zh_TW, pl
65 lang = en
65 lang = en
66 cache_dir = %(here)s/data
66 cache_dir = %(here)s/data
67 index_dir = %(here)s/data/index
67 index_dir = %(here)s/data/index
68 # set this path to use archive download cache
69 #archive_cache_dir = /tmp/rhodecode_tarballcache
68 app_instance_uuid = rc-develop
70 app_instance_uuid = rc-develop
69 cut_off_limit = 256000
71 cut_off_limit = 256000
70 vcs_full_cache = True
72 vcs_full_cache = True
71 # force https in RhodeCode, fixes https redirects, assumes it's always https
73 # force https in RhodeCode, fixes https redirects, assumes it's always https
72 force_https = false
74 force_https = false
73 # use Strict-Transport-Security headers
75 # use Strict-Transport-Security headers
74 use_htsts = false
76 use_htsts = false
75 commit_parse_limit = 25
77 commit_parse_limit = 25
76 # number of items displayed in lightweight dashboard before paginating
78 # number of items displayed in lightweight dashboard before paginating
77 dashboard_items = 100
79 dashboard_items = 100
78 use_gravatar = true
80 use_gravatar = true
79
81
80 # path to git executable
82 # path to git executable
81 git_path = git
83 git_path = git
82
84
83 ## RSS feed options
85 ## RSS feed options
84
86
85 rss_cut_off_limit = 256000
87 rss_cut_off_limit = 256000
86 rss_items_per_page = 10
88 rss_items_per_page = 10
87 rss_include_diff = false
89 rss_include_diff = false
88
90
89
91
90 ## alternative_gravatar_url allows you to use your own avatar server application
92 ## alternative_gravatar_url allows you to use your own avatar server application
91 ## the following parts of the URL will be replaced
93 ## the following parts of the URL will be replaced
92 ## {email} user email
94 ## {email} user email
93 ## {md5email} md5 hash of the user email (like at gravatar.com)
95 ## {md5email} md5 hash of the user email (like at gravatar.com)
94 ## {size} size of the image that is expected from the server application
96 ## {size} size of the image that is expected from the server application
95 ## {scheme} http/https from RhodeCode server
97 ## {scheme} http/https from RhodeCode server
96 ## {netloc} network location from RhodeCode server
98 ## {netloc} network location from RhodeCode server
97 #alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
99 #alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
98 #alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
100 #alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
99
101
100 container_auth_enabled = false
102 container_auth_enabled = false
101 proxypass_auth_enabled = false
103 proxypass_auth_enabled = false
102 ## default encoding used to convert from and to unicode
104 ## default encoding used to convert from and to unicode
103 ## can be also a comma seperated list of encoding in case of mixed encodings
105 ## can be also a comma seperated list of encoding in case of mixed encodings
104 default_encoding = utf8
106 default_encoding = utf8
105
107
106 ## overwrite schema of clone url
108 ## overwrite schema of clone url
107 ## available vars:
109 ## available vars:
108 ## scheme - http/https
110 ## scheme - http/https
109 ## user - current user
111 ## user - current user
110 ## pass - password
112 ## pass - password
111 ## netloc - network location
113 ## netloc - network location
112 ## path - usually repo_name
114 ## path - usually repo_name
113
115
114 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
116 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
115
117
116 ## issue tracking mapping for commits messages
118 ## issue tracking mapping for commits messages
117 ## comment out issue_pat, issue_server, issue_prefix to enable
119 ## comment out issue_pat, issue_server, issue_prefix to enable
118
120
119 ## pattern to get the issues from commit messages
121 ## pattern to get the issues from commit messages
120 ## default one used here is #<numbers> with a regex passive group for `#`
122 ## default one used here is #<numbers> with a regex passive group for `#`
121 ## {id} will be all groups matched from this pattern
123 ## {id} will be all groups matched from this pattern
122
124
123 issue_pat = (?:\s*#)(\d+)
125 issue_pat = (?:\s*#)(\d+)
124
126
125 ## server url to the issue, each {id} will be replaced with match
127 ## server url to the issue, each {id} will be replaced with match
126 ## fetched from the regex and {repo} is replaced with full repository name
128 ## fetched from the regex and {repo} is replaced with full repository name
127 ## including groups {repo_name} is replaced with just name of repo
129 ## including groups {repo_name} is replaced with just name of repo
128
130
129 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
131 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
130
132
131 ## prefix to add to link to indicate it's an url
133 ## prefix to add to link to indicate it's an url
132 ## #314 will be replaced by <issue_prefix><id>
134 ## #314 will be replaced by <issue_prefix><id>
133
135
134 issue_prefix = #
136 issue_prefix = #
135
137
136 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
138 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
137 ## multiple patterns, to other issues server, wiki or others
139 ## multiple patterns, to other issues server, wiki or others
138 ## below an example how to create a wiki pattern
140 ## below an example how to create a wiki pattern
139 # #wiki-some-id -> https://mywiki.com/some-id
141 # #wiki-some-id -> https://mywiki.com/some-id
140
142
141 #issue_pat_wiki = (?:wiki-)(.+)
143 #issue_pat_wiki = (?:wiki-)(.+)
142 #issue_server_link_wiki = https://mywiki.com/{id}
144 #issue_server_link_wiki = https://mywiki.com/{id}
143 #issue_prefix_wiki = WIKI-
145 #issue_prefix_wiki = WIKI-
144
146
145
147
146 ## instance-id prefix
148 ## instance-id prefix
147 ## a prefix key for this instance used for cache invalidation when running
149 ## a prefix key for this instance used for cache invalidation when running
148 ## multiple instances of rhodecode, make sure it's globally unique for
150 ## multiple instances of rhodecode, make sure it's globally unique for
149 ## all running rhodecode instances. Leave empty if you don't use it
151 ## all running rhodecode instances. Leave empty if you don't use it
150 instance_id =
152 instance_id =
151
153
152 ## alternative return HTTP header for failed authentication. Default HTTP
154 ## alternative return HTTP header for failed authentication. Default HTTP
153 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
155 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
154 ## handling that. Set this variable to 403 to return HTTPForbidden
156 ## handling that. Set this variable to 403 to return HTTPForbidden
155 auth_ret_code =
157 auth_ret_code =
156
158
157 ####################################
159 ####################################
158 ### CELERY CONFIG ####
160 ### CELERY CONFIG ####
159 ####################################
161 ####################################
160 use_celery = false
162 use_celery = false
161 broker.host = localhost
163 broker.host = localhost
162 broker.vhost = rabbitmqhost
164 broker.vhost = rabbitmqhost
163 broker.port = 5672
165 broker.port = 5672
164 broker.user = rabbitmq
166 broker.user = rabbitmq
165 broker.password = qweqwe
167 broker.password = qweqwe
166
168
167 celery.imports = rhodecode.lib.celerylib.tasks
169 celery.imports = rhodecode.lib.celerylib.tasks
168
170
169 celery.result.backend = amqp
171 celery.result.backend = amqp
170 celery.result.dburi = amqp://
172 celery.result.dburi = amqp://
171 celery.result.serialier = json
173 celery.result.serialier = json
172
174
173 #celery.send.task.error.emails = true
175 #celery.send.task.error.emails = true
174 #celery.amqp.task.result.expires = 18000
176 #celery.amqp.task.result.expires = 18000
175
177
176 celeryd.concurrency = 2
178 celeryd.concurrency = 2
177 #celeryd.log.file = celeryd.log
179 #celeryd.log.file = celeryd.log
178 celeryd.log.level = debug
180 celeryd.log.level = debug
179 celeryd.max.tasks.per.child = 1
181 celeryd.max.tasks.per.child = 1
180
182
181 #tasks will never be sent to the queue, but executed locally instead.
183 #tasks will never be sent to the queue, but executed locally instead.
182 celery.always.eager = false
184 celery.always.eager = false
183
185
184 ####################################
186 ####################################
185 ### BEAKER CACHE ####
187 ### BEAKER CACHE ####
186 ####################################
188 ####################################
187 beaker.cache.data_dir=%(here)s/data/cache/data
189 beaker.cache.data_dir=%(here)s/data/cache/data
188 beaker.cache.lock_dir=%(here)s/data/cache/lock
190 beaker.cache.lock_dir=%(here)s/data/cache/lock
189
191
190 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
192 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
191
193
192 beaker.cache.super_short_term.type=memory
194 beaker.cache.super_short_term.type=memory
193 beaker.cache.super_short_term.expire=10
195 beaker.cache.super_short_term.expire=10
194 beaker.cache.super_short_term.key_length = 256
196 beaker.cache.super_short_term.key_length = 256
195
197
196 beaker.cache.short_term.type=memory
198 beaker.cache.short_term.type=memory
197 beaker.cache.short_term.expire=60
199 beaker.cache.short_term.expire=60
198 beaker.cache.short_term.key_length = 256
200 beaker.cache.short_term.key_length = 256
199
201
200 beaker.cache.long_term.type=memory
202 beaker.cache.long_term.type=memory
201 beaker.cache.long_term.expire=36000
203 beaker.cache.long_term.expire=36000
202 beaker.cache.long_term.key_length = 256
204 beaker.cache.long_term.key_length = 256
203
205
204 beaker.cache.sql_cache_short.type=memory
206 beaker.cache.sql_cache_short.type=memory
205 beaker.cache.sql_cache_short.expire=10
207 beaker.cache.sql_cache_short.expire=10
206 beaker.cache.sql_cache_short.key_length = 256
208 beaker.cache.sql_cache_short.key_length = 256
207
209
208 beaker.cache.sql_cache_med.type=memory
210 beaker.cache.sql_cache_med.type=memory
209 beaker.cache.sql_cache_med.expire=360
211 beaker.cache.sql_cache_med.expire=360
210 beaker.cache.sql_cache_med.key_length = 256
212 beaker.cache.sql_cache_med.key_length = 256
211
213
212 beaker.cache.sql_cache_long.type=file
214 beaker.cache.sql_cache_long.type=file
213 beaker.cache.sql_cache_long.expire=3600
215 beaker.cache.sql_cache_long.expire=3600
214 beaker.cache.sql_cache_long.key_length = 256
216 beaker.cache.sql_cache_long.key_length = 256
215
217
216 ####################################
218 ####################################
217 ### BEAKER SESSION ####
219 ### BEAKER SESSION ####
218 ####################################
220 ####################################
219 ## Type of storage used for the session, current types are
221 ## Type of storage used for the session, current types are
220 ## dbm, file, memcached, database, and memory.
222 ## dbm, file, memcached, database, and memory.
221 ## The storage uses the Container API
223 ## The storage uses the Container API
222 ## that is also used by the cache system.
224 ## that is also used by the cache system.
223
225
224 ## db session ##
226 ## db session ##
225 #beaker.session.type = ext:database
227 #beaker.session.type = ext:database
226 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
228 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
227 #beaker.session.table_name = db_session
229 #beaker.session.table_name = db_session
228
230
229 ## encrypted cookie client side session, good for many instances ##
231 ## encrypted cookie client side session, good for many instances ##
230 #beaker.session.type = cookie
232 #beaker.session.type = cookie
231
233
232 ## file based cookies (default) ##
234 ## file based cookies (default) ##
233 #beaker.session.type = file
235 #beaker.session.type = file
234
236
235
237
236 beaker.session.key = rhodecode
238 beaker.session.key = rhodecode
237 ## secure cookie requires AES python libraries ##
239 ## secure cookie requires AES python libraries ##
238 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
240 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
239 #beaker.session.validate_key = 9712sds2212c--zxc123
241 #beaker.session.validate_key = 9712sds2212c--zxc123
240 ## sets session as invalid if it haven't been accessed for given amount of time
242 ## sets session as invalid if it haven't been accessed for given amount of time
241 beaker.session.timeout = 2592000
243 beaker.session.timeout = 2592000
242 beaker.session.httponly = true
244 beaker.session.httponly = true
243 #beaker.session.cookie_path = /<your-prefix>
245 #beaker.session.cookie_path = /<your-prefix>
244
246
245 ## uncomment for https secure cookie ##
247 ## uncomment for https secure cookie ##
246 beaker.session.secure = false
248 beaker.session.secure = false
247
249
248 ## auto save the session to not to use .save() ##
250 ## auto save the session to not to use .save() ##
249 beaker.session.auto = False
251 beaker.session.auto = False
250
252
251 ## default cookie expiration time in seconds `true` expire at browser close ##
253 ## default cookie expiration time in seconds `true` expire at browser close ##
252 #beaker.session.cookie_expires = 3600
254 #beaker.session.cookie_expires = 3600
253
255
254
256
255 ############################
257 ############################
256 ## ERROR HANDLING SYSTEMS ##
258 ## ERROR HANDLING SYSTEMS ##
257 ############################
259 ############################
258
260
259 ####################
261 ####################
260 ### [errormator] ###
262 ### [errormator] ###
261 ####################
263 ####################
262
264
263 # Errormator is tailored to work with RhodeCode, see
265 # Errormator is tailored to work with RhodeCode, see
264 # http://errormator.com for details how to obtain an account
266 # http://errormator.com for details how to obtain an account
265 # you must install python package `errormator_client` to make it work
267 # you must install python package `errormator_client` to make it work
266
268
267 # errormator enabled
269 # errormator enabled
268 errormator = true
270 errormator = true
269
271
270 errormator.server_url = https://api.errormator.com
272 errormator.server_url = https://api.errormator.com
271 errormator.api_key = YOUR_API_KEY
273 errormator.api_key = YOUR_API_KEY
272
274
273 # TWEAK AMOUNT OF INFO SENT HERE
275 # TWEAK AMOUNT OF INFO SENT HERE
274
276
275 # enables 404 error logging (default False)
277 # enables 404 error logging (default False)
276 errormator.report_404 = false
278 errormator.report_404 = false
277
279
278 # time in seconds after request is considered being slow (default 1)
280 # time in seconds after request is considered being slow (default 1)
279 errormator.slow_request_time = 1
281 errormator.slow_request_time = 1
280
282
281 # record slow requests in application
283 # record slow requests in application
282 # (needs to be enabled for slow datastore recording and time tracking)
284 # (needs to be enabled for slow datastore recording and time tracking)
283 errormator.slow_requests = true
285 errormator.slow_requests = true
284
286
285 # enable hooking to application loggers
287 # enable hooking to application loggers
286 # errormator.logging = true
288 # errormator.logging = true
287
289
288 # minimum log level for log capture
290 # minimum log level for log capture
289 # errormator.logging.level = WARNING
291 # errormator.logging.level = WARNING
290
292
291 # send logs only from erroneous/slow requests
293 # send logs only from erroneous/slow requests
292 # (saves API quota for intensive logging)
294 # (saves API quota for intensive logging)
293 errormator.logging_on_error = false
295 errormator.logging_on_error = false
294
296
295 # list of additonal keywords that should be grabbed from environ object
297 # list of additonal keywords that should be grabbed from environ object
296 # can be string with comma separated list of words in lowercase
298 # can be string with comma separated list of words in lowercase
297 # (by default client will always send following info:
299 # (by default client will always send following info:
298 # 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
300 # 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
299 # start with HTTP* this list be extended with additional keywords here
301 # start with HTTP* this list be extended with additional keywords here
300 errormator.environ_keys_whitelist =
302 errormator.environ_keys_whitelist =
301
303
302
304
303 # list of keywords that should be blanked from request object
305 # list of keywords that should be blanked from request object
304 # can be string with comma separated list of words in lowercase
306 # can be string with comma separated list of words in lowercase
305 # (by default client will always blank keys that contain following words
307 # (by default client will always blank keys that contain following words
306 # 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
308 # 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
307 # this list be extended with additional keywords set here
309 # this list be extended with additional keywords set here
308 errormator.request_keys_blacklist =
310 errormator.request_keys_blacklist =
309
311
310
312
311 # list of namespaces that should be ignores when gathering log entries
313 # list of namespaces that should be ignores when gathering log entries
312 # can be string with comma separated list of namespaces
314 # can be string with comma separated list of namespaces
313 # (by default the client ignores own entries: errormator_client.client)
315 # (by default the client ignores own entries: errormator_client.client)
314 errormator.log_namespace_blacklist =
316 errormator.log_namespace_blacklist =
315
317
316
318
317 ################
319 ################
318 ### [sentry] ###
320 ### [sentry] ###
319 ################
321 ################
320
322
321 # sentry is a alternative open source error aggregator
323 # sentry is a alternative open source error aggregator
322 # you must install python packages `sentry` and `raven` to enable
324 # you must install python packages `sentry` and `raven` to enable
323
325
324 sentry.dsn = YOUR_DNS
326 sentry.dsn = YOUR_DNS
325 sentry.servers =
327 sentry.servers =
326 sentry.name =
328 sentry.name =
327 sentry.key =
329 sentry.key =
328 sentry.public_key =
330 sentry.public_key =
329 sentry.secret_key =
331 sentry.secret_key =
330 sentry.project =
332 sentry.project =
331 sentry.site =
333 sentry.site =
332 sentry.include_paths =
334 sentry.include_paths =
333 sentry.exclude_paths =
335 sentry.exclude_paths =
334
336
335
337
336 ################################################################################
338 ################################################################################
337 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
339 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
338 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
340 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
339 ## execute malicious code after an exception is raised. ##
341 ## execute malicious code after an exception is raised. ##
340 ################################################################################
342 ################################################################################
341 #set debug = false
343 #set debug = false
342
344
343 ##################################
345 ##################################
344 ### LOGVIEW CONFIG ###
346 ### LOGVIEW CONFIG ###
345 ##################################
347 ##################################
346 logview.sqlalchemy = #faa
348 logview.sqlalchemy = #faa
347 logview.pylons.templating = #bfb
349 logview.pylons.templating = #bfb
348 logview.pylons.util = #eee
350 logview.pylons.util = #eee
349
351
350 #########################################################
352 #########################################################
351 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
353 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
352 #########################################################
354 #########################################################
353 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
355 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
354 sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
356 sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
355 sqlalchemy.db1.echo = false
357 sqlalchemy.db1.echo = false
356 sqlalchemy.db1.pool_recycle = 3600
358 sqlalchemy.db1.pool_recycle = 3600
357 sqlalchemy.db1.convert_unicode = true
359 sqlalchemy.db1.convert_unicode = true
358
360
359 ################################
361 ################################
360 ### LOGGING CONFIGURATION ####
362 ### LOGGING CONFIGURATION ####
361 ################################
363 ################################
362 [loggers]
364 [loggers]
363 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
365 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
364
366
365 [handlers]
367 [handlers]
366 keys = console, console_sql
368 keys = console, console_sql
367
369
368 [formatters]
370 [formatters]
369 keys = generic, color_formatter, color_formatter_sql
371 keys = generic, color_formatter, color_formatter_sql
370
372
371 #############
373 #############
372 ## LOGGERS ##
374 ## LOGGERS ##
373 #############
375 #############
374 [logger_root]
376 [logger_root]
375 level = NOTSET
377 level = NOTSET
376 handlers = console
378 handlers = console
377
379
378 [logger_routes]
380 [logger_routes]
379 level = DEBUG
381 level = DEBUG
380 handlers =
382 handlers =
381 qualname = routes.middleware
383 qualname = routes.middleware
382 # "level = DEBUG" logs the route matched and routing variables.
384 # "level = DEBUG" logs the route matched and routing variables.
383 propagate = 1
385 propagate = 1
384
386
385 [logger_beaker]
387 [logger_beaker]
386 level = DEBUG
388 level = DEBUG
387 handlers =
389 handlers =
388 qualname = beaker.container
390 qualname = beaker.container
389 propagate = 1
391 propagate = 1
390
392
391 [logger_templates]
393 [logger_templates]
392 level = INFO
394 level = INFO
393 handlers =
395 handlers =
394 qualname = pylons.templating
396 qualname = pylons.templating
395 propagate = 1
397 propagate = 1
396
398
397 [logger_rhodecode]
399 [logger_rhodecode]
398 level = DEBUG
400 level = DEBUG
399 handlers =
401 handlers =
400 qualname = rhodecode
402 qualname = rhodecode
401 propagate = 1
403 propagate = 1
402
404
403 [logger_sqlalchemy]
405 [logger_sqlalchemy]
404 level = INFO
406 level = INFO
405 handlers = console_sql
407 handlers = console_sql
406 qualname = sqlalchemy.engine
408 qualname = sqlalchemy.engine
407 propagate = 0
409 propagate = 0
408
410
409 [logger_whoosh_indexer]
411 [logger_whoosh_indexer]
410 level = DEBUG
412 level = DEBUG
411 handlers =
413 handlers =
412 qualname = whoosh_indexer
414 qualname = whoosh_indexer
413 propagate = 1
415 propagate = 1
414
416
415 ##############
417 ##############
416 ## HANDLERS ##
418 ## HANDLERS ##
417 ##############
419 ##############
418
420
419 [handler_console]
421 [handler_console]
420 class = StreamHandler
422 class = StreamHandler
421 args = (sys.stderr,)
423 args = (sys.stderr,)
422 level = DEBUG
424 level = DEBUG
423 formatter = color_formatter
425 formatter = color_formatter
424
426
425 [handler_console_sql]
427 [handler_console_sql]
426 class = StreamHandler
428 class = StreamHandler
427 args = (sys.stderr,)
429 args = (sys.stderr,)
428 level = DEBUG
430 level = DEBUG
429 formatter = color_formatter_sql
431 formatter = color_formatter_sql
430
432
431 ################
433 ################
432 ## FORMATTERS ##
434 ## FORMATTERS ##
433 ################
435 ################
434
436
435 [formatter_generic]
437 [formatter_generic]
436 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
438 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
437 datefmt = %Y-%m-%d %H:%M:%S
439 datefmt = %Y-%m-%d %H:%M:%S
438
440
439 [formatter_color_formatter]
441 [formatter_color_formatter]
440 class=rhodecode.lib.colored_formatter.ColorFormatter
442 class=rhodecode.lib.colored_formatter.ColorFormatter
441 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
443 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
442 datefmt = %Y-%m-%d %H:%M:%S
444 datefmt = %Y-%m-%d %H:%M:%S
443
445
444 [formatter_color_formatter_sql]
446 [formatter_color_formatter_sql]
445 class=rhodecode.lib.colored_formatter.ColorFormatterSql
447 class=rhodecode.lib.colored_formatter.ColorFormatterSql
446 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
448 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
447 datefmt = %Y-%m-%d %H:%M:%S
449 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,447 +1,449 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # RhodeCode - Pylons environment configuration #
3 # RhodeCode - Pylons environment configuration #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 pdebug = false
10 pdebug = false
11 ################################################################################
11 ################################################################################
12 ## Uncomment and replace with the address which should receive ##
12 ## Uncomment and replace with the address which should receive ##
13 ## any error reports after application crash ##
13 ## any error reports after application crash ##
14 ## Additionally those settings will be used by RhodeCode mailing system ##
14 ## Additionally those settings will be used by RhodeCode mailing system ##
15 ################################################################################
15 ################################################################################
16 #email_to = admin@localhost
16 #email_to = admin@localhost
17 #error_email_from = paste_error@localhost
17 #error_email_from = paste_error@localhost
18 #app_email_from = rhodecode-noreply@localhost
18 #app_email_from = rhodecode-noreply@localhost
19 #error_message =
19 #error_message =
20 #email_prefix = [RhodeCode]
20 #email_prefix = [RhodeCode]
21
21
22 #smtp_server = mail.server.com
22 #smtp_server = mail.server.com
23 #smtp_username =
23 #smtp_username =
24 #smtp_password =
24 #smtp_password =
25 #smtp_port =
25 #smtp_port =
26 #smtp_use_tls = false
26 #smtp_use_tls = false
27 #smtp_use_ssl = true
27 #smtp_use_ssl = true
28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
29 #smtp_auth =
29 #smtp_auth =
30
30
31 [server:main]
31 [server:main]
32 ## PASTE
32 ## PASTE
33 ##nr of threads to spawn
33 ##nr of threads to spawn
34 #threadpool_workers = 5
34 #threadpool_workers = 5
35
35
36 ##max request before thread respawn
36 ##max request before thread respawn
37 #threadpool_max_requests = 10
37 #threadpool_max_requests = 10
38
38
39 ##option to use threads of process
39 ##option to use threads of process
40 #use_threadpool = true
40 #use_threadpool = true
41
41
42 #use = egg:Paste#http
42 #use = egg:Paste#http
43
43
44 #WAITRESS
44 #WAITRESS
45 threads = 5
45 threads = 5
46 #100GB
46 #100GB
47 max_request_body_size = 107374182400
47 max_request_body_size = 107374182400
48 use = egg:waitress#main
48 use = egg:waitress#main
49
49
50 host = 127.0.0.1
50 host = 127.0.0.1
51 port = 8001
51 port = 8001
52
52
53 [filter:proxy-prefix]
53 [filter:proxy-prefix]
54 # prefix middleware for rc
54 # prefix middleware for rc
55 use = egg:PasteDeploy#prefix
55 use = egg:PasteDeploy#prefix
56 prefix = /<your-prefix>
56 prefix = /<your-prefix>
57
57
58 [app:main]
58 [app:main]
59 use = egg:rhodecode
59 use = egg:rhodecode
60 #filter-with = proxy-prefix
60 #filter-with = proxy-prefix
61 full_stack = true
61 full_stack = true
62 static_files = true
62 static_files = true
63 # Optional Languages
63 # Optional Languages
64 # en, fr, ja, pt_BR, zh_CN, zh_TW, pl
64 # en, fr, ja, pt_BR, zh_CN, zh_TW, pl
65 lang = en
65 lang = en
66 cache_dir = %(here)s/data
66 cache_dir = %(here)s/data
67 index_dir = %(here)s/data/index
67 index_dir = %(here)s/data/index
68 # set this path to use archive download cache
69 #archive_cache_dir = /tmp/rhodecode_tarballcache
68 app_instance_uuid = rc-production
70 app_instance_uuid = rc-production
69 cut_off_limit = 256000
71 cut_off_limit = 256000
70 vcs_full_cache = True
72 vcs_full_cache = True
71 # force https in RhodeCode, fixes https redirects, assumes it's always https
73 # force https in RhodeCode, fixes https redirects, assumes it's always https
72 force_https = false
74 force_https = false
73 # use Strict-Transport-Security headers
75 # use Strict-Transport-Security headers
74 use_htsts = false
76 use_htsts = false
75 commit_parse_limit = 50
77 commit_parse_limit = 50
76 # number of items displayed in lightweight dashboard before paginating
78 # number of items displayed in lightweight dashboard before paginating
77 dashboard_items = 100
79 dashboard_items = 100
78 use_gravatar = true
80 use_gravatar = true
79
81
80 # path to git executable
82 # path to git executable
81 git_path = git
83 git_path = git
82
84
83 ## RSS feed options
85 ## RSS feed options
84
86
85 rss_cut_off_limit = 256000
87 rss_cut_off_limit = 256000
86 rss_items_per_page = 10
88 rss_items_per_page = 10
87 rss_include_diff = false
89 rss_include_diff = false
88
90
89
91
90 ## alternative_gravatar_url allows you to use your own avatar server application
92 ## alternative_gravatar_url allows you to use your own avatar server application
91 ## the following parts of the URL will be replaced
93 ## the following parts of the URL will be replaced
92 ## {email} user email
94 ## {email} user email
93 ## {md5email} md5 hash of the user email (like at gravatar.com)
95 ## {md5email} md5 hash of the user email (like at gravatar.com)
94 ## {size} size of the image that is expected from the server application
96 ## {size} size of the image that is expected from the server application
95 ## {scheme} http/https from RhodeCode server
97 ## {scheme} http/https from RhodeCode server
96 ## {netloc} network location from RhodeCode server
98 ## {netloc} network location from RhodeCode server
97 #alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
99 #alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
98 #alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
100 #alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
99
101
100 container_auth_enabled = false
102 container_auth_enabled = false
101 proxypass_auth_enabled = false
103 proxypass_auth_enabled = false
102 ## default encoding used to convert from and to unicode
104 ## default encoding used to convert from and to unicode
103 ## can be also a comma seperated list of encoding in case of mixed encodings
105 ## can be also a comma seperated list of encoding in case of mixed encodings
104 default_encoding = utf8
106 default_encoding = utf8
105
107
106 ## overwrite schema of clone url
108 ## overwrite schema of clone url
107 ## available vars:
109 ## available vars:
108 ## scheme - http/https
110 ## scheme - http/https
109 ## user - current user
111 ## user - current user
110 ## pass - password
112 ## pass - password
111 ## netloc - network location
113 ## netloc - network location
112 ## path - usually repo_name
114 ## path - usually repo_name
113
115
114 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
116 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
115
117
116 ## issue tracking mapping for commits messages
118 ## issue tracking mapping for commits messages
117 ## comment out issue_pat, issue_server, issue_prefix to enable
119 ## comment out issue_pat, issue_server, issue_prefix to enable
118
120
119 ## pattern to get the issues from commit messages
121 ## pattern to get the issues from commit messages
120 ## default one used here is #<numbers> with a regex passive group for `#`
122 ## default one used here is #<numbers> with a regex passive group for `#`
121 ## {id} will be all groups matched from this pattern
123 ## {id} will be all groups matched from this pattern
122
124
123 issue_pat = (?:\s*#)(\d+)
125 issue_pat = (?:\s*#)(\d+)
124
126
125 ## server url to the issue, each {id} will be replaced with match
127 ## server url to the issue, each {id} will be replaced with match
126 ## fetched from the regex and {repo} is replaced with full repository name
128 ## fetched from the regex and {repo} is replaced with full repository name
127 ## including groups {repo_name} is replaced with just name of repo
129 ## including groups {repo_name} is replaced with just name of repo
128
130
129 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
131 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
130
132
131 ## prefix to add to link to indicate it's an url
133 ## prefix to add to link to indicate it's an url
132 ## #314 will be replaced by <issue_prefix><id>
134 ## #314 will be replaced by <issue_prefix><id>
133
135
134 issue_prefix = #
136 issue_prefix = #
135
137
136 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
138 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
137 ## multiple patterns, to other issues server, wiki or others
139 ## multiple patterns, to other issues server, wiki or others
138 ## below an example how to create a wiki pattern
140 ## below an example how to create a wiki pattern
139 # #wiki-some-id -> https://mywiki.com/some-id
141 # #wiki-some-id -> https://mywiki.com/some-id
140
142
141 #issue_pat_wiki = (?:wiki-)(.+)
143 #issue_pat_wiki = (?:wiki-)(.+)
142 #issue_server_link_wiki = https://mywiki.com/{id}
144 #issue_server_link_wiki = https://mywiki.com/{id}
143 #issue_prefix_wiki = WIKI-
145 #issue_prefix_wiki = WIKI-
144
146
145
147
146 ## instance-id prefix
148 ## instance-id prefix
147 ## a prefix key for this instance used for cache invalidation when running
149 ## a prefix key for this instance used for cache invalidation when running
148 ## multiple instances of rhodecode, make sure it's globally unique for
150 ## multiple instances of rhodecode, make sure it's globally unique for
149 ## all running rhodecode instances. Leave empty if you don't use it
151 ## all running rhodecode instances. Leave empty if you don't use it
150 instance_id =
152 instance_id =
151
153
152 ## alternative return HTTP header for failed authentication. Default HTTP
154 ## alternative return HTTP header for failed authentication. Default HTTP
153 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
155 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
154 ## handling that. Set this variable to 403 to return HTTPForbidden
156 ## handling that. Set this variable to 403 to return HTTPForbidden
155 auth_ret_code =
157 auth_ret_code =
156
158
157 ####################################
159 ####################################
158 ### CELERY CONFIG ####
160 ### CELERY CONFIG ####
159 ####################################
161 ####################################
160 use_celery = false
162 use_celery = false
161 broker.host = localhost
163 broker.host = localhost
162 broker.vhost = rabbitmqhost
164 broker.vhost = rabbitmqhost
163 broker.port = 5672
165 broker.port = 5672
164 broker.user = rabbitmq
166 broker.user = rabbitmq
165 broker.password = qweqwe
167 broker.password = qweqwe
166
168
167 celery.imports = rhodecode.lib.celerylib.tasks
169 celery.imports = rhodecode.lib.celerylib.tasks
168
170
169 celery.result.backend = amqp
171 celery.result.backend = amqp
170 celery.result.dburi = amqp://
172 celery.result.dburi = amqp://
171 celery.result.serialier = json
173 celery.result.serialier = json
172
174
173 #celery.send.task.error.emails = true
175 #celery.send.task.error.emails = true
174 #celery.amqp.task.result.expires = 18000
176 #celery.amqp.task.result.expires = 18000
175
177
176 celeryd.concurrency = 2
178 celeryd.concurrency = 2
177 #celeryd.log.file = celeryd.log
179 #celeryd.log.file = celeryd.log
178 celeryd.log.level = debug
180 celeryd.log.level = debug
179 celeryd.max.tasks.per.child = 1
181 celeryd.max.tasks.per.child = 1
180
182
181 #tasks will never be sent to the queue, but executed locally instead.
183 #tasks will never be sent to the queue, but executed locally instead.
182 celery.always.eager = false
184 celery.always.eager = false
183
185
184 ####################################
186 ####################################
185 ### BEAKER CACHE ####
187 ### BEAKER CACHE ####
186 ####################################
188 ####################################
187 beaker.cache.data_dir=%(here)s/data/cache/data
189 beaker.cache.data_dir=%(here)s/data/cache/data
188 beaker.cache.lock_dir=%(here)s/data/cache/lock
190 beaker.cache.lock_dir=%(here)s/data/cache/lock
189
191
190 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
192 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
191
193
192 beaker.cache.super_short_term.type=memory
194 beaker.cache.super_short_term.type=memory
193 beaker.cache.super_short_term.expire=10
195 beaker.cache.super_short_term.expire=10
194 beaker.cache.super_short_term.key_length = 256
196 beaker.cache.super_short_term.key_length = 256
195
197
196 beaker.cache.short_term.type=memory
198 beaker.cache.short_term.type=memory
197 beaker.cache.short_term.expire=60
199 beaker.cache.short_term.expire=60
198 beaker.cache.short_term.key_length = 256
200 beaker.cache.short_term.key_length = 256
199
201
200 beaker.cache.long_term.type=memory
202 beaker.cache.long_term.type=memory
201 beaker.cache.long_term.expire=36000
203 beaker.cache.long_term.expire=36000
202 beaker.cache.long_term.key_length = 256
204 beaker.cache.long_term.key_length = 256
203
205
204 beaker.cache.sql_cache_short.type=memory
206 beaker.cache.sql_cache_short.type=memory
205 beaker.cache.sql_cache_short.expire=10
207 beaker.cache.sql_cache_short.expire=10
206 beaker.cache.sql_cache_short.key_length = 256
208 beaker.cache.sql_cache_short.key_length = 256
207
209
208 beaker.cache.sql_cache_med.type=memory
210 beaker.cache.sql_cache_med.type=memory
209 beaker.cache.sql_cache_med.expire=360
211 beaker.cache.sql_cache_med.expire=360
210 beaker.cache.sql_cache_med.key_length = 256
212 beaker.cache.sql_cache_med.key_length = 256
211
213
212 beaker.cache.sql_cache_long.type=file
214 beaker.cache.sql_cache_long.type=file
213 beaker.cache.sql_cache_long.expire=3600
215 beaker.cache.sql_cache_long.expire=3600
214 beaker.cache.sql_cache_long.key_length = 256
216 beaker.cache.sql_cache_long.key_length = 256
215
217
216 ####################################
218 ####################################
217 ### BEAKER SESSION ####
219 ### BEAKER SESSION ####
218 ####################################
220 ####################################
219 ## Type of storage used for the session, current types are
221 ## Type of storage used for the session, current types are
220 ## dbm, file, memcached, database, and memory.
222 ## dbm, file, memcached, database, and memory.
221 ## The storage uses the Container API
223 ## The storage uses the Container API
222 ## that is also used by the cache system.
224 ## that is also used by the cache system.
223
225
224 ## db session ##
226 ## db session ##
225 #beaker.session.type = ext:database
227 #beaker.session.type = ext:database
226 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
228 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
227 #beaker.session.table_name = db_session
229 #beaker.session.table_name = db_session
228
230
229 ## encrypted cookie client side session, good for many instances ##
231 ## encrypted cookie client side session, good for many instances ##
230 #beaker.session.type = cookie
232 #beaker.session.type = cookie
231
233
232 ## file based cookies (default) ##
234 ## file based cookies (default) ##
233 #beaker.session.type = file
235 #beaker.session.type = file
234
236
235
237
236 beaker.session.key = rhodecode
238 beaker.session.key = rhodecode
237 ## secure cookie requires AES python libraries ##
239 ## secure cookie requires AES python libraries ##
238 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
240 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
239 #beaker.session.validate_key = 9712sds2212c--zxc123
241 #beaker.session.validate_key = 9712sds2212c--zxc123
240 ## sets session as invalid if it haven't been accessed for given amount of time
242 ## sets session as invalid if it haven't been accessed for given amount of time
241 beaker.session.timeout = 2592000
243 beaker.session.timeout = 2592000
242 beaker.session.httponly = true
244 beaker.session.httponly = true
243 #beaker.session.cookie_path = /<your-prefix>
245 #beaker.session.cookie_path = /<your-prefix>
244
246
245 ## uncomment for https secure cookie ##
247 ## uncomment for https secure cookie ##
246 beaker.session.secure = false
248 beaker.session.secure = false
247
249
248 ## auto save the session to not to use .save() ##
250 ## auto save the session to not to use .save() ##
249 beaker.session.auto = False
251 beaker.session.auto = False
250
252
251 ## default cookie expiration time in seconds `true` expire at browser close ##
253 ## default cookie expiration time in seconds `true` expire at browser close ##
252 #beaker.session.cookie_expires = 3600
254 #beaker.session.cookie_expires = 3600
253
255
254
256
255 ############################
257 ############################
256 ## ERROR HANDLING SYSTEMS ##
258 ## ERROR HANDLING SYSTEMS ##
257 ############################
259 ############################
258
260
259 ####################
261 ####################
260 ### [errormator] ###
262 ### [errormator] ###
261 ####################
263 ####################
262
264
263 # Errormator is tailored to work with RhodeCode, see
265 # Errormator is tailored to work with RhodeCode, see
264 # http://errormator.com for details how to obtain an account
266 # http://errormator.com for details how to obtain an account
265 # you must install python package `errormator_client` to make it work
267 # you must install python package `errormator_client` to make it work
266
268
267 # errormator enabled
269 # errormator enabled
268 errormator = true
270 errormator = true
269
271
270 errormator.server_url = https://api.errormator.com
272 errormator.server_url = https://api.errormator.com
271 errormator.api_key = YOUR_API_KEY
273 errormator.api_key = YOUR_API_KEY
272
274
273 # TWEAK AMOUNT OF INFO SENT HERE
275 # TWEAK AMOUNT OF INFO SENT HERE
274
276
275 # enables 404 error logging (default False)
277 # enables 404 error logging (default False)
276 errormator.report_404 = false
278 errormator.report_404 = false
277
279
278 # time in seconds after request is considered being slow (default 1)
280 # time in seconds after request is considered being slow (default 1)
279 errormator.slow_request_time = 1
281 errormator.slow_request_time = 1
280
282
281 # record slow requests in application
283 # record slow requests in application
282 # (needs to be enabled for slow datastore recording and time tracking)
284 # (needs to be enabled for slow datastore recording and time tracking)
283 errormator.slow_requests = true
285 errormator.slow_requests = true
284
286
285 # enable hooking to application loggers
287 # enable hooking to application loggers
286 # errormator.logging = true
288 # errormator.logging = true
287
289
288 # minimum log level for log capture
290 # minimum log level for log capture
289 # errormator.logging.level = WARNING
291 # errormator.logging.level = WARNING
290
292
291 # send logs only from erroneous/slow requests
293 # send logs only from erroneous/slow requests
292 # (saves API quota for intensive logging)
294 # (saves API quota for intensive logging)
293 errormator.logging_on_error = false
295 errormator.logging_on_error = false
294
296
295 # list of additonal keywords that should be grabbed from environ object
297 # list of additonal keywords that should be grabbed from environ object
296 # can be string with comma separated list of words in lowercase
298 # can be string with comma separated list of words in lowercase
297 # (by default client will always send following info:
299 # (by default client will always send following info:
298 # 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
300 # 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
299 # start with HTTP* this list be extended with additional keywords here
301 # start with HTTP* this list be extended with additional keywords here
300 errormator.environ_keys_whitelist =
302 errormator.environ_keys_whitelist =
301
303
302
304
303 # list of keywords that should be blanked from request object
305 # list of keywords that should be blanked from request object
304 # can be string with comma separated list of words in lowercase
306 # can be string with comma separated list of words in lowercase
305 # (by default client will always blank keys that contain following words
307 # (by default client will always blank keys that contain following words
306 # 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
308 # 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
307 # this list be extended with additional keywords set here
309 # this list be extended with additional keywords set here
308 errormator.request_keys_blacklist =
310 errormator.request_keys_blacklist =
309
311
310
312
311 # list of namespaces that should be ignores when gathering log entries
313 # list of namespaces that should be ignores when gathering log entries
312 # can be string with comma separated list of namespaces
314 # can be string with comma separated list of namespaces
313 # (by default the client ignores own entries: errormator_client.client)
315 # (by default the client ignores own entries: errormator_client.client)
314 errormator.log_namespace_blacklist =
316 errormator.log_namespace_blacklist =
315
317
316
318
317 ################
319 ################
318 ### [sentry] ###
320 ### [sentry] ###
319 ################
321 ################
320
322
321 # sentry is a alternative open source error aggregator
323 # sentry is a alternative open source error aggregator
322 # you must install python packages `sentry` and `raven` to enable
324 # you must install python packages `sentry` and `raven` to enable
323
325
324 sentry.dsn = YOUR_DNS
326 sentry.dsn = YOUR_DNS
325 sentry.servers =
327 sentry.servers =
326 sentry.name =
328 sentry.name =
327 sentry.key =
329 sentry.key =
328 sentry.public_key =
330 sentry.public_key =
329 sentry.secret_key =
331 sentry.secret_key =
330 sentry.project =
332 sentry.project =
331 sentry.site =
333 sentry.site =
332 sentry.include_paths =
334 sentry.include_paths =
333 sentry.exclude_paths =
335 sentry.exclude_paths =
334
336
335
337
336 ################################################################################
338 ################################################################################
337 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
339 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
338 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
340 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
339 ## execute malicious code after an exception is raised. ##
341 ## execute malicious code after an exception is raised. ##
340 ################################################################################
342 ################################################################################
341 set debug = false
343 set debug = false
342
344
343 ##################################
345 ##################################
344 ### LOGVIEW CONFIG ###
346 ### LOGVIEW CONFIG ###
345 ##################################
347 ##################################
346 logview.sqlalchemy = #faa
348 logview.sqlalchemy = #faa
347 logview.pylons.templating = #bfb
349 logview.pylons.templating = #bfb
348 logview.pylons.util = #eee
350 logview.pylons.util = #eee
349
351
350 #########################################################
352 #########################################################
351 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
353 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
352 #########################################################
354 #########################################################
353 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
355 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
354 sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
356 sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
355 sqlalchemy.db1.echo = false
357 sqlalchemy.db1.echo = false
356 sqlalchemy.db1.pool_recycle = 3600
358 sqlalchemy.db1.pool_recycle = 3600
357 sqlalchemy.db1.convert_unicode = true
359 sqlalchemy.db1.convert_unicode = true
358
360
359 ################################
361 ################################
360 ### LOGGING CONFIGURATION ####
362 ### LOGGING CONFIGURATION ####
361 ################################
363 ################################
362 [loggers]
364 [loggers]
363 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
365 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
364
366
365 [handlers]
367 [handlers]
366 keys = console, console_sql
368 keys = console, console_sql
367
369
368 [formatters]
370 [formatters]
369 keys = generic, color_formatter, color_formatter_sql
371 keys = generic, color_formatter, color_formatter_sql
370
372
371 #############
373 #############
372 ## LOGGERS ##
374 ## LOGGERS ##
373 #############
375 #############
374 [logger_root]
376 [logger_root]
375 level = NOTSET
377 level = NOTSET
376 handlers = console
378 handlers = console
377
379
378 [logger_routes]
380 [logger_routes]
379 level = DEBUG
381 level = DEBUG
380 handlers =
382 handlers =
381 qualname = routes.middleware
383 qualname = routes.middleware
382 # "level = DEBUG" logs the route matched and routing variables.
384 # "level = DEBUG" logs the route matched and routing variables.
383 propagate = 1
385 propagate = 1
384
386
385 [logger_beaker]
387 [logger_beaker]
386 level = DEBUG
388 level = DEBUG
387 handlers =
389 handlers =
388 qualname = beaker.container
390 qualname = beaker.container
389 propagate = 1
391 propagate = 1
390
392
391 [logger_templates]
393 [logger_templates]
392 level = INFO
394 level = INFO
393 handlers =
395 handlers =
394 qualname = pylons.templating
396 qualname = pylons.templating
395 propagate = 1
397 propagate = 1
396
398
397 [logger_rhodecode]
399 [logger_rhodecode]
398 level = DEBUG
400 level = DEBUG
399 handlers =
401 handlers =
400 qualname = rhodecode
402 qualname = rhodecode
401 propagate = 1
403 propagate = 1
402
404
403 [logger_sqlalchemy]
405 [logger_sqlalchemy]
404 level = INFO
406 level = INFO
405 handlers = console_sql
407 handlers = console_sql
406 qualname = sqlalchemy.engine
408 qualname = sqlalchemy.engine
407 propagate = 0
409 propagate = 0
408
410
409 [logger_whoosh_indexer]
411 [logger_whoosh_indexer]
410 level = DEBUG
412 level = DEBUG
411 handlers =
413 handlers =
412 qualname = whoosh_indexer
414 qualname = whoosh_indexer
413 propagate = 1
415 propagate = 1
414
416
415 ##############
417 ##############
416 ## HANDLERS ##
418 ## HANDLERS ##
417 ##############
419 ##############
418
420
419 [handler_console]
421 [handler_console]
420 class = StreamHandler
422 class = StreamHandler
421 args = (sys.stderr,)
423 args = (sys.stderr,)
422 level = INFO
424 level = INFO
423 formatter = generic
425 formatter = generic
424
426
425 [handler_console_sql]
427 [handler_console_sql]
426 class = StreamHandler
428 class = StreamHandler
427 args = (sys.stderr,)
429 args = (sys.stderr,)
428 level = WARN
430 level = WARN
429 formatter = generic
431 formatter = generic
430
432
431 ################
433 ################
432 ## FORMATTERS ##
434 ## FORMATTERS ##
433 ################
435 ################
434
436
435 [formatter_generic]
437 [formatter_generic]
436 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
438 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
437 datefmt = %Y-%m-%d %H:%M:%S
439 datefmt = %Y-%m-%d %H:%M:%S
438
440
439 [formatter_color_formatter]
441 [formatter_color_formatter]
440 class=rhodecode.lib.colored_formatter.ColorFormatter
442 class=rhodecode.lib.colored_formatter.ColorFormatter
441 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
443 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
442 datefmt = %Y-%m-%d %H:%M:%S
444 datefmt = %Y-%m-%d %H:%M:%S
443
445
444 [formatter_color_formatter_sql]
446 [formatter_color_formatter_sql]
445 class=rhodecode.lib.colored_formatter.ColorFormatterSql
447 class=rhodecode.lib.colored_formatter.ColorFormatterSql
446 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
448 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
447 datefmt = %Y-%m-%d %H:%M:%S
449 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,457 +1,459 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # RhodeCode - Pylons environment configuration #
3 # RhodeCode - Pylons environment configuration #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 pdebug = false
10 pdebug = false
11 ################################################################################
11 ################################################################################
12 ## Uncomment and replace with the address which should receive ##
12 ## Uncomment and replace with the address which should receive ##
13 ## any error reports after application crash ##
13 ## any error reports after application crash ##
14 ## Additionally those settings will be used by RhodeCode mailing system ##
14 ## Additionally those settings will be used by RhodeCode mailing system ##
15 ################################################################################
15 ################################################################################
16 #email_to = admin@localhost
16 #email_to = admin@localhost
17 #error_email_from = paste_error@localhost
17 #error_email_from = paste_error@localhost
18 #app_email_from = rhodecode-noreply@localhost
18 #app_email_from = rhodecode-noreply@localhost
19 #error_message =
19 #error_message =
20 #email_prefix = [RhodeCode]
20 #email_prefix = [RhodeCode]
21
21
22 #smtp_server = mail.server.com
22 #smtp_server = mail.server.com
23 #smtp_username =
23 #smtp_username =
24 #smtp_password =
24 #smtp_password =
25 #smtp_port =
25 #smtp_port =
26 #smtp_use_tls = false
26 #smtp_use_tls = false
27 #smtp_use_ssl = true
27 #smtp_use_ssl = true
28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
29 #smtp_auth =
29 #smtp_auth =
30
30
31 [server:main]
31 [server:main]
32 ## PASTE
32 ## PASTE
33 ##nr of threads to spawn
33 ##nr of threads to spawn
34 #threadpool_workers = 5
34 #threadpool_workers = 5
35
35
36 ##max request before thread respawn
36 ##max request before thread respawn
37 #threadpool_max_requests = 10
37 #threadpool_max_requests = 10
38
38
39 ##option to use threads of process
39 ##option to use threads of process
40 #use_threadpool = true
40 #use_threadpool = true
41
41
42 #use = egg:Paste#http
42 #use = egg:Paste#http
43
43
44 #WAITRESS
44 #WAITRESS
45 threads = 5
45 threads = 5
46 #100GB
46 #100GB
47 max_request_body_size = 107374182400
47 max_request_body_size = 107374182400
48 use = egg:waitress#main
48 use = egg:waitress#main
49
49
50 host = 127.0.0.1
50 host = 127.0.0.1
51 port = 5000
51 port = 5000
52
52
53 [filter:proxy-prefix]
53 [filter:proxy-prefix]
54 # prefix middleware for rc
54 # prefix middleware for rc
55 use = egg:PasteDeploy#prefix
55 use = egg:PasteDeploy#prefix
56 prefix = /<your-prefix>
56 prefix = /<your-prefix>
57
57
58 [app:main]
58 [app:main]
59 use = egg:rhodecode
59 use = egg:rhodecode
60 #filter-with = proxy-prefix
60 #filter-with = proxy-prefix
61 full_stack = true
61 full_stack = true
62 static_files = true
62 static_files = true
63 # Optional Languages
63 # Optional Languages
64 # en, fr, ja, pt_BR, zh_CN, zh_TW, pl
64 # en, fr, ja, pt_BR, zh_CN, zh_TW, pl
65 lang = en
65 lang = en
66 cache_dir = %(here)s/data
66 cache_dir = %(here)s/data
67 index_dir = %(here)s/data/index
67 index_dir = %(here)s/data/index
68 # set this path to use archive download cache
69 #archive_cache_dir = /tmp/rhodecode_tarballcache
68 app_instance_uuid = ${app_instance_uuid}
70 app_instance_uuid = ${app_instance_uuid}
69 cut_off_limit = 256000
71 cut_off_limit = 256000
70 vcs_full_cache = True
72 vcs_full_cache = True
71 # force https in RhodeCode, fixes https redirects, assumes it's always https
73 # force https in RhodeCode, fixes https redirects, assumes it's always https
72 force_https = false
74 force_https = false
73 # use Strict-Transport-Security headers
75 # use Strict-Transport-Security headers
74 use_htsts = false
76 use_htsts = false
75 commit_parse_limit = 50
77 commit_parse_limit = 50
76 # number of items displayed in lightweight dashboard before paginating
78 # number of items displayed in lightweight dashboard before paginating
77 dashboard_items = 100
79 dashboard_items = 100
78 use_gravatar = true
80 use_gravatar = true
79
81
80 # path to git executable
82 # path to git executable
81 git_path = git
83 git_path = git
82
84
83 ## RSS feed options
85 ## RSS feed options
84
86
85 rss_cut_off_limit = 256000
87 rss_cut_off_limit = 256000
86 rss_items_per_page = 10
88 rss_items_per_page = 10
87 rss_include_diff = false
89 rss_include_diff = false
88
90
89
91
90 ## alternative_gravatar_url allows you to use your own avatar server application
92 ## alternative_gravatar_url allows you to use your own avatar server application
91 ## the following parts of the URL will be replaced
93 ## the following parts of the URL will be replaced
92 ## {email} user email
94 ## {email} user email
93 ## {md5email} md5 hash of the user email (like at gravatar.com)
95 ## {md5email} md5 hash of the user email (like at gravatar.com)
94 ## {size} size of the image that is expected from the server application
96 ## {size} size of the image that is expected from the server application
95 ## {scheme} http/https from RhodeCode server
97 ## {scheme} http/https from RhodeCode server
96 ## {netloc} network location from RhodeCode server
98 ## {netloc} network location from RhodeCode server
97 #alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
99 #alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
98 #alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
100 #alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
99
101
100 container_auth_enabled = false
102 container_auth_enabled = false
101 proxypass_auth_enabled = false
103 proxypass_auth_enabled = false
102 ## default encoding used to convert from and to unicode
104 ## default encoding used to convert from and to unicode
103 ## can be also a comma seperated list of encoding in case of mixed encodings
105 ## can be also a comma seperated list of encoding in case of mixed encodings
104 default_encoding = utf8
106 default_encoding = utf8
105
107
106 ## overwrite schema of clone url
108 ## overwrite schema of clone url
107 ## available vars:
109 ## available vars:
108 ## scheme - http/https
110 ## scheme - http/https
109 ## user - current user
111 ## user - current user
110 ## pass - password
112 ## pass - password
111 ## netloc - network location
113 ## netloc - network location
112 ## path - usually repo_name
114 ## path - usually repo_name
113
115
114 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
116 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
115
117
116 ## issue tracking mapping for commits messages
118 ## issue tracking mapping for commits messages
117 ## comment out issue_pat, issue_server, issue_prefix to enable
119 ## comment out issue_pat, issue_server, issue_prefix to enable
118
120
119 ## pattern to get the issues from commit messages
121 ## pattern to get the issues from commit messages
120 ## default one used here is #<numbers> with a regex passive group for `#`
122 ## default one used here is #<numbers> with a regex passive group for `#`
121 ## {id} will be all groups matched from this pattern
123 ## {id} will be all groups matched from this pattern
122
124
123 issue_pat = (?:\s*#)(\d+)
125 issue_pat = (?:\s*#)(\d+)
124
126
125 ## server url to the issue, each {id} will be replaced with match
127 ## server url to the issue, each {id} will be replaced with match
126 ## fetched from the regex and {repo} is replaced with full repository name
128 ## fetched from the regex and {repo} is replaced with full repository name
127 ## including groups {repo_name} is replaced with just name of repo
129 ## including groups {repo_name} is replaced with just name of repo
128
130
129 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
131 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
130
132
131 ## prefix to add to link to indicate it's an url
133 ## prefix to add to link to indicate it's an url
132 ## #314 will be replaced by <issue_prefix><id>
134 ## #314 will be replaced by <issue_prefix><id>
133
135
134 issue_prefix = #
136 issue_prefix = #
135
137
136 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
138 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
137 ## multiple patterns, to other issues server, wiki or others
139 ## multiple patterns, to other issues server, wiki or others
138 ## below an example how to create a wiki pattern
140 ## below an example how to create a wiki pattern
139 # #wiki-some-id -> https://mywiki.com/some-id
141 # #wiki-some-id -> https://mywiki.com/some-id
140
142
141 #issue_pat_wiki = (?:wiki-)(.+)
143 #issue_pat_wiki = (?:wiki-)(.+)
142 #issue_server_link_wiki = https://mywiki.com/{id}
144 #issue_server_link_wiki = https://mywiki.com/{id}
143 #issue_prefix_wiki = WIKI-
145 #issue_prefix_wiki = WIKI-
144
146
145
147
146 ## instance-id prefix
148 ## instance-id prefix
147 ## a prefix key for this instance used for cache invalidation when running
149 ## a prefix key for this instance used for cache invalidation when running
148 ## multiple instances of rhodecode, make sure it's globally unique for
150 ## multiple instances of rhodecode, make sure it's globally unique for
149 ## all running rhodecode instances. Leave empty if you don't use it
151 ## all running rhodecode instances. Leave empty if you don't use it
150 instance_id =
152 instance_id =
151
153
152 ## alternative return HTTP header for failed authentication. Default HTTP
154 ## alternative return HTTP header for failed authentication. Default HTTP
153 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
155 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
154 ## handling that. Set this variable to 403 to return HTTPForbidden
156 ## handling that. Set this variable to 403 to return HTTPForbidden
155 auth_ret_code =
157 auth_ret_code =
156
158
157 ####################################
159 ####################################
158 ### CELERY CONFIG ####
160 ### CELERY CONFIG ####
159 ####################################
161 ####################################
160 use_celery = false
162 use_celery = false
161 broker.host = localhost
163 broker.host = localhost
162 broker.vhost = rabbitmqhost
164 broker.vhost = rabbitmqhost
163 broker.port = 5672
165 broker.port = 5672
164 broker.user = rabbitmq
166 broker.user = rabbitmq
165 broker.password = qweqwe
167 broker.password = qweqwe
166
168
167 celery.imports = rhodecode.lib.celerylib.tasks
169 celery.imports = rhodecode.lib.celerylib.tasks
168
170
169 celery.result.backend = amqp
171 celery.result.backend = amqp
170 celery.result.dburi = amqp://
172 celery.result.dburi = amqp://
171 celery.result.serialier = json
173 celery.result.serialier = json
172
174
173 #celery.send.task.error.emails = true
175 #celery.send.task.error.emails = true
174 #celery.amqp.task.result.expires = 18000
176 #celery.amqp.task.result.expires = 18000
175
177
176 celeryd.concurrency = 2
178 celeryd.concurrency = 2
177 #celeryd.log.file = celeryd.log
179 #celeryd.log.file = celeryd.log
178 celeryd.log.level = debug
180 celeryd.log.level = debug
179 celeryd.max.tasks.per.child = 1
181 celeryd.max.tasks.per.child = 1
180
182
181 #tasks will never be sent to the queue, but executed locally instead.
183 #tasks will never be sent to the queue, but executed locally instead.
182 celery.always.eager = false
184 celery.always.eager = false
183
185
184 ####################################
186 ####################################
185 ### BEAKER CACHE ####
187 ### BEAKER CACHE ####
186 ####################################
188 ####################################
187 beaker.cache.data_dir=%(here)s/data/cache/data
189 beaker.cache.data_dir=%(here)s/data/cache/data
188 beaker.cache.lock_dir=%(here)s/data/cache/lock
190 beaker.cache.lock_dir=%(here)s/data/cache/lock
189
191
190 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
192 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
191
193
192 beaker.cache.super_short_term.type=memory
194 beaker.cache.super_short_term.type=memory
193 beaker.cache.super_short_term.expire=10
195 beaker.cache.super_short_term.expire=10
194 beaker.cache.super_short_term.key_length = 256
196 beaker.cache.super_short_term.key_length = 256
195
197
196 beaker.cache.short_term.type=memory
198 beaker.cache.short_term.type=memory
197 beaker.cache.short_term.expire=60
199 beaker.cache.short_term.expire=60
198 beaker.cache.short_term.key_length = 256
200 beaker.cache.short_term.key_length = 256
199
201
200 beaker.cache.long_term.type=memory
202 beaker.cache.long_term.type=memory
201 beaker.cache.long_term.expire=36000
203 beaker.cache.long_term.expire=36000
202 beaker.cache.long_term.key_length = 256
204 beaker.cache.long_term.key_length = 256
203
205
204 beaker.cache.sql_cache_short.type=memory
206 beaker.cache.sql_cache_short.type=memory
205 beaker.cache.sql_cache_short.expire=10
207 beaker.cache.sql_cache_short.expire=10
206 beaker.cache.sql_cache_short.key_length = 256
208 beaker.cache.sql_cache_short.key_length = 256
207
209
208 beaker.cache.sql_cache_med.type=memory
210 beaker.cache.sql_cache_med.type=memory
209 beaker.cache.sql_cache_med.expire=360
211 beaker.cache.sql_cache_med.expire=360
210 beaker.cache.sql_cache_med.key_length = 256
212 beaker.cache.sql_cache_med.key_length = 256
211
213
212 beaker.cache.sql_cache_long.type=file
214 beaker.cache.sql_cache_long.type=file
213 beaker.cache.sql_cache_long.expire=3600
215 beaker.cache.sql_cache_long.expire=3600
214 beaker.cache.sql_cache_long.key_length = 256
216 beaker.cache.sql_cache_long.key_length = 256
215
217
216 ####################################
218 ####################################
217 ### BEAKER SESSION ####
219 ### BEAKER SESSION ####
218 ####################################
220 ####################################
219 ## Type of storage used for the session, current types are
221 ## Type of storage used for the session, current types are
220 ## dbm, file, memcached, database, and memory.
222 ## dbm, file, memcached, database, and memory.
221 ## The storage uses the Container API
223 ## The storage uses the Container API
222 ## that is also used by the cache system.
224 ## that is also used by the cache system.
223
225
224 ## db session ##
226 ## db session ##
225 #beaker.session.type = ext:database
227 #beaker.session.type = ext:database
226 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
228 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
227 #beaker.session.table_name = db_session
229 #beaker.session.table_name = db_session
228
230
229 ## encrypted cookie client side session, good for many instances ##
231 ## encrypted cookie client side session, good for many instances ##
230 #beaker.session.type = cookie
232 #beaker.session.type = cookie
231
233
232 ## file based cookies (default) ##
234 ## file based cookies (default) ##
233 #beaker.session.type = file
235 #beaker.session.type = file
234
236
235
237
236 beaker.session.key = rhodecode
238 beaker.session.key = rhodecode
237 ## secure cookie requires AES python libraries ##
239 ## secure cookie requires AES python libraries ##
238 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
240 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
239 #beaker.session.validate_key = 9712sds2212c--zxc123
241 #beaker.session.validate_key = 9712sds2212c--zxc123
240 ## sets session as invalid if it haven't been accessed for given amount of time
242 ## sets session as invalid if it haven't been accessed for given amount of time
241 beaker.session.timeout = 2592000
243 beaker.session.timeout = 2592000
242 beaker.session.httponly = true
244 beaker.session.httponly = true
243 #beaker.session.cookie_path = /<your-prefix>
245 #beaker.session.cookie_path = /<your-prefix>
244
246
245 ## uncomment for https secure cookie ##
247 ## uncomment for https secure cookie ##
246 beaker.session.secure = false
248 beaker.session.secure = false
247
249
248 ## auto save the session to not to use .save() ##
250 ## auto save the session to not to use .save() ##
249 beaker.session.auto = False
251 beaker.session.auto = False
250
252
251 ## default cookie expiration time in seconds `true` expire at browser close ##
253 ## default cookie expiration time in seconds `true` expire at browser close ##
252 #beaker.session.cookie_expires = 3600
254 #beaker.session.cookie_expires = 3600
253
255
254
256
255 ############################
257 ############################
256 ## ERROR HANDLING SYSTEMS ##
258 ## ERROR HANDLING SYSTEMS ##
257 ############################
259 ############################
258
260
259 ####################
261 ####################
260 ### [errormator] ###
262 ### [errormator] ###
261 ####################
263 ####################
262
264
263 # Errormator is tailored to work with RhodeCode, see
265 # Errormator is tailored to work with RhodeCode, see
264 # http://errormator.com for details how to obtain an account
266 # http://errormator.com for details how to obtain an account
265 # you must install python package `errormator_client` to make it work
267 # you must install python package `errormator_client` to make it work
266
268
267 # errormator enabled
269 # errormator enabled
268 errormator = true
270 errormator = true
269
271
270 errormator.server_url = https://api.errormator.com
272 errormator.server_url = https://api.errormator.com
271 errormator.api_key = YOUR_API_KEY
273 errormator.api_key = YOUR_API_KEY
272
274
273 # TWEAK AMOUNT OF INFO SENT HERE
275 # TWEAK AMOUNT OF INFO SENT HERE
274
276
275 # enables 404 error logging (default False)
277 # enables 404 error logging (default False)
276 errormator.report_404 = false
278 errormator.report_404 = false
277
279
278 # time in seconds after request is considered being slow (default 1)
280 # time in seconds after request is considered being slow (default 1)
279 errormator.slow_request_time = 1
281 errormator.slow_request_time = 1
280
282
281 # record slow requests in application
283 # record slow requests in application
282 # (needs to be enabled for slow datastore recording and time tracking)
284 # (needs to be enabled for slow datastore recording and time tracking)
283 errormator.slow_requests = true
285 errormator.slow_requests = true
284
286
285 # enable hooking to application loggers
287 # enable hooking to application loggers
286 # errormator.logging = true
288 # errormator.logging = true
287
289
288 # minimum log level for log capture
290 # minimum log level for log capture
289 # errormator.logging.level = WARNING
291 # errormator.logging.level = WARNING
290
292
291 # send logs only from erroneous/slow requests
293 # send logs only from erroneous/slow requests
292 # (saves API quota for intensive logging)
294 # (saves API quota for intensive logging)
293 errormator.logging_on_error = false
295 errormator.logging_on_error = false
294
296
295 # list of additonal keywords that should be grabbed from environ object
297 # list of additonal keywords that should be grabbed from environ object
296 # can be string with comma separated list of words in lowercase
298 # can be string with comma separated list of words in lowercase
297 # (by default client will always send following info:
299 # (by default client will always send following info:
298 # 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
300 # 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
299 # start with HTTP* this list be extended with additional keywords here
301 # start with HTTP* this list be extended with additional keywords here
300 errormator.environ_keys_whitelist =
302 errormator.environ_keys_whitelist =
301
303
302
304
303 # list of keywords that should be blanked from request object
305 # list of keywords that should be blanked from request object
304 # can be string with comma separated list of words in lowercase
306 # can be string with comma separated list of words in lowercase
305 # (by default client will always blank keys that contain following words
307 # (by default client will always blank keys that contain following words
306 # 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
308 # 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
307 # this list be extended with additional keywords set here
309 # this list be extended with additional keywords set here
308 errormator.request_keys_blacklist =
310 errormator.request_keys_blacklist =
309
311
310
312
311 # list of namespaces that should be ignores when gathering log entries
313 # list of namespaces that should be ignores when gathering log entries
312 # can be string with comma separated list of namespaces
314 # can be string with comma separated list of namespaces
313 # (by default the client ignores own entries: errormator_client.client)
315 # (by default the client ignores own entries: errormator_client.client)
314 errormator.log_namespace_blacklist =
316 errormator.log_namespace_blacklist =
315
317
316
318
317 ################
319 ################
318 ### [sentry] ###
320 ### [sentry] ###
319 ################
321 ################
320
322
321 # sentry is a alternative open source error aggregator
323 # sentry is a alternative open source error aggregator
322 # you must install python packages `sentry` and `raven` to enable
324 # you must install python packages `sentry` and `raven` to enable
323
325
324 sentry.dsn = YOUR_DNS
326 sentry.dsn = YOUR_DNS
325 sentry.servers =
327 sentry.servers =
326 sentry.name =
328 sentry.name =
327 sentry.key =
329 sentry.key =
328 sentry.public_key =
330 sentry.public_key =
329 sentry.secret_key =
331 sentry.secret_key =
330 sentry.project =
332 sentry.project =
331 sentry.site =
333 sentry.site =
332 sentry.include_paths =
334 sentry.include_paths =
333 sentry.exclude_paths =
335 sentry.exclude_paths =
334
336
335
337
336 ################################################################################
338 ################################################################################
337 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
339 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
338 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
340 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
339 ## execute malicious code after an exception is raised. ##
341 ## execute malicious code after an exception is raised. ##
340 ################################################################################
342 ################################################################################
341 set debug = false
343 set debug = false
342
344
343 ##################################
345 ##################################
344 ### LOGVIEW CONFIG ###
346 ### LOGVIEW CONFIG ###
345 ##################################
347 ##################################
346 logview.sqlalchemy = #faa
348 logview.sqlalchemy = #faa
347 logview.pylons.templating = #bfb
349 logview.pylons.templating = #bfb
348 logview.pylons.util = #eee
350 logview.pylons.util = #eee
349
351
350 #########################################################
352 #########################################################
351 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
353 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
352 #########################################################
354 #########################################################
353
355
354 # SQLITE [default]
356 # SQLITE [default]
355 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
357 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
356
358
357 # POSTGRESQL
359 # POSTGRESQL
358 # sqlalchemy.db1.url = postgresql://user:pass@localhost/rhodecode
360 # sqlalchemy.db1.url = postgresql://user:pass@localhost/rhodecode
359
361
360 # MySQL
362 # MySQL
361 # sqlalchemy.db1.url = mysql://user:pass@localhost/rhodecode
363 # sqlalchemy.db1.url = mysql://user:pass@localhost/rhodecode
362
364
363 # see sqlalchemy docs for others
365 # see sqlalchemy docs for others
364
366
365 sqlalchemy.db1.echo = false
367 sqlalchemy.db1.echo = false
366 sqlalchemy.db1.pool_recycle = 3600
368 sqlalchemy.db1.pool_recycle = 3600
367 sqlalchemy.db1.convert_unicode = true
369 sqlalchemy.db1.convert_unicode = true
368
370
369 ################################
371 ################################
370 ### LOGGING CONFIGURATION ####
372 ### LOGGING CONFIGURATION ####
371 ################################
373 ################################
372 [loggers]
374 [loggers]
373 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
375 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
374
376
375 [handlers]
377 [handlers]
376 keys = console, console_sql
378 keys = console, console_sql
377
379
378 [formatters]
380 [formatters]
379 keys = generic, color_formatter, color_formatter_sql
381 keys = generic, color_formatter, color_formatter_sql
380
382
381 #############
383 #############
382 ## LOGGERS ##
384 ## LOGGERS ##
383 #############
385 #############
384 [logger_root]
386 [logger_root]
385 level = NOTSET
387 level = NOTSET
386 handlers = console
388 handlers = console
387
389
388 [logger_routes]
390 [logger_routes]
389 level = DEBUG
391 level = DEBUG
390 handlers =
392 handlers =
391 qualname = routes.middleware
393 qualname = routes.middleware
392 # "level = DEBUG" logs the route matched and routing variables.
394 # "level = DEBUG" logs the route matched and routing variables.
393 propagate = 1
395 propagate = 1
394
396
395 [logger_beaker]
397 [logger_beaker]
396 level = DEBUG
398 level = DEBUG
397 handlers =
399 handlers =
398 qualname = beaker.container
400 qualname = beaker.container
399 propagate = 1
401 propagate = 1
400
402
401 [logger_templates]
403 [logger_templates]
402 level = INFO
404 level = INFO
403 handlers =
405 handlers =
404 qualname = pylons.templating
406 qualname = pylons.templating
405 propagate = 1
407 propagate = 1
406
408
407 [logger_rhodecode]
409 [logger_rhodecode]
408 level = DEBUG
410 level = DEBUG
409 handlers =
411 handlers =
410 qualname = rhodecode
412 qualname = rhodecode
411 propagate = 1
413 propagate = 1
412
414
413 [logger_sqlalchemy]
415 [logger_sqlalchemy]
414 level = INFO
416 level = INFO
415 handlers = console_sql
417 handlers = console_sql
416 qualname = sqlalchemy.engine
418 qualname = sqlalchemy.engine
417 propagate = 0
419 propagate = 0
418
420
419 [logger_whoosh_indexer]
421 [logger_whoosh_indexer]
420 level = DEBUG
422 level = DEBUG
421 handlers =
423 handlers =
422 qualname = whoosh_indexer
424 qualname = whoosh_indexer
423 propagate = 1
425 propagate = 1
424
426
425 ##############
427 ##############
426 ## HANDLERS ##
428 ## HANDLERS ##
427 ##############
429 ##############
428
430
429 [handler_console]
431 [handler_console]
430 class = StreamHandler
432 class = StreamHandler
431 args = (sys.stderr,)
433 args = (sys.stderr,)
432 level = INFO
434 level = INFO
433 formatter = generic
435 formatter = generic
434
436
435 [handler_console_sql]
437 [handler_console_sql]
436 class = StreamHandler
438 class = StreamHandler
437 args = (sys.stderr,)
439 args = (sys.stderr,)
438 level = WARN
440 level = WARN
439 formatter = generic
441 formatter = generic
440
442
441 ################
443 ################
442 ## FORMATTERS ##
444 ## FORMATTERS ##
443 ################
445 ################
444
446
445 [formatter_generic]
447 [formatter_generic]
446 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
448 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
447 datefmt = %Y-%m-%d %H:%M:%S
449 datefmt = %Y-%m-%d %H:%M:%S
448
450
449 [formatter_color_formatter]
451 [formatter_color_formatter]
450 class=rhodecode.lib.colored_formatter.ColorFormatter
452 class=rhodecode.lib.colored_formatter.ColorFormatter
451 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
453 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
452 datefmt = %Y-%m-%d %H:%M:%S
454 datefmt = %Y-%m-%d %H:%M:%S
453
455
454 [formatter_color_formatter_sql]
456 [formatter_color_formatter_sql]
455 class=rhodecode.lib.colored_formatter.ColorFormatterSql
457 class=rhodecode.lib.colored_formatter.ColorFormatterSql
456 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
458 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
457 datefmt = %Y-%m-%d %H:%M:%S
459 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,610 +1,641 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 rhodecode.controllers.files
3 rhodecode.controllers.files
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
5
6 Files controller for RhodeCode
6 Files controller for RhodeCode
7
7
8 :created_on: Apr 21, 2010
8 :created_on: Apr 21, 2010
9 :author: marcink
9 :author: marcink
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
11 :license: GPLv3, see COPYING for more details.
11 :license: GPLv3, see COPYING for more details.
12 """
12 """
13 # This program is free software: you can redistribute it and/or modify
13 # This program is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation, either version 3 of the License, or
15 # the Free Software Foundation, either version 3 of the License, or
16 # (at your option) any later version.
16 # (at your option) any later version.
17 #
17 #
18 # This program is distributed in the hope that it will be useful,
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
21 # GNU General Public License for more details.
22 #
22 #
23 # You should have received a copy of the GNU General Public License
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 from __future__ import with_statement
25 from __future__ import with_statement
26 import os
26 import os
27 import logging
27 import logging
28 import traceback
28 import traceback
29 import tempfile
29 import tempfile
30 import shutil
30
31
31 from pylons import request, response, tmpl_context as c, url
32 from pylons import request, response, tmpl_context as c, url
32 from pylons.i18n.translation import _
33 from pylons.i18n.translation import _
33 from pylons.controllers.util import redirect
34 from pylons.controllers.util import redirect
34 from rhodecode.lib.utils import jsonify
35 from rhodecode.lib.utils import jsonify
35
36
36 from rhodecode.lib import diffs
37 from rhodecode.lib import diffs
37 from rhodecode.lib import helpers as h
38 from rhodecode.lib import helpers as h
38
39
39 from rhodecode.lib.compat import OrderedDict
40 from rhodecode.lib.compat import OrderedDict
40 from rhodecode.lib.utils2 import convert_line_endings, detect_mode, safe_str,\
41 from rhodecode.lib.utils2 import convert_line_endings, detect_mode, safe_str,\
41 str2bool
42 str2bool
42 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
43 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
43 from rhodecode.lib.base import BaseRepoController, render
44 from rhodecode.lib.base import BaseRepoController, render
44 from rhodecode.lib.vcs.backends.base import EmptyChangeset
45 from rhodecode.lib.vcs.backends.base import EmptyChangeset
45 from rhodecode.lib.vcs.conf import settings
46 from rhodecode.lib.vcs.conf import settings
46 from rhodecode.lib.vcs.exceptions import RepositoryError, \
47 from rhodecode.lib.vcs.exceptions import RepositoryError, \
47 ChangesetDoesNotExistError, EmptyRepositoryError, \
48 ChangesetDoesNotExistError, EmptyRepositoryError, \
48 ImproperArchiveTypeError, VCSError, NodeAlreadyExistsError,\
49 ImproperArchiveTypeError, VCSError, NodeAlreadyExistsError,\
49 NodeDoesNotExistError, ChangesetError, NodeError
50 NodeDoesNotExistError, ChangesetError, NodeError
50 from rhodecode.lib.vcs.nodes import FileNode
51 from rhodecode.lib.vcs.nodes import FileNode
51
52
52 from rhodecode.model.repo import RepoModel
53 from rhodecode.model.repo import RepoModel
53 from rhodecode.model.scm import ScmModel
54 from rhodecode.model.scm import ScmModel
54 from rhodecode.model.db import Repository
55 from rhodecode.model.db import Repository
55
56
56 from rhodecode.controllers.changeset import anchor_url, _ignorews_url,\
57 from rhodecode.controllers.changeset import anchor_url, _ignorews_url,\
57 _context_url, get_line_ctx, get_ignore_ws
58 _context_url, get_line_ctx, get_ignore_ws
58
59
59
60
60 log = logging.getLogger(__name__)
61 log = logging.getLogger(__name__)
61
62
62
63
63 class FilesController(BaseRepoController):
64 class FilesController(BaseRepoController):
64
65
65 def __before__(self):
66 def __before__(self):
66 super(FilesController, self).__before__()
67 super(FilesController, self).__before__()
67 c.cut_off_limit = self.cut_off_limit
68 c.cut_off_limit = self.cut_off_limit
68
69
69 def __get_cs_or_redirect(self, rev, repo_name, redirect_after=True):
70 def __get_cs_or_redirect(self, rev, repo_name, redirect_after=True):
70 """
71 """
71 Safe way to get changeset if error occur it redirects to tip with
72 Safe way to get changeset if error occur it redirects to tip with
72 proper message
73 proper message
73
74
74 :param rev: revision to fetch
75 :param rev: revision to fetch
75 :param repo_name: repo name to redirect after
76 :param repo_name: repo name to redirect after
76 """
77 """
77
78
78 try:
79 try:
79 return c.rhodecode_repo.get_changeset(rev)
80 return c.rhodecode_repo.get_changeset(rev)
80 except EmptyRepositoryError, e:
81 except EmptyRepositoryError, e:
81 if not redirect_after:
82 if not redirect_after:
82 return None
83 return None
83 url_ = url('files_add_home',
84 url_ = url('files_add_home',
84 repo_name=c.repo_name,
85 repo_name=c.repo_name,
85 revision=0, f_path='')
86 revision=0, f_path='')
86 add_new = '<a href="%s">[%s]</a>' % (url_, _('click here to add new file'))
87 add_new = '<a href="%s">[%s]</a>' % (url_, _('click here to add new file'))
87 h.flash(h.literal(_('There are no files yet %s') % add_new),
88 h.flash(h.literal(_('There are no files yet %s') % add_new),
88 category='warning')
89 category='warning')
89 redirect(h.url('summary_home', repo_name=repo_name))
90 redirect(h.url('summary_home', repo_name=repo_name))
90
91
91 except RepositoryError, e:
92 except RepositoryError, e:
92 h.flash(str(e), category='warning')
93 h.flash(str(e), category='warning')
93 redirect(h.url('files_home', repo_name=repo_name, revision='tip'))
94 redirect(h.url('files_home', repo_name=repo_name, revision='tip'))
94
95
95 def __get_filenode_or_redirect(self, repo_name, cs, path):
96 def __get_filenode_or_redirect(self, repo_name, cs, path):
96 """
97 """
97 Returns file_node, if error occurs or given path is directory,
98 Returns file_node, if error occurs or given path is directory,
98 it'll redirect to top level path
99 it'll redirect to top level path
99
100
100 :param repo_name: repo_name
101 :param repo_name: repo_name
101 :param cs: given changeset
102 :param cs: given changeset
102 :param path: path to lookup
103 :param path: path to lookup
103 """
104 """
104
105
105 try:
106 try:
106 file_node = cs.get_node(path)
107 file_node = cs.get_node(path)
107 if file_node.is_dir():
108 if file_node.is_dir():
108 raise RepositoryError('given path is a directory')
109 raise RepositoryError('given path is a directory')
109 except RepositoryError, e:
110 except RepositoryError, e:
110 h.flash(str(e), category='warning')
111 h.flash(str(e), category='warning')
111 redirect(h.url('files_home', repo_name=repo_name,
112 redirect(h.url('files_home', repo_name=repo_name,
112 revision=cs.raw_id))
113 revision=cs.raw_id))
113
114
114 return file_node
115 return file_node
115
116
116 @LoginRequired()
117 @LoginRequired()
117 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
118 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
118 'repository.admin')
119 'repository.admin')
119 def index(self, repo_name, revision, f_path, annotate=False):
120 def index(self, repo_name, revision, f_path, annotate=False):
120 # redirect to given revision from form if given
121 # redirect to given revision from form if given
121 post_revision = request.POST.get('at_rev', None)
122 post_revision = request.POST.get('at_rev', None)
122 if post_revision:
123 if post_revision:
123 cs = self.__get_cs_or_redirect(post_revision, repo_name)
124 cs = self.__get_cs_or_redirect(post_revision, repo_name)
124 redirect(url('files_home', repo_name=c.repo_name,
125 redirect(url('files_home', repo_name=c.repo_name,
125 revision=cs.raw_id, f_path=f_path))
126 revision=cs.raw_id, f_path=f_path))
126
127
127 c.changeset = self.__get_cs_or_redirect(revision, repo_name)
128 c.changeset = self.__get_cs_or_redirect(revision, repo_name)
128 c.branch = request.GET.get('branch', None)
129 c.branch = request.GET.get('branch', None)
129 c.f_path = f_path
130 c.f_path = f_path
130 c.annotate = annotate
131 c.annotate = annotate
131 c.changeset = self.__get_cs_or_redirect(revision, repo_name)
132 c.changeset = self.__get_cs_or_redirect(revision, repo_name)
132 cur_rev = c.changeset.revision
133 cur_rev = c.changeset.revision
133
134
134 # prev link
135 # prev link
135 try:
136 try:
136 prev_rev = c.rhodecode_repo.get_changeset(cur_rev).prev(c.branch)
137 prev_rev = c.rhodecode_repo.get_changeset(cur_rev).prev(c.branch)
137 c.url_prev = url('files_home', repo_name=c.repo_name,
138 c.url_prev = url('files_home', repo_name=c.repo_name,
138 revision=prev_rev.raw_id, f_path=f_path)
139 revision=prev_rev.raw_id, f_path=f_path)
139 if c.branch:
140 if c.branch:
140 c.url_prev += '?branch=%s' % c.branch
141 c.url_prev += '?branch=%s' % c.branch
141 except (ChangesetDoesNotExistError, VCSError):
142 except (ChangesetDoesNotExistError, VCSError):
142 c.url_prev = '#'
143 c.url_prev = '#'
143
144
144 # next link
145 # next link
145 try:
146 try:
146 next_rev = c.rhodecode_repo.get_changeset(cur_rev).next(c.branch)
147 next_rev = c.rhodecode_repo.get_changeset(cur_rev).next(c.branch)
147 c.url_next = url('files_home', repo_name=c.repo_name,
148 c.url_next = url('files_home', repo_name=c.repo_name,
148 revision=next_rev.raw_id, f_path=f_path)
149 revision=next_rev.raw_id, f_path=f_path)
149 if c.branch:
150 if c.branch:
150 c.url_next += '?branch=%s' % c.branch
151 c.url_next += '?branch=%s' % c.branch
151 except (ChangesetDoesNotExistError, VCSError):
152 except (ChangesetDoesNotExistError, VCSError):
152 c.url_next = '#'
153 c.url_next = '#'
153
154
154 # files or dirs
155 # files or dirs
155 try:
156 try:
156 c.file = c.changeset.get_node(f_path)
157 c.file = c.changeset.get_node(f_path)
157
158
158 if c.file.is_file():
159 if c.file.is_file():
159 c.load_full_history = False
160 c.load_full_history = False
160 file_last_cs = c.file.last_changeset
161 file_last_cs = c.file.last_changeset
161 c.file_changeset = (c.changeset
162 c.file_changeset = (c.changeset
162 if c.changeset.revision < file_last_cs.revision
163 if c.changeset.revision < file_last_cs.revision
163 else file_last_cs)
164 else file_last_cs)
164 #determine if we're on branch head
165 #determine if we're on branch head
165 _branches = c.rhodecode_repo.branches
166 _branches = c.rhodecode_repo.branches
166 c.on_branch_head = revision in _branches.keys() + _branches.values()
167 c.on_branch_head = revision in _branches.keys() + _branches.values()
167 _hist = []
168 _hist = []
168 c.file_history = []
169 c.file_history = []
169 if c.load_full_history:
170 if c.load_full_history:
170 c.file_history, _hist = self._get_node_history(c.changeset, f_path)
171 c.file_history, _hist = self._get_node_history(c.changeset, f_path)
171
172
172 c.authors = []
173 c.authors = []
173 for a in set([x.author for x in _hist]):
174 for a in set([x.author for x in _hist]):
174 c.authors.append((h.email(a), h.person(a)))
175 c.authors.append((h.email(a), h.person(a)))
175 else:
176 else:
176 c.authors = c.file_history = []
177 c.authors = c.file_history = []
177 except RepositoryError, e:
178 except RepositoryError, e:
178 h.flash(str(e), category='warning')
179 h.flash(str(e), category='warning')
179 redirect(h.url('files_home', repo_name=repo_name,
180 redirect(h.url('files_home', repo_name=repo_name,
180 revision='tip'))
181 revision='tip'))
181
182
182 if request.environ.get('HTTP_X_PARTIAL_XHR'):
183 if request.environ.get('HTTP_X_PARTIAL_XHR'):
183 return render('files/files_ypjax.html')
184 return render('files/files_ypjax.html')
184
185
185 return render('files/files.html')
186 return render('files/files.html')
186
187
187 def history(self, repo_name, revision, f_path, annotate=False):
188 def history(self, repo_name, revision, f_path, annotate=False):
188 if request.environ.get('HTTP_X_PARTIAL_XHR'):
189 if request.environ.get('HTTP_X_PARTIAL_XHR'):
189 c.changeset = self.__get_cs_or_redirect(revision, repo_name)
190 c.changeset = self.__get_cs_or_redirect(revision, repo_name)
190 c.f_path = f_path
191 c.f_path = f_path
191 c.annotate = annotate
192 c.annotate = annotate
192 c.file = c.changeset.get_node(f_path)
193 c.file = c.changeset.get_node(f_path)
193 if c.file.is_file():
194 if c.file.is_file():
194 file_last_cs = c.file.last_changeset
195 file_last_cs = c.file.last_changeset
195 c.file_changeset = (c.changeset
196 c.file_changeset = (c.changeset
196 if c.changeset.revision < file_last_cs.revision
197 if c.changeset.revision < file_last_cs.revision
197 else file_last_cs)
198 else file_last_cs)
198 c.file_history, _hist = self._get_node_history(c.changeset, f_path)
199 c.file_history, _hist = self._get_node_history(c.changeset, f_path)
199 c.authors = []
200 c.authors = []
200 for a in set([x.author for x in _hist]):
201 for a in set([x.author for x in _hist]):
201 c.authors.append((h.email(a), h.person(a)))
202 c.authors.append((h.email(a), h.person(a)))
202 return render('files/files_history_box.html')
203 return render('files/files_history_box.html')
203
204
204 @LoginRequired()
205 @LoginRequired()
205 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
206 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
206 'repository.admin')
207 'repository.admin')
207 def rawfile(self, repo_name, revision, f_path):
208 def rawfile(self, repo_name, revision, f_path):
208 cs = self.__get_cs_or_redirect(revision, repo_name)
209 cs = self.__get_cs_or_redirect(revision, repo_name)
209 file_node = self.__get_filenode_or_redirect(repo_name, cs, f_path)
210 file_node = self.__get_filenode_or_redirect(repo_name, cs, f_path)
210
211
211 response.content_disposition = 'attachment; filename=%s' % \
212 response.content_disposition = 'attachment; filename=%s' % \
212 safe_str(f_path.split(Repository.url_sep())[-1])
213 safe_str(f_path.split(Repository.url_sep())[-1])
213
214
214 response.content_type = file_node.mimetype
215 response.content_type = file_node.mimetype
215 return file_node.content
216 return file_node.content
216
217
217 @LoginRequired()
218 @LoginRequired()
218 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
219 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
219 'repository.admin')
220 'repository.admin')
220 def raw(self, repo_name, revision, f_path):
221 def raw(self, repo_name, revision, f_path):
221 cs = self.__get_cs_or_redirect(revision, repo_name)
222 cs = self.__get_cs_or_redirect(revision, repo_name)
222 file_node = self.__get_filenode_or_redirect(repo_name, cs, f_path)
223 file_node = self.__get_filenode_or_redirect(repo_name, cs, f_path)
223
224
224 raw_mimetype_mapping = {
225 raw_mimetype_mapping = {
225 # map original mimetype to a mimetype used for "show as raw"
226 # map original mimetype to a mimetype used for "show as raw"
226 # you can also provide a content-disposition to override the
227 # you can also provide a content-disposition to override the
227 # default "attachment" disposition.
228 # default "attachment" disposition.
228 # orig_type: (new_type, new_dispo)
229 # orig_type: (new_type, new_dispo)
229
230
230 # show images inline:
231 # show images inline:
231 'image/x-icon': ('image/x-icon', 'inline'),
232 'image/x-icon': ('image/x-icon', 'inline'),
232 'image/png': ('image/png', 'inline'),
233 'image/png': ('image/png', 'inline'),
233 'image/gif': ('image/gif', 'inline'),
234 'image/gif': ('image/gif', 'inline'),
234 'image/jpeg': ('image/jpeg', 'inline'),
235 'image/jpeg': ('image/jpeg', 'inline'),
235 'image/svg+xml': ('image/svg+xml', 'inline'),
236 'image/svg+xml': ('image/svg+xml', 'inline'),
236 }
237 }
237
238
238 mimetype = file_node.mimetype
239 mimetype = file_node.mimetype
239 try:
240 try:
240 mimetype, dispo = raw_mimetype_mapping[mimetype]
241 mimetype, dispo = raw_mimetype_mapping[mimetype]
241 except KeyError:
242 except KeyError:
242 # we don't know anything special about this, handle it safely
243 # we don't know anything special about this, handle it safely
243 if file_node.is_binary:
244 if file_node.is_binary:
244 # do same as download raw for binary files
245 # do same as download raw for binary files
245 mimetype, dispo = 'application/octet-stream', 'attachment'
246 mimetype, dispo = 'application/octet-stream', 'attachment'
246 else:
247 else:
247 # do not just use the original mimetype, but force text/plain,
248 # do not just use the original mimetype, but force text/plain,
248 # otherwise it would serve text/html and that might be unsafe.
249 # otherwise it would serve text/html and that might be unsafe.
249 # Note: underlying vcs library fakes text/plain mimetype if the
250 # Note: underlying vcs library fakes text/plain mimetype if the
250 # mimetype can not be determined and it thinks it is not
251 # mimetype can not be determined and it thinks it is not
251 # binary.This might lead to erroneous text display in some
252 # binary.This might lead to erroneous text display in some
252 # cases, but helps in other cases, like with text files
253 # cases, but helps in other cases, like with text files
253 # without extension.
254 # without extension.
254 mimetype, dispo = 'text/plain', 'inline'
255 mimetype, dispo = 'text/plain', 'inline'
255
256
256 if dispo == 'attachment':
257 if dispo == 'attachment':
257 dispo = 'attachment; filename=%s' % \
258 dispo = 'attachment; filename=%s' % \
258 safe_str(f_path.split(os.sep)[-1])
259 safe_str(f_path.split(os.sep)[-1])
259
260
260 response.content_disposition = dispo
261 response.content_disposition = dispo
261 response.content_type = mimetype
262 response.content_type = mimetype
262 return file_node.content
263 return file_node.content
263
264
264 @LoginRequired()
265 @LoginRequired()
265 @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin')
266 @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin')
266 def edit(self, repo_name, revision, f_path):
267 def edit(self, repo_name, revision, f_path):
267 repo = c.rhodecode_db_repo
268 repo = c.rhodecode_db_repo
268 if repo.enable_locking and repo.locked[0]:
269 if repo.enable_locking and repo.locked[0]:
269 h.flash(_('This repository is has been locked by %s on %s')
270 h.flash(_('This repository is has been locked by %s on %s')
270 % (h.person_by_id(repo.locked[0]),
271 % (h.person_by_id(repo.locked[0]),
271 h.fmt_date(h.time_to_datetime(repo.locked[1]))),
272 h.fmt_date(h.time_to_datetime(repo.locked[1]))),
272 'warning')
273 'warning')
273 return redirect(h.url('files_home',
274 return redirect(h.url('files_home',
274 repo_name=repo_name, revision='tip'))
275 repo_name=repo_name, revision='tip'))
275
276
276 # check if revision is a branch identifier- basically we cannot
277 # check if revision is a branch identifier- basically we cannot
277 # create multiple heads via file editing
278 # create multiple heads via file editing
278 _branches = repo.scm_instance.branches
279 _branches = repo.scm_instance.branches
279 # check if revision is a branch name or branch hash
280 # check if revision is a branch name or branch hash
280 if revision not in _branches.keys() + _branches.values():
281 if revision not in _branches.keys() + _branches.values():
281 h.flash(_('You can only edit files with revision '
282 h.flash(_('You can only edit files with revision '
282 'being a valid branch '), category='warning')
283 'being a valid branch '), category='warning')
283 return redirect(h.url('files_home',
284 return redirect(h.url('files_home',
284 repo_name=repo_name, revision='tip',
285 repo_name=repo_name, revision='tip',
285 f_path=f_path))
286 f_path=f_path))
286
287
287 r_post = request.POST
288 r_post = request.POST
288
289
289 c.cs = self.__get_cs_or_redirect(revision, repo_name)
290 c.cs = self.__get_cs_or_redirect(revision, repo_name)
290 c.file = self.__get_filenode_or_redirect(repo_name, c.cs, f_path)
291 c.file = self.__get_filenode_or_redirect(repo_name, c.cs, f_path)
291
292
292 if c.file.is_binary:
293 if c.file.is_binary:
293 return redirect(url('files_home', repo_name=c.repo_name,
294 return redirect(url('files_home', repo_name=c.repo_name,
294 revision=c.cs.raw_id, f_path=f_path))
295 revision=c.cs.raw_id, f_path=f_path))
295 c.default_message = _('Edited file %s via RhodeCode') % (f_path)
296 c.default_message = _('Edited file %s via RhodeCode') % (f_path)
296 c.f_path = f_path
297 c.f_path = f_path
297
298
298 if r_post:
299 if r_post:
299
300
300 old_content = c.file.content
301 old_content = c.file.content
301 sl = old_content.splitlines(1)
302 sl = old_content.splitlines(1)
302 first_line = sl[0] if sl else ''
303 first_line = sl[0] if sl else ''
303 # modes: 0 - Unix, 1 - Mac, 2 - DOS
304 # modes: 0 - Unix, 1 - Mac, 2 - DOS
304 mode = detect_mode(first_line, 0)
305 mode = detect_mode(first_line, 0)
305 content = convert_line_endings(r_post.get('content'), mode)
306 content = convert_line_endings(r_post.get('content'), mode)
306
307
307 message = r_post.get('message') or c.default_message
308 message = r_post.get('message') or c.default_message
308 author = self.rhodecode_user.full_contact
309 author = self.rhodecode_user.full_contact
309
310
310 if content == old_content:
311 if content == old_content:
311 h.flash(_('No changes'),
312 h.flash(_('No changes'),
312 category='warning')
313 category='warning')
313 return redirect(url('changeset_home', repo_name=c.repo_name,
314 return redirect(url('changeset_home', repo_name=c.repo_name,
314 revision='tip'))
315 revision='tip'))
315 try:
316 try:
316 self.scm_model.commit_change(repo=c.rhodecode_repo,
317 self.scm_model.commit_change(repo=c.rhodecode_repo,
317 repo_name=repo_name, cs=c.cs,
318 repo_name=repo_name, cs=c.cs,
318 user=self.rhodecode_user.user_id,
319 user=self.rhodecode_user.user_id,
319 author=author, message=message,
320 author=author, message=message,
320 content=content, f_path=f_path)
321 content=content, f_path=f_path)
321 h.flash(_('Successfully committed to %s') % f_path,
322 h.flash(_('Successfully committed to %s') % f_path,
322 category='success')
323 category='success')
323
324
324 except Exception:
325 except Exception:
325 log.error(traceback.format_exc())
326 log.error(traceback.format_exc())
326 h.flash(_('Error occurred during commit'), category='error')
327 h.flash(_('Error occurred during commit'), category='error')
327 return redirect(url('changeset_home',
328 return redirect(url('changeset_home',
328 repo_name=c.repo_name, revision='tip'))
329 repo_name=c.repo_name, revision='tip'))
329
330
330 return render('files/files_edit.html')
331 return render('files/files_edit.html')
331
332
332 @LoginRequired()
333 @LoginRequired()
333 @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin')
334 @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin')
334 def add(self, repo_name, revision, f_path):
335 def add(self, repo_name, revision, f_path):
335
336
336 repo = Repository.get_by_repo_name(repo_name)
337 repo = Repository.get_by_repo_name(repo_name)
337 if repo.enable_locking and repo.locked[0]:
338 if repo.enable_locking and repo.locked[0]:
338 h.flash(_('This repository is has been locked by %s on %s')
339 h.flash(_('This repository is has been locked by %s on %s')
339 % (h.person_by_id(repo.locked[0]),
340 % (h.person_by_id(repo.locked[0]),
340 h.fmt_date(h.time_to_datetime(repo.locked[1]))),
341 h.fmt_date(h.time_to_datetime(repo.locked[1]))),
341 'warning')
342 'warning')
342 return redirect(h.url('files_home',
343 return redirect(h.url('files_home',
343 repo_name=repo_name, revision='tip'))
344 repo_name=repo_name, revision='tip'))
344
345
345 r_post = request.POST
346 r_post = request.POST
346 c.cs = self.__get_cs_or_redirect(revision, repo_name,
347 c.cs = self.__get_cs_or_redirect(revision, repo_name,
347 redirect_after=False)
348 redirect_after=False)
348 if c.cs is None:
349 if c.cs is None:
349 c.cs = EmptyChangeset(alias=c.rhodecode_repo.alias)
350 c.cs = EmptyChangeset(alias=c.rhodecode_repo.alias)
350 c.default_message = (_('Added file via RhodeCode'))
351 c.default_message = (_('Added file via RhodeCode'))
351 c.f_path = f_path
352 c.f_path = f_path
352
353
353 if r_post:
354 if r_post:
354 unix_mode = 0
355 unix_mode = 0
355 content = convert_line_endings(r_post.get('content'), unix_mode)
356 content = convert_line_endings(r_post.get('content'), unix_mode)
356
357
357 message = r_post.get('message') or c.default_message
358 message = r_post.get('message') or c.default_message
358 location = r_post.get('location')
359 location = r_post.get('location')
359 filename = r_post.get('filename')
360 filename = r_post.get('filename')
360 file_obj = r_post.get('upload_file', None)
361 file_obj = r_post.get('upload_file', None)
361
362
362 if file_obj is not None and hasattr(file_obj, 'filename'):
363 if file_obj is not None and hasattr(file_obj, 'filename'):
363 filename = file_obj.filename
364 filename = file_obj.filename
364 content = file_obj.file
365 content = file_obj.file
365
366
366 node_path = os.path.join(location, filename)
367 node_path = os.path.join(location, filename)
367 author = self.rhodecode_user.full_contact
368 author = self.rhodecode_user.full_contact
368
369
369 if not content:
370 if not content:
370 h.flash(_('No content'), category='warning')
371 h.flash(_('No content'), category='warning')
371 return redirect(url('changeset_home', repo_name=c.repo_name,
372 return redirect(url('changeset_home', repo_name=c.repo_name,
372 revision='tip'))
373 revision='tip'))
373 if not filename:
374 if not filename:
374 h.flash(_('No filename'), category='warning')
375 h.flash(_('No filename'), category='warning')
375 return redirect(url('changeset_home', repo_name=c.repo_name,
376 return redirect(url('changeset_home', repo_name=c.repo_name,
376 revision='tip'))
377 revision='tip'))
377
378
378 try:
379 try:
379 self.scm_model.create_node(repo=c.rhodecode_repo,
380 self.scm_model.create_node(repo=c.rhodecode_repo,
380 repo_name=repo_name, cs=c.cs,
381 repo_name=repo_name, cs=c.cs,
381 user=self.rhodecode_user.user_id,
382 user=self.rhodecode_user.user_id,
382 author=author, message=message,
383 author=author, message=message,
383 content=content, f_path=node_path)
384 content=content, f_path=node_path)
384 h.flash(_('Successfully committed to %s') % node_path,
385 h.flash(_('Successfully committed to %s') % node_path,
385 category='success')
386 category='success')
386 except NodeAlreadyExistsError, e:
387 except NodeAlreadyExistsError, e:
387 h.flash(_(e), category='error')
388 h.flash(_(e), category='error')
388 except Exception:
389 except Exception:
389 log.error(traceback.format_exc())
390 log.error(traceback.format_exc())
390 h.flash(_('Error occurred during commit'), category='error')
391 h.flash(_('Error occurred during commit'), category='error')
391 return redirect(url('changeset_home',
392 return redirect(url('changeset_home',
392 repo_name=c.repo_name, revision='tip'))
393 repo_name=c.repo_name, revision='tip'))
393
394
394 return render('files/files_add.html')
395 return render('files/files_add.html')
395
396
396 @LoginRequired()
397 @LoginRequired()
397 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
398 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
398 'repository.admin')
399 'repository.admin')
399 def archivefile(self, repo_name, fname):
400 def archivefile(self, repo_name, fname):
400
401
401 fileformat = None
402 fileformat = None
402 revision = None
403 revision = None
403 ext = None
404 ext = None
404 subrepos = request.GET.get('subrepos') == 'true'
405 subrepos = request.GET.get('subrepos') == 'true'
405
406
406 for a_type, ext_data in settings.ARCHIVE_SPECS.items():
407 for a_type, ext_data in settings.ARCHIVE_SPECS.items():
407 archive_spec = fname.split(ext_data[1])
408 archive_spec = fname.split(ext_data[1])
408 if len(archive_spec) == 2 and archive_spec[1] == '':
409 if len(archive_spec) == 2 and archive_spec[1] == '':
409 fileformat = a_type or ext_data[1]
410 fileformat = a_type or ext_data[1]
410 revision = archive_spec[0]
411 revision = archive_spec[0]
411 ext = ext_data[1]
412 ext = ext_data[1]
412
413
413 try:
414 try:
414 dbrepo = RepoModel().get_by_repo_name(repo_name)
415 dbrepo = RepoModel().get_by_repo_name(repo_name)
415 if dbrepo.enable_downloads is False:
416 if dbrepo.enable_downloads is False:
416 return _('downloads disabled')
417 return _('downloads disabled')
417
418
418 if c.rhodecode_repo.alias == 'hg':
419 if c.rhodecode_repo.alias == 'hg':
419 # patch and reset hooks section of UI config to not run any
420 # patch and reset hooks section of UI config to not run any
420 # hooks on fetching archives with subrepos
421 # hooks on fetching archives with subrepos
421 for k, v in c.rhodecode_repo._repo.ui.configitems('hooks'):
422 for k, v in c.rhodecode_repo._repo.ui.configitems('hooks'):
422 c.rhodecode_repo._repo.ui.setconfig('hooks', k, None)
423 c.rhodecode_repo._repo.ui.setconfig('hooks', k, None)
423
424
424 cs = c.rhodecode_repo.get_changeset(revision)
425 cs = c.rhodecode_repo.get_changeset(revision)
425 content_type = settings.ARCHIVE_SPECS[fileformat][0]
426 content_type = settings.ARCHIVE_SPECS[fileformat][0]
426 except ChangesetDoesNotExistError:
427 except ChangesetDoesNotExistError:
427 return _('Unknown revision %s') % revision
428 return _('Unknown revision %s') % revision
428 except EmptyRepositoryError:
429 except EmptyRepositoryError:
429 return _('Empty repository')
430 return _('Empty repository')
430 except (ImproperArchiveTypeError, KeyError):
431 except (ImproperArchiveTypeError, KeyError):
431 return _('Unknown archive type')
432 return _('Unknown archive type')
433 # archive cache
434 from rhodecode import CONFIG
435 rev_name = cs.raw_id[:12]
436 archive_name = '%s-%s%s' % (safe_str(repo_name.replace('/', '_')),
437 safe_str(rev_name), ext)
432
438
433 fd, archive = tempfile.mkstemp()
439 use_cached_archive = False # defines if we use cached version of archive
434 t = open(archive, 'wb')
440 archive_cache_enabled = CONFIG.get('archive_cache_dir')
435 cs.fill_archive(stream=t, kind=fileformat, subrepos=subrepos)
441 if not subrepos and archive_cache_enabled:
436 t.close()
442 #check if we it's ok to write
443 if not os.path.isdir(CONFIG['archive_cache_dir']):
444 os.makedirs(CONFIG['archive_cache_dir'])
445 cached_archive_path = os.path.join(CONFIG['archive_cache_dir'], archive_name)
446 if os.path.isfile(cached_archive_path):
447 log.debug('Found cached archive in %s' % cached_archive_path)
448 fd, archive = None, cached_archive_path
449 use_cached_archive = True
450 else:
451 log.debug('Archive %s is not yet cached' % (archive_name))
452
453 if not use_cached_archive:
454 #generate new archive
455 try:
456 fd, archive = tempfile.mkstemp()
457 t = open(archive, 'wb')
458 log.debug('Creating new temp archive in %s' % archive)
459 cs.fill_archive(stream=t, kind=fileformat, subrepos=subrepos)
460 if archive_cache_enabled:
461 #if we generated the archive and use cache rename that
462 log.debug('Storing new archive in %s' % cached_archive_path)
463 shutil.move(archive, cached_archive_path)
464 archive = cached_archive_path
465 finally:
466 t.close()
437
467
438 def get_chunked_archive(archive):
468 def get_chunked_archive(archive):
439 stream = open(archive, 'rb')
469 stream = open(archive, 'rb')
440 while True:
470 while True:
441 data = stream.read(16 * 1024)
471 data = stream.read(16 * 1024)
442 if not data:
472 if not data:
443 stream.close()
473 stream.close()
444 os.close(fd)
474 if fd: # fd means we used temporary file
445 os.remove(archive)
475 os.close(fd)
476 if not archive_cache_enabled:
477 log.debug('Destroing temp archive %s' % archive)
478 os.remove(archive)
446 break
479 break
447 yield data
480 yield data
448
481
449 response.content_disposition = str('attachment; filename=%s-%s%s' \
482 response.content_disposition = str('attachment; filename=%s' % (archive_name))
450 % (safe_str(repo_name),
451 safe_str(revision), ext))
452 response.content_type = str(content_type)
483 response.content_type = str(content_type)
453 return get_chunked_archive(archive)
484 return get_chunked_archive(archive)
454
485
455 @LoginRequired()
486 @LoginRequired()
456 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
487 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
457 'repository.admin')
488 'repository.admin')
458 def diff(self, repo_name, f_path):
489 def diff(self, repo_name, f_path):
459 ignore_whitespace = request.GET.get('ignorews') == '1'
490 ignore_whitespace = request.GET.get('ignorews') == '1'
460 line_context = request.GET.get('context', 3)
491 line_context = request.GET.get('context', 3)
461 diff1 = request.GET.get('diff1', '')
492 diff1 = request.GET.get('diff1', '')
462 diff2 = request.GET.get('diff2', '')
493 diff2 = request.GET.get('diff2', '')
463 c.action = request.GET.get('diff')
494 c.action = request.GET.get('diff')
464 c.no_changes = diff1 == diff2
495 c.no_changes = diff1 == diff2
465 c.f_path = f_path
496 c.f_path = f_path
466 c.big_diff = False
497 c.big_diff = False
467 c.anchor_url = anchor_url
498 c.anchor_url = anchor_url
468 c.ignorews_url = _ignorews_url
499 c.ignorews_url = _ignorews_url
469 c.context_url = _context_url
500 c.context_url = _context_url
470 c.changes = OrderedDict()
501 c.changes = OrderedDict()
471 c.changes[diff2] = []
502 c.changes[diff2] = []
472
503
473 #special case if we want a show rev only, it's impl here
504 #special case if we want a show rev only, it's impl here
474 #to reduce JS and callbacks
505 #to reduce JS and callbacks
475
506
476 if request.GET.get('show_rev'):
507 if request.GET.get('show_rev'):
477 if str2bool(request.GET.get('annotate', 'False')):
508 if str2bool(request.GET.get('annotate', 'False')):
478 _url = url('files_annotate_home', repo_name=c.repo_name,
509 _url = url('files_annotate_home', repo_name=c.repo_name,
479 revision=diff1, f_path=c.f_path)
510 revision=diff1, f_path=c.f_path)
480 else:
511 else:
481 _url = url('files_home', repo_name=c.repo_name,
512 _url = url('files_home', repo_name=c.repo_name,
482 revision=diff1, f_path=c.f_path)
513 revision=diff1, f_path=c.f_path)
483
514
484 return redirect(_url)
515 return redirect(_url)
485 try:
516 try:
486 if diff1 not in ['', None, 'None', '0' * 12, '0' * 40]:
517 if diff1 not in ['', None, 'None', '0' * 12, '0' * 40]:
487 c.changeset_1 = c.rhodecode_repo.get_changeset(diff1)
518 c.changeset_1 = c.rhodecode_repo.get_changeset(diff1)
488 try:
519 try:
489 node1 = c.changeset_1.get_node(f_path)
520 node1 = c.changeset_1.get_node(f_path)
490 if node1.is_dir():
521 if node1.is_dir():
491 raise NodeError('%s path is a %s not a file' % (node1, type(node1)))
522 raise NodeError('%s path is a %s not a file' % (node1, type(node1)))
492 except NodeDoesNotExistError:
523 except NodeDoesNotExistError:
493 c.changeset_1 = EmptyChangeset(cs=diff1,
524 c.changeset_1 = EmptyChangeset(cs=diff1,
494 revision=c.changeset_1.revision,
525 revision=c.changeset_1.revision,
495 repo=c.rhodecode_repo)
526 repo=c.rhodecode_repo)
496 node1 = FileNode(f_path, '', changeset=c.changeset_1)
527 node1 = FileNode(f_path, '', changeset=c.changeset_1)
497 else:
528 else:
498 c.changeset_1 = EmptyChangeset(repo=c.rhodecode_repo)
529 c.changeset_1 = EmptyChangeset(repo=c.rhodecode_repo)
499 node1 = FileNode(f_path, '', changeset=c.changeset_1)
530 node1 = FileNode(f_path, '', changeset=c.changeset_1)
500
531
501 if diff2 not in ['', None, 'None', '0' * 12, '0' * 40]:
532 if diff2 not in ['', None, 'None', '0' * 12, '0' * 40]:
502 c.changeset_2 = c.rhodecode_repo.get_changeset(diff2)
533 c.changeset_2 = c.rhodecode_repo.get_changeset(diff2)
503 try:
534 try:
504 node2 = c.changeset_2.get_node(f_path)
535 node2 = c.changeset_2.get_node(f_path)
505 raise NodeError('%s path is a %s not a file' % (node2, type(node2)))
536 raise NodeError('%s path is a %s not a file' % (node2, type(node2)))
506 except NodeDoesNotExistError:
537 except NodeDoesNotExistError:
507 c.changeset_2 = EmptyChangeset(cs=diff2,
538 c.changeset_2 = EmptyChangeset(cs=diff2,
508 revision=c.changeset_2.revision,
539 revision=c.changeset_2.revision,
509 repo=c.rhodecode_repo)
540 repo=c.rhodecode_repo)
510 node2 = FileNode(f_path, '', changeset=c.changeset_2)
541 node2 = FileNode(f_path, '', changeset=c.changeset_2)
511 else:
542 else:
512 c.changeset_2 = EmptyChangeset(repo=c.rhodecode_repo)
543 c.changeset_2 = EmptyChangeset(repo=c.rhodecode_repo)
513 node2 = FileNode(f_path, '', changeset=c.changeset_2)
544 node2 = FileNode(f_path, '', changeset=c.changeset_2)
514 except (RepositoryError, NodeError):
545 except (RepositoryError, NodeError):
515 log.error(traceback.format_exc())
546 log.error(traceback.format_exc())
516 return redirect(url('files_home', repo_name=c.repo_name,
547 return redirect(url('files_home', repo_name=c.repo_name,
517 f_path=f_path))
548 f_path=f_path))
518
549
519 if c.action == 'download':
550 if c.action == 'download':
520 _diff = diffs.get_gitdiff(node1, node2,
551 _diff = diffs.get_gitdiff(node1, node2,
521 ignore_whitespace=ignore_whitespace,
552 ignore_whitespace=ignore_whitespace,
522 context=line_context)
553 context=line_context)
523 diff = diffs.DiffProcessor(_diff, format='gitdiff')
554 diff = diffs.DiffProcessor(_diff, format='gitdiff')
524
555
525 diff_name = '%s_vs_%s.diff' % (diff1, diff2)
556 diff_name = '%s_vs_%s.diff' % (diff1, diff2)
526 response.content_type = 'text/plain'
557 response.content_type = 'text/plain'
527 response.content_disposition = (
558 response.content_disposition = (
528 'attachment; filename=%s' % diff_name
559 'attachment; filename=%s' % diff_name
529 )
560 )
530 return diff.as_raw()
561 return diff.as_raw()
531
562
532 elif c.action == 'raw':
563 elif c.action == 'raw':
533 _diff = diffs.get_gitdiff(node1, node2,
564 _diff = diffs.get_gitdiff(node1, node2,
534 ignore_whitespace=ignore_whitespace,
565 ignore_whitespace=ignore_whitespace,
535 context=line_context)
566 context=line_context)
536 diff = diffs.DiffProcessor(_diff, format='gitdiff')
567 diff = diffs.DiffProcessor(_diff, format='gitdiff')
537 response.content_type = 'text/plain'
568 response.content_type = 'text/plain'
538 return diff.as_raw()
569 return diff.as_raw()
539
570
540 else:
571 else:
541 fid = h.FID(diff2, node2.path)
572 fid = h.FID(diff2, node2.path)
542 line_context_lcl = get_line_ctx(fid, request.GET)
573 line_context_lcl = get_line_ctx(fid, request.GET)
543 ign_whitespace_lcl = get_ignore_ws(fid, request.GET)
574 ign_whitespace_lcl = get_ignore_ws(fid, request.GET)
544
575
545 lim = request.GET.get('fulldiff') or self.cut_off_limit
576 lim = request.GET.get('fulldiff') or self.cut_off_limit
546 _, cs1, cs2, diff, st = diffs.wrapped_diff(filenode_old=node1,
577 _, cs1, cs2, diff, st = diffs.wrapped_diff(filenode_old=node1,
547 filenode_new=node2,
578 filenode_new=node2,
548 cut_off_limit=lim,
579 cut_off_limit=lim,
549 ignore_whitespace=ign_whitespace_lcl,
580 ignore_whitespace=ign_whitespace_lcl,
550 line_context=line_context_lcl,
581 line_context=line_context_lcl,
551 enable_comments=False)
582 enable_comments=False)
552 op = ''
583 op = ''
553 filename = node1.path
584 filename = node1.path
554 cs_changes = {
585 cs_changes = {
555 'fid': [cs1, cs2, op, filename, diff, st]
586 'fid': [cs1, cs2, op, filename, diff, st]
556 }
587 }
557 c.changes = cs_changes
588 c.changes = cs_changes
558
589
559 return render('files/file_diff.html')
590 return render('files/file_diff.html')
560
591
561 def _get_node_history(self, cs, f_path, changesets=None):
592 def _get_node_history(self, cs, f_path, changesets=None):
562 """
593 """
563 get changesets history for given node
594 get changesets history for given node
564
595
565 :param cs: changeset to calculate history
596 :param cs: changeset to calculate history
566 :param f_path: path for node to calculate history for
597 :param f_path: path for node to calculate history for
567 :param changesets: if passed don't calculate history and take
598 :param changesets: if passed don't calculate history and take
568 changesets defined in this list
599 changesets defined in this list
569 """
600 """
570 # calculate history based on tip
601 # calculate history based on tip
571 tip_cs = c.rhodecode_repo.get_changeset()
602 tip_cs = c.rhodecode_repo.get_changeset()
572 if changesets is None:
603 if changesets is None:
573 try:
604 try:
574 changesets = tip_cs.get_file_history(f_path)
605 changesets = tip_cs.get_file_history(f_path)
575 except (NodeDoesNotExistError, ChangesetError):
606 except (NodeDoesNotExistError, ChangesetError):
576 #this node is not present at tip !
607 #this node is not present at tip !
577 changesets = cs.get_file_history(f_path)
608 changesets = cs.get_file_history(f_path)
578 hist_l = []
609 hist_l = []
579
610
580 changesets_group = ([], _("Changesets"))
611 changesets_group = ([], _("Changesets"))
581 branches_group = ([], _("Branches"))
612 branches_group = ([], _("Branches"))
582 tags_group = ([], _("Tags"))
613 tags_group = ([], _("Tags"))
583 _hg = cs.repository.alias == 'hg'
614 _hg = cs.repository.alias == 'hg'
584 for chs in changesets:
615 for chs in changesets:
585 #_branch = '(%s)' % chs.branch if _hg else ''
616 #_branch = '(%s)' % chs.branch if _hg else ''
586 _branch = chs.branch
617 _branch = chs.branch
587 n_desc = 'r%s:%s (%s)' % (chs.revision, chs.short_id, _branch)
618 n_desc = 'r%s:%s (%s)' % (chs.revision, chs.short_id, _branch)
588 changesets_group[0].append((chs.raw_id, n_desc,))
619 changesets_group[0].append((chs.raw_id, n_desc,))
589 hist_l.append(changesets_group)
620 hist_l.append(changesets_group)
590
621
591 for name, chs in c.rhodecode_repo.branches.items():
622 for name, chs in c.rhodecode_repo.branches.items():
592 branches_group[0].append((chs, name),)
623 branches_group[0].append((chs, name),)
593 hist_l.append(branches_group)
624 hist_l.append(branches_group)
594
625
595 for name, chs in c.rhodecode_repo.tags.items():
626 for name, chs in c.rhodecode_repo.tags.items():
596 tags_group[0].append((chs, name),)
627 tags_group[0].append((chs, name),)
597 hist_l.append(tags_group)
628 hist_l.append(tags_group)
598
629
599 return hist_l, changesets
630 return hist_l, changesets
600
631
601 @LoginRequired()
632 @LoginRequired()
602 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
633 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
603 'repository.admin')
634 'repository.admin')
604 @jsonify
635 @jsonify
605 def nodelist(self, repo_name, revision, f_path):
636 def nodelist(self, repo_name, revision, f_path):
606 if request.environ.get('HTTP_X_PARTIAL_XHR'):
637 if request.environ.get('HTTP_X_PARTIAL_XHR'):
607 cs = self.__get_cs_or_redirect(revision, repo_name)
638 cs = self.__get_cs_or_redirect(revision, repo_name)
608 _d, _f = ScmModel().get_nodes(repo_name, cs.raw_id, f_path,
639 _d, _f = ScmModel().get_nodes(repo_name, cs.raw_id, f_path,
609 flat=False)
640 flat=False)
610 return {'nodes': _d + _f}
641 return {'nodes': _d + _f}
@@ -1,437 +1,439 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # RhodeCode - Pylons environment configuration #
3 # RhodeCode - Pylons environment configuration #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 pdebug = false
10 pdebug = false
11 ################################################################################
11 ################################################################################
12 ## Uncomment and replace with the address which should receive ##
12 ## Uncomment and replace with the address which should receive ##
13 ## any error reports after application crash ##
13 ## any error reports after application crash ##
14 ## Additionally those settings will be used by RhodeCode mailing system ##
14 ## Additionally those settings will be used by RhodeCode mailing system ##
15 ################################################################################
15 ################################################################################
16 #email_to = admin@localhost
16 #email_to = admin@localhost
17 #error_email_from = paste_error@localhost
17 #error_email_from = paste_error@localhost
18 #app_email_from = rhodecode-noreply@localhost
18 #app_email_from = rhodecode-noreply@localhost
19 #error_message =
19 #error_message =
20 #email_prefix = [RhodeCode]
20 #email_prefix = [RhodeCode]
21
21
22 #smtp_server = mail.server.com
22 #smtp_server = mail.server.com
23 #smtp_username =
23 #smtp_username =
24 #smtp_password =
24 #smtp_password =
25 #smtp_port =
25 #smtp_port =
26 #smtp_use_tls = false
26 #smtp_use_tls = false
27 #smtp_use_ssl = true
27 #smtp_use_ssl = true
28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
29 #smtp_auth =
29 #smtp_auth =
30
30
31 [server:main]
31 [server:main]
32 ## PASTE
32 ## PASTE
33 ##nr of threads to spawn
33 ##nr of threads to spawn
34 #threadpool_workers = 5
34 #threadpool_workers = 5
35
35
36 ##max request before thread respawn
36 ##max request before thread respawn
37 #threadpool_max_requests = 10
37 #threadpool_max_requests = 10
38
38
39 ##option to use threads of process
39 ##option to use threads of process
40 #use_threadpool = true
40 #use_threadpool = true
41
41
42 #use = egg:Paste#http
42 #use = egg:Paste#http
43
43
44 #WAITRESS
44 #WAITRESS
45 threads = 5
45 threads = 5
46 #100GB
46 #100GB
47 max_request_body_size = 107374182400
47 max_request_body_size = 107374182400
48 use = egg:waitress#main
48 use = egg:waitress#main
49
49
50 host = 127.0.0.1
50 host = 127.0.0.1
51 port = 5000
51 port = 5000
52
52
53 [filter:proxy-prefix]
53 [filter:proxy-prefix]
54 # prefix middleware for rc
54 # prefix middleware for rc
55 use = egg:PasteDeploy#prefix
55 use = egg:PasteDeploy#prefix
56 prefix = /<your-prefix>
56 prefix = /<your-prefix>
57
57
58 [app:main]
58 [app:main]
59 use = egg:rhodecode
59 use = egg:rhodecode
60 #filter-with = proxy-prefix
60 #filter-with = proxy-prefix
61 full_stack = true
61 full_stack = true
62 static_files = true
62 static_files = true
63 # Optional Languages
63 # Optional Languages
64 # en, fr, ja, pt_BR, zh_CN, zh_TW, pl
64 # en, fr, ja, pt_BR, zh_CN, zh_TW, pl
65 lang = en
65 lang = en
66 cache_dir = /tmp/rc/data
66 cache_dir = /tmp/rc/data
67 index_dir = /tmp/rc/index
67 index_dir = /tmp/rc/index
68 # set this path to use archive download cache
69 #archive_cache_dir = /tmp/rhodecode_tarballcache
68 app_instance_uuid = develop-test
70 app_instance_uuid = develop-test
69 cut_off_limit = 256000
71 cut_off_limit = 256000
70 vcs_full_cache = False
72 vcs_full_cache = False
71 # force https in RhodeCode, fixes https redirects, assumes it's always https
73 # force https in RhodeCode, fixes https redirects, assumes it's always https
72 force_https = false
74 force_https = false
73 # use Strict-Transport-Security headers
75 # use Strict-Transport-Security headers
74 use_htsts = false
76 use_htsts = false
75 commit_parse_limit = 25
77 commit_parse_limit = 25
76 # number of items displayed in lightweight dashboard before paginating
78 # number of items displayed in lightweight dashboard before paginating
77 dashboard_items = 100
79 dashboard_items = 100
78 use_gravatar = true
80 use_gravatar = true
79
81
80 # path to git executable
82 # path to git executable
81 git_path = git
83 git_path = git
82
84
83 ## RSS feed options
85 ## RSS feed options
84
86
85 rss_cut_off_limit = 256000
87 rss_cut_off_limit = 256000
86 rss_items_per_page = 10
88 rss_items_per_page = 10
87 rss_include_diff = false
89 rss_include_diff = false
88
90
89
91
90 ## alternative_gravatar_url allows you to use your own avatar server application
92 ## alternative_gravatar_url allows you to use your own avatar server application
91 ## the following parts of the URL will be replaced
93 ## the following parts of the URL will be replaced
92 ## {email} user email
94 ## {email} user email
93 ## {md5email} md5 hash of the user email (like at gravatar.com)
95 ## {md5email} md5 hash of the user email (like at gravatar.com)
94 ## {size} size of the image that is expected from the server application
96 ## {size} size of the image that is expected from the server application
95 ## {scheme} http/https from RhodeCode server
97 ## {scheme} http/https from RhodeCode server
96 ## {netloc} network location from RhodeCode server
98 ## {netloc} network location from RhodeCode server
97 #alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
99 #alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
98 #alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
100 #alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
99
101
100 container_auth_enabled = false
102 container_auth_enabled = false
101 proxypass_auth_enabled = false
103 proxypass_auth_enabled = false
102 ## default encoding used to convert from and to unicode
104 ## default encoding used to convert from and to unicode
103 ## can be also a comma seperated list of encoding in case of mixed encodings
105 ## can be also a comma seperated list of encoding in case of mixed encodings
104 default_encoding = utf8
106 default_encoding = utf8
105
107
106 ## overwrite schema of clone url
108 ## overwrite schema of clone url
107 ## available vars:
109 ## available vars:
108 ## scheme - http/https
110 ## scheme - http/https
109 ## user - current user
111 ## user - current user
110 ## pass - password
112 ## pass - password
111 ## netloc - network location
113 ## netloc - network location
112 ## path - usually repo_name
114 ## path - usually repo_name
113
115
114 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
116 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
115
117
116 ## issue tracking mapping for commits messages
118 ## issue tracking mapping for commits messages
117 ## comment out issue_pat, issue_server, issue_prefix to enable
119 ## comment out issue_pat, issue_server, issue_prefix to enable
118
120
119 ## pattern to get the issues from commit messages
121 ## pattern to get the issues from commit messages
120 ## default one used here is #<numbers> with a regex passive group for `#`
122 ## default one used here is #<numbers> with a regex passive group for `#`
121 ## {id} will be all groups matched from this pattern
123 ## {id} will be all groups matched from this pattern
122
124
123 issue_pat = (?:\s*#)(\d+)
125 issue_pat = (?:\s*#)(\d+)
124
126
125 ## server url to the issue, each {id} will be replaced with match
127 ## server url to the issue, each {id} will be replaced with match
126 ## fetched from the regex and {repo} is replaced with full repository name
128 ## fetched from the regex and {repo} is replaced with full repository name
127 ## including groups {repo_name} is replaced with just name of repo
129 ## including groups {repo_name} is replaced with just name of repo
128
130
129 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
131 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
130
132
131 ## prefix to add to link to indicate it's an url
133 ## prefix to add to link to indicate it's an url
132 ## #314 will be replaced by <issue_prefix><id>
134 ## #314 will be replaced by <issue_prefix><id>
133
135
134 issue_prefix = #
136 issue_prefix = #
135
137
136 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
138 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
137 ## multiple patterns, to other issues server, wiki or others
139 ## multiple patterns, to other issues server, wiki or others
138 ## below an example how to create a wiki pattern
140 ## below an example how to create a wiki pattern
139 # #wiki-some-id -> https://mywiki.com/some-id
141 # #wiki-some-id -> https://mywiki.com/some-id
140
142
141 #issue_pat_wiki = (?:wiki-)(.+)
143 #issue_pat_wiki = (?:wiki-)(.+)
142 #issue_server_link_wiki = https://mywiki.com/{id}
144 #issue_server_link_wiki = https://mywiki.com/{id}
143 #issue_prefix_wiki = WIKI-
145 #issue_prefix_wiki = WIKI-
144
146
145
147
146 ## instance-id prefix
148 ## instance-id prefix
147 ## a prefix key for this instance used for cache invalidation when running
149 ## a prefix key for this instance used for cache invalidation when running
148 ## multiple instances of rhodecode, make sure it's globally unique for
150 ## multiple instances of rhodecode, make sure it's globally unique for
149 ## all running rhodecode instances. Leave empty if you don't use it
151 ## all running rhodecode instances. Leave empty if you don't use it
150 instance_id =
152 instance_id =
151
153
152 ## alternative return HTTP header for failed authentication. Default HTTP
154 ## alternative return HTTP header for failed authentication. Default HTTP
153 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
155 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
154 ## handling that. Set this variable to 403 to return HTTPForbidden
156 ## handling that. Set this variable to 403 to return HTTPForbidden
155 auth_ret_code =
157 auth_ret_code =
156
158
157 ####################################
159 ####################################
158 ### CELERY CONFIG ####
160 ### CELERY CONFIG ####
159 ####################################
161 ####################################
160 use_celery = false
162 use_celery = false
161 broker.host = localhost
163 broker.host = localhost
162 broker.vhost = rabbitmqhost
164 broker.vhost = rabbitmqhost
163 broker.port = 5672
165 broker.port = 5672
164 broker.user = rabbitmq
166 broker.user = rabbitmq
165 broker.password = qweqwe
167 broker.password = qweqwe
166
168
167 celery.imports = rhodecode.lib.celerylib.tasks
169 celery.imports = rhodecode.lib.celerylib.tasks
168
170
169 celery.result.backend = amqp
171 celery.result.backend = amqp
170 celery.result.dburi = amqp://
172 celery.result.dburi = amqp://
171 celery.result.serialier = json
173 celery.result.serialier = json
172
174
173 #celery.send.task.error.emails = true
175 #celery.send.task.error.emails = true
174 #celery.amqp.task.result.expires = 18000
176 #celery.amqp.task.result.expires = 18000
175
177
176 celeryd.concurrency = 2
178 celeryd.concurrency = 2
177 #celeryd.log.file = celeryd.log
179 #celeryd.log.file = celeryd.log
178 celeryd.log.level = debug
180 celeryd.log.level = debug
179 celeryd.max.tasks.per.child = 1
181 celeryd.max.tasks.per.child = 1
180
182
181 #tasks will never be sent to the queue, but executed locally instead.
183 #tasks will never be sent to the queue, but executed locally instead.
182 celery.always.eager = false
184 celery.always.eager = false
183
185
184 ####################################
186 ####################################
185 ### BEAKER CACHE ####
187 ### BEAKER CACHE ####
186 ####################################
188 ####################################
187 beaker.cache.data_dir=/tmp/rc/data/cache/data
189 beaker.cache.data_dir=/tmp/rc/data/cache/data
188 beaker.cache.lock_dir=/tmp/rc/data/cache/lock
190 beaker.cache.lock_dir=/tmp/rc/data/cache/lock
189
191
190 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
192 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
191
193
192 beaker.cache.super_short_term.type=memory
194 beaker.cache.super_short_term.type=memory
193 beaker.cache.super_short_term.expire=1
195 beaker.cache.super_short_term.expire=1
194 beaker.cache.super_short_term.key_length = 256
196 beaker.cache.super_short_term.key_length = 256
195
197
196 beaker.cache.short_term.type=memory
198 beaker.cache.short_term.type=memory
197 beaker.cache.short_term.expire=60
199 beaker.cache.short_term.expire=60
198 beaker.cache.short_term.key_length = 256
200 beaker.cache.short_term.key_length = 256
199
201
200 beaker.cache.long_term.type=memory
202 beaker.cache.long_term.type=memory
201 beaker.cache.long_term.expire=36000
203 beaker.cache.long_term.expire=36000
202 beaker.cache.long_term.key_length = 256
204 beaker.cache.long_term.key_length = 256
203
205
204 beaker.cache.sql_cache_short.type=memory
206 beaker.cache.sql_cache_short.type=memory
205 beaker.cache.sql_cache_short.expire=1
207 beaker.cache.sql_cache_short.expire=1
206 beaker.cache.sql_cache_short.key_length = 256
208 beaker.cache.sql_cache_short.key_length = 256
207
209
208 beaker.cache.sql_cache_med.type=memory
210 beaker.cache.sql_cache_med.type=memory
209 beaker.cache.sql_cache_med.expire=360
211 beaker.cache.sql_cache_med.expire=360
210 beaker.cache.sql_cache_med.key_length = 256
212 beaker.cache.sql_cache_med.key_length = 256
211
213
212 beaker.cache.sql_cache_long.type=file
214 beaker.cache.sql_cache_long.type=file
213 beaker.cache.sql_cache_long.expire=3600
215 beaker.cache.sql_cache_long.expire=3600
214 beaker.cache.sql_cache_long.key_length = 256
216 beaker.cache.sql_cache_long.key_length = 256
215
217
216 ####################################
218 ####################################
217 ### BEAKER SESSION ####
219 ### BEAKER SESSION ####
218 ####################################
220 ####################################
219 ## Type of storage used for the session, current types are
221 ## Type of storage used for the session, current types are
220 ## dbm, file, memcached, database, and memory.
222 ## dbm, file, memcached, database, and memory.
221 ## The storage uses the Container API
223 ## The storage uses the Container API
222 ## that is also used by the cache system.
224 ## that is also used by the cache system.
223
225
224 ## db session ##
226 ## db session ##
225 #beaker.session.type = ext:database
227 #beaker.session.type = ext:database
226 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
228 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
227 #beaker.session.table_name = db_session
229 #beaker.session.table_name = db_session
228
230
229 ## encrypted cookie client side session, good for many instances ##
231 ## encrypted cookie client side session, good for many instances ##
230 #beaker.session.type = cookie
232 #beaker.session.type = cookie
231
233
232 ## file based cookies (default) ##
234 ## file based cookies (default) ##
233 #beaker.session.type = file
235 #beaker.session.type = file
234
236
235
237
236 beaker.session.key = rhodecode
238 beaker.session.key = rhodecode
237 ## secure cookie requires AES python libraries ##
239 ## secure cookie requires AES python libraries ##
238 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
240 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
239 #beaker.session.validate_key = 9712sds2212c--zxc123
241 #beaker.session.validate_key = 9712sds2212c--zxc123
240 ## sets session as invalid if it haven't been accessed for given amount of time
242 ## sets session as invalid if it haven't been accessed for given amount of time
241 beaker.session.timeout = 3600
243 beaker.session.timeout = 3600
242 beaker.session.httponly = true
244 beaker.session.httponly = true
243 #beaker.session.cookie_path = /<your-prefix>
245 #beaker.session.cookie_path = /<your-prefix>
244
246
245 ## uncomment for https secure cookie ##
247 ## uncomment for https secure cookie ##
246 beaker.session.secure = false
248 beaker.session.secure = false
247
249
248 ## auto save the session to not to use .save() ##
250 ## auto save the session to not to use .save() ##
249 beaker.session.auto = False
251 beaker.session.auto = False
250
252
251 ## default cookie expiration time in seconds `true` expire at browser close ##
253 ## default cookie expiration time in seconds `true` expire at browser close ##
252 #beaker.session.cookie_expires = 3600
254 #beaker.session.cookie_expires = 3600
253
255
254
256
255 ############################
257 ############################
256 ## ERROR HANDLING SYSTEMS ##
258 ## ERROR HANDLING SYSTEMS ##
257 ############################
259 ############################
258
260
259 ####################
261 ####################
260 ### [errormator] ###
262 ### [errormator] ###
261 ####################
263 ####################
262
264
263 # Errormator is tailored to work with RhodeCode, see
265 # Errormator is tailored to work with RhodeCode, see
264 # http://errormator.com for details how to obtain an account
266 # http://errormator.com for details how to obtain an account
265 # you must install python package `errormator_client` to make it work
267 # you must install python package `errormator_client` to make it work
266
268
267 # errormator enabled
269 # errormator enabled
268 errormator = true
270 errormator = true
269
271
270 errormator.server_url = https://api.errormator.com
272 errormator.server_url = https://api.errormator.com
271 errormator.api_key = YOUR_API_KEY
273 errormator.api_key = YOUR_API_KEY
272
274
273 # TWEAK AMOUNT OF INFO SENT HERE
275 # TWEAK AMOUNT OF INFO SENT HERE
274
276
275 # enables 404 error logging (default False)
277 # enables 404 error logging (default False)
276 errormator.report_404 = false
278 errormator.report_404 = false
277
279
278 # time in seconds after request is considered being slow (default 1)
280 # time in seconds after request is considered being slow (default 1)
279 errormator.slow_request_time = 1
281 errormator.slow_request_time = 1
280
282
281 # record slow requests in application
283 # record slow requests in application
282 # (needs to be enabled for slow datastore recording and time tracking)
284 # (needs to be enabled for slow datastore recording and time tracking)
283 errormator.slow_requests = true
285 errormator.slow_requests = true
284
286
285 # enable hooking to application loggers
287 # enable hooking to application loggers
286 # errormator.logging = true
288 # errormator.logging = true
287
289
288 # minimum log level for log capture
290 # minimum log level for log capture
289 # errormator.logging.level = WARNING
291 # errormator.logging.level = WARNING
290
292
291 # send logs only from erroneous/slow requests
293 # send logs only from erroneous/slow requests
292 # (saves API quota for intensive logging)
294 # (saves API quota for intensive logging)
293 errormator.logging_on_error = false
295 errormator.logging_on_error = false
294
296
295 # list of additonal keywords that should be grabbed from environ object
297 # list of additonal keywords that should be grabbed from environ object
296 # can be string with comma separated list of words in lowercase
298 # can be string with comma separated list of words in lowercase
297 # (by default client will always send following info:
299 # (by default client will always send following info:
298 # 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
300 # 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
299 # start with HTTP* this list be extended with additional keywords here
301 # start with HTTP* this list be extended with additional keywords here
300 errormator.environ_keys_whitelist =
302 errormator.environ_keys_whitelist =
301
303
302
304
303 # list of keywords that should be blanked from request object
305 # list of keywords that should be blanked from request object
304 # can be string with comma separated list of words in lowercase
306 # can be string with comma separated list of words in lowercase
305 # (by default client will always blank keys that contain following words
307 # (by default client will always blank keys that contain following words
306 # 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
308 # 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
307 # this list be extended with additional keywords set here
309 # this list be extended with additional keywords set here
308 errormator.request_keys_blacklist =
310 errormator.request_keys_blacklist =
309
311
310
312
311 # list of namespaces that should be ignores when gathering log entries
313 # list of namespaces that should be ignores when gathering log entries
312 # can be string with comma separated list of namespaces
314 # can be string with comma separated list of namespaces
313 # (by default the client ignores own entries: errormator_client.client)
315 # (by default the client ignores own entries: errormator_client.client)
314 errormator.log_namespace_blacklist =
316 errormator.log_namespace_blacklist =
315
317
316
318
317 ################
319 ################
318 ### [sentry] ###
320 ### [sentry] ###
319 ################
321 ################
320
322
321 # sentry is a alternative open source error aggregator
323 # sentry is a alternative open source error aggregator
322 # you must install python packages `sentry` and `raven` to enable
324 # you must install python packages `sentry` and `raven` to enable
323
325
324 sentry.dsn = YOUR_DNS
326 sentry.dsn = YOUR_DNS
325 sentry.servers =
327 sentry.servers =
326 sentry.name =
328 sentry.name =
327 sentry.key =
329 sentry.key =
328 sentry.public_key =
330 sentry.public_key =
329 sentry.secret_key =
331 sentry.secret_key =
330 sentry.project =
332 sentry.project =
331 sentry.site =
333 sentry.site =
332 sentry.include_paths =
334 sentry.include_paths =
333 sentry.exclude_paths =
335 sentry.exclude_paths =
334
336
335
337
336 ################################################################################
338 ################################################################################
337 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
339 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
338 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
340 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
339 ## execute malicious code after an exception is raised. ##
341 ## execute malicious code after an exception is raised. ##
340 ################################################################################
342 ################################################################################
341 set debug = false
343 set debug = false
342
344
343 ##################################
345 ##################################
344 ### LOGVIEW CONFIG ###
346 ### LOGVIEW CONFIG ###
345 ##################################
347 ##################################
346 logview.sqlalchemy = #faa
348 logview.sqlalchemy = #faa
347 logview.pylons.templating = #bfb
349 logview.pylons.templating = #bfb
348 logview.pylons.util = #eee
350 logview.pylons.util = #eee
349
351
350 #########################################################
352 #########################################################
351 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
353 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
352 #########################################################
354 #########################################################
353 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode_test.sqlite
355 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode_test.sqlite
354 #sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode_test
356 #sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode_test
355 #sqlalchemy.db1.url = mysql://root:qwe@localhost/rhodecode_test
357 #sqlalchemy.db1.url = mysql://root:qwe@localhost/rhodecode_test
356 sqlalchemy.db1.echo = false
358 sqlalchemy.db1.echo = false
357 sqlalchemy.db1.pool_recycle = 3600
359 sqlalchemy.db1.pool_recycle = 3600
358 sqlalchemy.db1.convert_unicode = true
360 sqlalchemy.db1.convert_unicode = true
359
361
360 ################################
362 ################################
361 ### LOGGING CONFIGURATION ####
363 ### LOGGING CONFIGURATION ####
362 ################################
364 ################################
363 [loggers]
365 [loggers]
364 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
366 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
365
367
366 [handlers]
368 [handlers]
367 keys = console
369 keys = console
368
370
369 [formatters]
371 [formatters]
370 keys = generic, color_formatter
372 keys = generic, color_formatter
371
373
372 #############
374 #############
373 ## LOGGERS ##
375 ## LOGGERS ##
374 #############
376 #############
375 [logger_root]
377 [logger_root]
376 level = DEBUG
378 level = DEBUG
377 handlers = console
379 handlers = console
378
380
379 [logger_routes]
381 [logger_routes]
380 level = DEBUG
382 level = DEBUG
381 handlers =
383 handlers =
382 qualname = routes.middleware
384 qualname = routes.middleware
383 # "level = DEBUG" logs the route matched and routing variables.
385 # "level = DEBUG" logs the route matched and routing variables.
384 propagate = 1
386 propagate = 1
385
387
386 [logger_beaker]
388 [logger_beaker]
387 level = DEBUG
389 level = DEBUG
388 handlers =
390 handlers =
389 qualname = beaker.container
391 qualname = beaker.container
390 propagate = 1
392 propagate = 1
391
393
392 [logger_templates]
394 [logger_templates]
393 level = INFO
395 level = INFO
394 handlers =
396 handlers =
395 qualname = pylons.templating
397 qualname = pylons.templating
396 propagate = 1
398 propagate = 1
397
399
398 [logger_rhodecode]
400 [logger_rhodecode]
399 level = DEBUG
401 level = DEBUG
400 handlers =
402 handlers =
401 qualname = rhodecode
403 qualname = rhodecode
402 propagate = 1
404 propagate = 1
403
405
404 [logger_sqlalchemy]
406 [logger_sqlalchemy]
405 level = ERROR
407 level = ERROR
406 handlers = console
408 handlers = console
407 qualname = sqlalchemy.engine
409 qualname = sqlalchemy.engine
408 propagate = 0
410 propagate = 0
409
411
410 [logger_whoosh_indexer]
412 [logger_whoosh_indexer]
411 level = DEBUG
413 level = DEBUG
412 handlers =
414 handlers =
413 qualname = whoosh_indexer
415 qualname = whoosh_indexer
414 propagate = 1
416 propagate = 1
415
417
416 ##############
418 ##############
417 ## HANDLERS ##
419 ## HANDLERS ##
418 ##############
420 ##############
419
421
420 [handler_console]
422 [handler_console]
421 class = StreamHandler
423 class = StreamHandler
422 args = (sys.stderr,)
424 args = (sys.stderr,)
423 level = NOTSET
425 level = NOTSET
424 formatter = generic
426 formatter = generic
425
427
426 ################
428 ################
427 ## FORMATTERS ##
429 ## FORMATTERS ##
428 ################
430 ################
429
431
430 [formatter_generic]
432 [formatter_generic]
431 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
433 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
432 datefmt = %Y-%m-%d %H:%M:%S
434 datefmt = %Y-%m-%d %H:%M:%S
433
435
434 [formatter_color_formatter]
436 [formatter_color_formatter]
435 class=rhodecode.lib.colored_formatter.ColorFormatter
437 class=rhodecode.lib.colored_formatter.ColorFormatter
436 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
438 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
437 datefmt = %Y-%m-%d %H:%M:%S
439 datefmt = %Y-%m-%d %H:%M:%S
General Comments 0
You need to be logged in to leave comments. Login now