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