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