##// END OF EJS Templates
ini: set 'debug' only in one place...
Thomas De Schampheleire -
r6526:fc6b1b0e default
parent child Browse files
Show More
@@ -1,615 +1,614 b''
1 1 ################################################################################
2 2 ################################################################################
3 3 # Kallithea - Development config: #
4 4 # listening on *:5000 #
5 5 # sqlite and kallithea.db #
6 6 # initial_repo_scan = true #
7 # set debug = true #
7 # debug = true #
8 8 # verbose and colorful logging #
9 9 # #
10 10 # The %(here)s variable will be replaced with the parent directory of this file#
11 11 ################################################################################
12 12 ################################################################################
13 13
14 14 [DEFAULT]
15 debug = true
16 15
17 16 ################################################################################
18 17 ## Email settings ##
19 18 ## ##
20 19 ## Refer to the documentation ("Email settings") for more details. ##
21 20 ## ##
22 21 ## It is recommended to use a valid sender address that passes access ##
23 22 ## validation and spam filtering in mail servers. ##
24 23 ################################################################################
25 24
26 25 ## 'From' header for application emails. You can optionally add a name.
27 26 ## Default:
28 27 #app_email_from = Kallithea
29 28 ## Examples:
30 29 #app_email_from = Kallithea <kallithea-noreply@example.com>
31 30 #app_email_from = kallithea-noreply@example.com
32 31
33 32 ## Subject prefix for application emails.
34 33 ## A space between this prefix and the real subject is automatically added.
35 34 ## Default:
36 35 #email_prefix =
37 36 ## Example:
38 37 #email_prefix = [Kallithea]
39 38
40 39 ## Recipients for error emails and fallback recipients of application mails.
41 40 ## Multiple addresses can be specified, space-separated.
42 41 ## Only addresses are allowed, do not add any name part.
43 42 ## Default:
44 43 #email_to =
45 44 ## Examples:
46 45 #email_to = admin@example.com
47 46 #email_to = admin@example.com another_admin@example.com
48 47
49 48 ## 'From' header for error emails. You can optionally add a name.
50 49 ## Default:
51 50 #error_email_from = pylons@yourapp.com
52 51 ## Examples:
53 52 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
54 53 #error_email_from = paste_error@example.com
55 54
56 55 ## SMTP server settings
57 56 ## If specifying credentials, make sure to use secure connections.
58 57 ## Default: Send unencrypted unauthenticated mails to the specified smtp_server.
59 58 ## For "SSL", use smtp_use_ssl = true and smtp_port = 465.
60 59 ## For "STARTTLS", use smtp_use_tls = true and smtp_port = 587.
61 60 #smtp_server = smtp.example.com
62 61 #smtp_username =
63 62 #smtp_password =
64 63 #smtp_port = 25
65 64 #smtp_use_ssl = false
66 65 #smtp_use_tls = false
67 66
68 67 [server:main]
69 68 ## Gearbox default web server ##
70 69 #use = egg:gearbox#wsgiref
71 70 ## nr of worker threads to spawn
72 71 #threadpool_workers = 1
73 72 ## max request before thread respawn
74 73 #threadpool_max_requests = 100
75 74 ## option to use threads of process
76 75 #use_threadpool = true
77 76
78 77 ## Gearbox gevent web server ##
79 78 #use = egg:gearbox#gevent
80 79
81 80 ## WAITRESS ##
82 81 use = egg:waitress#main
83 82 ## number of worker threads
84 83 threads = 1
85 84 ## MAX BODY SIZE 100GB
86 85 max_request_body_size = 107374182400
87 86 ## use poll instead of select, fixes fd limits, may not work on old
88 87 ## windows systems.
89 88 #asyncore_use_poll = True
90 89
91 90 ## GUNICORN ##
92 91 #use = egg:gunicorn#main
93 92 ## number of process workers. You must set `instance_id = *` when this option
94 93 ## is set to more than one worker
95 94 #workers = 1
96 95 ## process name
97 96 #proc_name = kallithea
98 97 ## type of worker class, one of sync, eventlet, gevent, tornado
99 98 ## recommended for bigger setup is using of of other than sync one
100 99 #worker_class = sync
101 100 #max_requests = 1000
102 101 ## amount of time a worker can handle request before it gets killed and
103 102 ## restarted
104 103 #timeout = 3600
105 104
106 105 ## UWSGI ##
107 106 ## run with uwsgi --ini-paste-logged <inifile.ini>
108 107 #[uwsgi]
109 108 #socket = /tmp/uwsgi.sock
110 109 #master = true
111 110 #http = 127.0.0.1:5000
112 111
113 112 ## set as deamon and redirect all output to file
114 113 #daemonize = ./uwsgi_kallithea.log
115 114
116 115 ## master process PID
117 116 #pidfile = ./uwsgi_kallithea.pid
118 117
119 118 ## stats server with workers statistics, use uwsgitop
120 119 ## for monitoring, `uwsgitop 127.0.0.1:1717`
121 120 #stats = 127.0.0.1:1717
122 121 #memory-report = true
123 122
124 123 ## log 5XX errors
125 124 #log-5xx = true
126 125
127 126 ## Set the socket listen queue size.
128 127 #listen = 256
129 128
130 129 ## Gracefully Reload workers after the specified amount of managed requests
131 130 ## (avoid memory leaks).
132 131 #max-requests = 1000
133 132
134 133 ## enable large buffers
135 134 #buffer-size = 65535
136 135
137 136 ## socket and http timeouts ##
138 137 #http-timeout = 3600
139 138 #socket-timeout = 3600
140 139
141 140 ## Log requests slower than the specified number of milliseconds.
142 141 #log-slow = 10
143 142
144 143 ## Exit if no app can be loaded.
145 144 #need-app = true
146 145
147 146 ## Set lazy mode (load apps in workers instead of master).
148 147 #lazy = true
149 148
150 149 ## scaling ##
151 150 ## set cheaper algorithm to use, if not set default will be used
152 151 #cheaper-algo = spare
153 152
154 153 ## minimum number of workers to keep at all times
155 154 #cheaper = 1
156 155
157 156 ## number of workers to spawn at startup
158 157 #cheaper-initial = 1
159 158
160 159 ## maximum number of workers that can be spawned
161 160 #workers = 4
162 161
163 162 ## how many workers should be spawned at a time
164 163 #cheaper-step = 1
165 164
166 165 ## COMMON ##
167 166 #host = 127.0.0.1
168 167 host = 0.0.0.0
169 168 port = 5000
170 169
171 170 ## middleware for hosting the WSGI application under a URL prefix
172 171 #[filter:proxy-prefix]
173 172 #use = egg:PasteDeploy#prefix
174 173 #prefix = /<your-prefix>
175 174
176 175 [app:main]
177 176 use = egg:kallithea
178 177 ## enable proxy prefix middleware
179 178 #filter-with = proxy-prefix
180 179
181 180 full_stack = true
182 181 static_files = true
183 182 ## Available Languages:
184 183 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
185 184 lang =
186 185 cache_dir = %(here)s/data
187 186 index_dir = %(here)s/data/index
188 187
189 188 ## perform a full repository scan on each server start, this should be
190 189 ## set to false after first startup, to allow faster server restarts.
191 190 #initial_repo_scan = false
192 191 initial_repo_scan = true
193 192
194 193 ## uncomment and set this path to use archive download cache
195 194 archive_cache_dir = %(here)s/tarballcache
196 195
197 196 ## change this to unique ID for security
198 197 app_instance_uuid = development-not-secret
199 198
200 199 ## cut off limit for large diffs (size in bytes)
201 200 cut_off_limit = 256000
202 201
203 202 ## force https in Kallithea, fixes https redirects, assumes it's always https
204 203 force_https = false
205 204
206 205 ## use Strict-Transport-Security headers
207 206 use_htsts = false
208 207
209 208 ## number of commits stats will parse on each iteration
210 209 commit_parse_limit = 25
211 210
212 211 ## path to git executable
213 212 git_path = git
214 213
215 214 ## git rev filter option, --all is the default filter, if you need to
216 215 ## hide all refs in changelog switch this to --branches --tags
217 216 #git_rev_filter = --branches --tags
218 217
219 218 ## RSS feed options
220 219 rss_cut_off_limit = 256000
221 220 rss_items_per_page = 10
222 221 rss_include_diff = false
223 222
224 223 ## options for showing and identifying changesets
225 224 show_sha_length = 12
226 225 show_revision_number = false
227 226
228 227 ## Canonical URL to use when creating full URLs in UI and texts.
229 228 ## Useful when the site is available under different names or protocols.
230 229 ## Defaults to what is provided in the WSGI environment.
231 230 #canonical_url = https://kallithea.example.com/repos
232 231
233 232 ## gist URL alias, used to create nicer urls for gist. This should be an
234 233 ## url that does rewrites to _admin/gists/<gistid>.
235 234 ## example: http://gist.example.com/{gistid}. Empty means use the internal
236 235 ## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid>
237 236 gist_alias_url =
238 237
239 238 ## white list of API enabled controllers. This allows to add list of
240 239 ## controllers to which access will be enabled by api_key. eg: to enable
241 240 ## api access to raw_files put `FilesController:raw`, to enable access to patches
242 241 ## add `ChangesetController:changeset_patch`. This list should be "," separated
243 242 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
244 243 ## Recommended settings below are commented out:
245 244 api_access_controllers_whitelist =
246 245 # ChangesetController:changeset_patch,
247 246 # ChangesetController:changeset_raw,
248 247 # FilesController:raw,
249 248 # FilesController:archivefile
250 249
251 250 ## default encoding used to convert from and to unicode
252 251 ## can be also a comma separated list of encoding in case of mixed encodings
253 252 default_encoding = utf8
254 253
255 254 ## issue tracker for Kallithea (leave blank to disable, absent for default)
256 255 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
257 256
258 257 ## issue tracking mapping for commits messages
259 258 ## comment out issue_pat, issue_server, issue_prefix to enable
260 259
261 260 ## pattern to get the issues from commit messages
262 261 ## default one used here is #<numbers> with a regex passive group for `#`
263 262 ## {id} will be all groups matched from this pattern
264 263
265 264 issue_pat = (?:\s*#)(\d+)
266 265
267 266 ## server url to the issue, each {id} will be replaced with match
268 267 ## fetched from the regex and {repo} is replaced with full repository name
269 268 ## including groups {repo_name} is replaced with just name of repo
270 269
271 270 issue_server_link = https://issues.example.com/{repo}/issue/{id}
272 271
273 272 ## prefix to add to link to indicate it's an url
274 273 ## #314 will be replaced by <issue_prefix><id>
275 274
276 275 issue_prefix = #
277 276
278 277 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
279 278 ## multiple patterns, to other issues server, wiki or others
280 279 ## below an example how to create a wiki pattern
281 280 # wiki-some-id -> https://wiki.example.com/some-id
282 281
283 282 #issue_pat_wiki = (?:wiki-)(.+)
284 283 #issue_server_link_wiki = https://wiki.example.com/{id}
285 284 #issue_prefix_wiki = WIKI-
286 285
287 286 ## alternative return HTTP header for failed authentication. Default HTTP
288 287 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
289 288 ## handling that. Set this variable to 403 to return HTTPForbidden
290 289 auth_ret_code =
291 290
292 291 ## locking return code. When repository is locked return this HTTP code. 2XX
293 292 ## codes don't break the transactions while 4XX codes do
294 293 lock_ret_code = 423
295 294
296 295 ## allows to change the repository location in settings page
297 296 allow_repo_location_change = True
298 297
299 298 ## allows to setup custom hooks in settings page
300 299 allow_custom_hooks_settings = True
301 300
302 301 ## extra extensions for indexing, space separated and without the leading '.'.
303 302 # index.extensions =
304 303 # gemfile
305 304 # lock
306 305
307 306 ## extra filenames for indexing, space separated
308 307 # index.filenames =
309 308 # .dockerignore
310 309 # .editorconfig
311 310 # INSTALL
312 311 # CHANGELOG
313 312
314 313 ####################################
315 314 ### CELERY CONFIG ####
316 315 ####################################
317 316
318 317 use_celery = false
319 318
320 319 ## Example: connect to the virtual host 'rabbitmqhost' on localhost as rabbitmq:
321 320 broker.url = amqp://rabbitmq:qewqew@localhost:5672/rabbitmqhost
322 321
323 322 celery.imports = kallithea.lib.celerylib.tasks
324 323 celery.accept.content = pickle
325 324 celery.result.backend = amqp
326 325 celery.result.dburi = amqp://
327 326 celery.result.serialier = json
328 327
329 328 #celery.send.task.error.emails = true
330 329 #celery.amqp.task.result.expires = 18000
331 330
332 331 celeryd.concurrency = 2
333 332 celeryd.max.tasks.per.child = 1
334 333
335 334 ## If true, tasks will never be sent to the queue, but executed locally instead.
336 335 celery.always.eager = false
337 336
338 337 ####################################
339 338 ### BEAKER CACHE ####
340 339 ####################################
341 340
342 341 beaker.cache.data_dir = %(here)s/data/cache/data
343 342 beaker.cache.lock_dir = %(here)s/data/cache/lock
344 343
345 344 beaker.cache.regions = short_term,long_term,sql_cache_short
346 345
347 346 beaker.cache.short_term.type = memory
348 347 beaker.cache.short_term.expire = 60
349 348 beaker.cache.short_term.key_length = 256
350 349
351 350 beaker.cache.long_term.type = memory
352 351 beaker.cache.long_term.expire = 36000
353 352 beaker.cache.long_term.key_length = 256
354 353
355 354 beaker.cache.sql_cache_short.type = memory
356 355 beaker.cache.sql_cache_short.expire = 10
357 356 beaker.cache.sql_cache_short.key_length = 256
358 357
359 358 ####################################
360 359 ### BEAKER SESSION ####
361 360 ####################################
362 361
363 362 ## Name of session cookie. Should be unique for a given host and path, even when running
364 363 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
365 364 beaker.session.key = kallithea
366 365 ## Sessions should always only be accessible by the browser, not directly by JavaScript.
367 366 beaker.session.httponly = true
368 367 ## Session lifetime. 2592000 seconds is 30 days.
369 368 beaker.session.timeout = 2592000
370 369
371 370 ## Server secret used with HMAC to ensure integrity of cookies.
372 371 beaker.session.secret = development-not-secret
373 372 ## Further, encrypt the data with AES.
374 373 #beaker.session.encrypt_key = <key_for_encryption>
375 374 #beaker.session.validate_key = <validation_key>
376 375
377 376 ## Type of storage used for the session, current types are
378 377 ## dbm, file, memcached, database, and memory.
379 378
380 379 ## File system storage of session data. (default)
381 380 #beaker.session.type = file
382 381
383 382 ## Cookie only, store all session data inside the cookie. Requires secure secrets.
384 383 #beaker.session.type = cookie
385 384
386 385 ## Database storage of session data.
387 386 #beaker.session.type = ext:database
388 387 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
389 388 #beaker.session.table_name = db_session
390 389
391 390 ############################
392 391 ## ERROR HANDLING SYSTEMS ##
393 392 ############################
394 393
395 394 ####################
396 395 ### [appenlight] ###
397 396 ####################
398 397
399 398 ## AppEnlight is tailored to work with Kallithea, see
400 399 ## http://appenlight.com for details how to obtain an account
401 400 ## you must install python package `appenlight_client` to make it work
402 401
403 402 ## appenlight enabled
404 403 appenlight = false
405 404
406 405 appenlight.server_url = https://api.appenlight.com
407 406 appenlight.api_key = YOUR_API_KEY
408 407
409 408 ## TWEAK AMOUNT OF INFO SENT HERE
410 409
411 410 ## enables 404 error logging (default False)
412 411 appenlight.report_404 = false
413 412
414 413 ## time in seconds after request is considered being slow (default 1)
415 414 appenlight.slow_request_time = 1
416 415
417 416 ## record slow requests in application
418 417 ## (needs to be enabled for slow datastore recording and time tracking)
419 418 appenlight.slow_requests = true
420 419
421 420 ## enable hooking to application loggers
422 421 #appenlight.logging = true
423 422
424 423 ## minimum log level for log capture
425 424 #appenlight.logging.level = WARNING
426 425
427 426 ## send logs only from erroneous/slow requests
428 427 ## (saves API quota for intensive logging)
429 428 appenlight.logging_on_error = false
430 429
431 430 ## list of additional keywords that should be grabbed from environ object
432 431 ## can be string with comma separated list of words in lowercase
433 432 ## (by default client will always send following info:
434 433 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
435 434 ## start with HTTP* this list be extended with additional keywords here
436 435 appenlight.environ_keys_whitelist =
437 436
438 437 ## list of keywords that should be blanked from request object
439 438 ## can be string with comma separated list of words in lowercase
440 439 ## (by default client will always blank keys that contain following words
441 440 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
442 441 ## this list be extended with additional keywords set here
443 442 appenlight.request_keys_blacklist =
444 443
445 444 ## list of namespaces that should be ignores when gathering log entries
446 445 ## can be string with comma separated list of namespaces
447 446 ## (by default the client ignores own entries: appenlight_client.client)
448 447 appenlight.log_namespace_blacklist =
449 448
450 449 ################
451 450 ### [sentry] ###
452 451 ################
453 452
454 453 ## sentry is a alternative open source error aggregator
455 454 ## you must install python packages `sentry` and `raven` to enable
456 455
457 456 sentry.dsn = YOUR_DNS
458 457 sentry.servers =
459 458 sentry.name =
460 459 sentry.key =
461 460 sentry.public_key =
462 461 sentry.secret_key =
463 462 sentry.project =
464 463 sentry.site =
465 464 sentry.include_paths =
466 465 sentry.exclude_paths =
467 466
468 467 ################################################################################
469 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
468 ## WARNING: *DEBUG MODE MUST BE OFF IN A PRODUCTION ENVIRONMENT* ##
470 469 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
471 470 ## execute malicious code after an exception is raised. ##
472 471 ################################################################################
473 #set debug = false
474 set debug = true
472 #debug = false
473 debug = true
475 474
476 475 ##################################
477 476 ### LOGVIEW CONFIG ###
478 477 ##################################
479 478
480 479 logview.sqlalchemy = #faa
481 480 logview.pylons.templating = #bfb
482 481 logview.pylons.util = #eee
483 482
484 483 #########################################################
485 484 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
486 485 #########################################################
487 486
488 487 # SQLITE [default]
489 488 sqlalchemy.url = sqlite:///%(here)s/kallithea.db?timeout=60
490 489
491 490 # POSTGRESQL
492 491 #sqlalchemy.url = postgresql://user:pass@localhost/kallithea
493 492
494 493 # MySQL
495 494 #sqlalchemy.url = mysql://user:pass@localhost/kallithea?charset=utf8
496 495
497 496 # see sqlalchemy docs for others
498 497
499 498 sqlalchemy.echo = false
500 499 sqlalchemy.pool_recycle = 3600
501 500
502 501 ################################
503 502 ### ALEMBIC CONFIGURATION ####
504 503 ################################
505 504
506 505 [alembic]
507 506 script_location = kallithea:alembic
508 507
509 508 ################################
510 509 ### LOGGING CONFIGURATION ####
511 510 ################################
512 511
513 512 [loggers]
514 513 keys = root, routes, kallithea, sqlalchemy, tg, gearbox, beaker, templates, whoosh_indexer
515 514
516 515 [handlers]
517 516 keys = console, console_sql
518 517
519 518 [formatters]
520 519 keys = generic, color_formatter, color_formatter_sql
521 520
522 521 #############
523 522 ## LOGGERS ##
524 523 #############
525 524
526 525 [logger_root]
527 526 level = NOTSET
528 527 handlers = console
529 528
530 529 [logger_routes]
531 530 level = DEBUG
532 531 handlers =
533 532 qualname = routes.middleware
534 533 ## "level = DEBUG" logs the route matched and routing variables.
535 534 propagate = 1
536 535
537 536 [logger_beaker]
538 537 level = DEBUG
539 538 handlers =
540 539 qualname = beaker.container
541 540 propagate = 1
542 541
543 542 [logger_templates]
544 543 level = INFO
545 544 handlers =
546 545 qualname = pylons.templating
547 546 propagate = 1
548 547
549 548 [logger_kallithea]
550 549 level = DEBUG
551 550 handlers =
552 551 qualname = kallithea
553 552 propagate = 1
554 553
555 554 [logger_tg]
556 555 level = DEBUG
557 556 handlers =
558 557 qualname = tg
559 558 propagate = 1
560 559
561 560 [logger_gearbox]
562 561 level = DEBUG
563 562 handlers =
564 563 qualname = gearbox
565 564 propagate = 1
566 565
567 566 [logger_sqlalchemy]
568 567 level = INFO
569 568 handlers = console_sql
570 569 qualname = sqlalchemy.engine
571 570 propagate = 0
572 571
573 572 [logger_whoosh_indexer]
574 573 level = DEBUG
575 574 handlers =
576 575 qualname = whoosh_indexer
577 576 propagate = 1
578 577
579 578 ##############
580 579 ## HANDLERS ##
581 580 ##############
582 581
583 582 [handler_console]
584 583 class = StreamHandler
585 584 args = (sys.stderr,)
586 585 #level = INFO
587 586 level = DEBUG
588 587 #formatter = generic
589 588 formatter = color_formatter
590 589
591 590 [handler_console_sql]
592 591 class = StreamHandler
593 592 args = (sys.stderr,)
594 593 #level = WARN
595 594 level = DEBUG
596 595 #formatter = generic
597 596 formatter = color_formatter_sql
598 597
599 598 ################
600 599 ## FORMATTERS ##
601 600 ################
602 601
603 602 [formatter_generic]
604 603 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
605 604 datefmt = %Y-%m-%d %H:%M:%S
606 605
607 606 [formatter_color_formatter]
608 607 class = kallithea.lib.colored_formatter.ColorFormatter
609 608 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
610 609 datefmt = %Y-%m-%d %H:%M:%S
611 610
612 611 [formatter_color_formatter_sql]
613 612 class = kallithea.lib.colored_formatter.ColorFormatterSql
614 613 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
615 614 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,615 +1,614 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%text>################################################################################</%text>
3 3 <%text>################################################################################</%text>
4 4 # Kallithea - config file generated with kallithea-config #
5 5 <%text>################################################################################</%text>
6 6 <%text>################################################################################</%text>
7 7
8 8 [DEFAULT]
9 debug = true
10 9
11 10 <%text>################################################################################</%text>
12 11 <%text>## Email settings ##</%text>
13 12 <%text>## ##</%text>
14 13 <%text>## Refer to the documentation ("Email settings") for more details. ##</%text>
15 14 <%text>## ##</%text>
16 15 <%text>## It is recommended to use a valid sender address that passes access ##</%text>
17 16 <%text>## validation and spam filtering in mail servers. ##</%text>
18 17 <%text>################################################################################</%text>
19 18
20 19 <%text>## 'From' header for application emails. You can optionally add a name.</%text>
21 20 <%text>## Default:</%text>
22 21 #app_email_from = Kallithea
23 22 <%text>## Examples:</%text>
24 23 #app_email_from = Kallithea <kallithea-noreply@example.com>
25 24 #app_email_from = kallithea-noreply@example.com
26 25
27 26 <%text>## Subject prefix for application emails.</%text>
28 27 <%text>## A space between this prefix and the real subject is automatically added.</%text>
29 28 <%text>## Default:</%text>
30 29 #email_prefix =
31 30 <%text>## Example:</%text>
32 31 #email_prefix = [Kallithea]
33 32
34 33 <%text>## Recipients for error emails and fallback recipients of application mails.</%text>
35 34 <%text>## Multiple addresses can be specified, space-separated.</%text>
36 35 <%text>## Only addresses are allowed, do not add any name part.</%text>
37 36 <%text>## Default:</%text>
38 37 #email_to =
39 38 <%text>## Examples:</%text>
40 39 #email_to = admin@example.com
41 40 #email_to = admin@example.com another_admin@example.com
42 41
43 42 <%text>## 'From' header for error emails. You can optionally add a name.</%text>
44 43 <%text>## Default:</%text>
45 44 #error_email_from = pylons@yourapp.com
46 45 <%text>## Examples:</%text>
47 46 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
48 47 #error_email_from = paste_error@example.com
49 48
50 49 <%text>## SMTP server settings</%text>
51 50 <%text>## If specifying credentials, make sure to use secure connections.</%text>
52 51 <%text>## Default: Send unencrypted unauthenticated mails to the specified smtp_server.</%text>
53 52 <%text>## For "SSL", use smtp_use_ssl = true and smtp_port = 465.</%text>
54 53 <%text>## For "STARTTLS", use smtp_use_tls = true and smtp_port = 587.</%text>
55 54 #smtp_server = smtp.example.com
56 55 #smtp_username =
57 56 #smtp_password =
58 57 #smtp_port = 25
59 58 #smtp_use_ssl = false
60 59 #smtp_use_tls = false
61 60
62 61 [server:main]
63 62 %if http_server == 'gearbox':
64 63 <%text>## Gearbox default web server ##</%text>
65 64 use = egg:gearbox#wsgiref
66 65 <%text>## nr of worker threads to spawn</%text>
67 66 threadpool_workers = 1
68 67 <%text>## max request before thread respawn</%text>
69 68 threadpool_max_requests = 100
70 69 <%text>## option to use threads of process</%text>
71 70 use_threadpool = true
72 71
73 72 %elif http_server == 'gevent':
74 73 <%text>## Gearbox gevent web server ##</%text>
75 74 use = egg:gearbox#gevent
76 75
77 76 %elif http_server == 'waitress':
78 77 <%text>## WAITRESS ##</%text>
79 78 use = egg:waitress#main
80 79 <%text>## number of worker threads</%text>
81 80 threads = 1
82 81 <%text>## MAX BODY SIZE 100GB</%text>
83 82 max_request_body_size = 107374182400
84 83 <%text>## use poll instead of select, fixes fd limits, may not work on old</%text>
85 84 <%text>## windows systems.</%text>
86 85 #asyncore_use_poll = True
87 86
88 87 %elif http_server == 'gunicorn':
89 88 <%text>## GUNICORN ##</%text>
90 89 use = egg:gunicorn#main
91 90 <%text>## number of process workers. You must set `instance_id = *` when this option</%text>
92 91 <%text>## is set to more than one worker</%text>
93 92 workers = 1
94 93 <%text>## process name</%text>
95 94 proc_name = kallithea
96 95 <%text>## type of worker class, one of sync, eventlet, gevent, tornado</%text>
97 96 <%text>## recommended for bigger setup is using of of other than sync one</%text>
98 97 worker_class = sync
99 98 max_requests = 1000
100 99 <%text>## amount of time a worker can handle request before it gets killed and</%text>
101 100 <%text>## restarted</%text>
102 101 timeout = 3600
103 102
104 103 %elif http_server == 'uwsgi':
105 104 <%text>## UWSGI ##</%text>
106 105 <%text>## run with uwsgi --ini-paste-logged <inifile.ini></%text>
107 106 [uwsgi]
108 107 socket = /tmp/uwsgi.sock
109 108 master = true
110 109 http = 127.0.0.1:5000
111 110
112 111 <%text>## set as deamon and redirect all output to file</%text>
113 112 #daemonize = ./uwsgi_kallithea.log
114 113
115 114 <%text>## master process PID</%text>
116 115 pidfile = ./uwsgi_kallithea.pid
117 116
118 117 <%text>## stats server with workers statistics, use uwsgitop</%text>
119 118 <%text>## for monitoring, `uwsgitop 127.0.0.1:1717`</%text>
120 119 stats = 127.0.0.1:1717
121 120 memory-report = true
122 121
123 122 <%text>## log 5XX errors</%text>
124 123 log-5xx = true
125 124
126 125 <%text>## Set the socket listen queue size.</%text>
127 126 listen = 256
128 127
129 128 <%text>## Gracefully Reload workers after the specified amount of managed requests</%text>
130 129 <%text>## (avoid memory leaks).</%text>
131 130 max-requests = 1000
132 131
133 132 <%text>## enable large buffers</%text>
134 133 buffer-size = 65535
135 134
136 135 <%text>## socket and http timeouts ##</%text>
137 136 http-timeout = 3600
138 137 socket-timeout = 3600
139 138
140 139 <%text>## Log requests slower than the specified number of milliseconds.</%text>
141 140 log-slow = 10
142 141
143 142 <%text>## Exit if no app can be loaded.</%text>
144 143 need-app = true
145 144
146 145 <%text>## Set lazy mode (load apps in workers instead of master).</%text>
147 146 lazy = true
148 147
149 148 <%text>## scaling ##</%text>
150 149 <%text>## set cheaper algorithm to use, if not set default will be used</%text>
151 150 cheaper-algo = spare
152 151
153 152 <%text>## minimum number of workers to keep at all times</%text>
154 153 cheaper = 1
155 154
156 155 <%text>## number of workers to spawn at startup</%text>
157 156 cheaper-initial = 1
158 157
159 158 <%text>## maximum number of workers that can be spawned</%text>
160 159 workers = 4
161 160
162 161 <%text>## how many workers should be spawned at a time</%text>
163 162 cheaper-step = 1
164 163
165 164 %endif
166 165 <%text>## COMMON ##</%text>
167 166 host = ${host}
168 167 port = ${port}
169 168
170 169 <%text>## middleware for hosting the WSGI application under a URL prefix</%text>
171 170 #[filter:proxy-prefix]
172 171 #use = egg:PasteDeploy#prefix
173 172 #prefix = /<your-prefix>
174 173
175 174 [app:main]
176 175 use = egg:kallithea
177 176 <%text>## enable proxy prefix middleware</%text>
178 177 #filter-with = proxy-prefix
179 178
180 179 full_stack = true
181 180 static_files = true
182 181 <%text>## Available Languages:</%text>
183 182 <%text>## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW</%text>
184 183 lang =
185 184 cache_dir = ${here}/data
186 185 index_dir = ${here}/data/index
187 186
188 187 <%text>## perform a full repository scan on each server start, this should be</%text>
189 188 <%text>## set to false after first startup, to allow faster server restarts.</%text>
190 189 initial_repo_scan = false
191 190
192 191 <%text>## uncomment and set this path to use archive download cache</%text>
193 192 archive_cache_dir = ${here}/tarballcache
194 193
195 194 <%text>## change this to unique ID for security</%text>
196 195 app_instance_uuid = ${uuid()}
197 196
198 197 <%text>## cut off limit for large diffs (size in bytes)</%text>
199 198 cut_off_limit = 256000
200 199
201 200 <%text>## force https in Kallithea, fixes https redirects, assumes it's always https</%text>
202 201 force_https = false
203 202
204 203 <%text>## use Strict-Transport-Security headers</%text>
205 204 use_htsts = false
206 205
207 206 <%text>## number of commits stats will parse on each iteration</%text>
208 207 commit_parse_limit = 25
209 208
210 209 <%text>## path to git executable</%text>
211 210 git_path = git
212 211
213 212 <%text>## git rev filter option, --all is the default filter, if you need to</%text>
214 213 <%text>## hide all refs in changelog switch this to --branches --tags</%text>
215 214 #git_rev_filter = --branches --tags
216 215
217 216 <%text>## RSS feed options</%text>
218 217 rss_cut_off_limit = 256000
219 218 rss_items_per_page = 10
220 219 rss_include_diff = false
221 220
222 221 <%text>## options for showing and identifying changesets</%text>
223 222 show_sha_length = 12
224 223 show_revision_number = false
225 224
226 225 <%text>## Canonical URL to use when creating full URLs in UI and texts.</%text>
227 226 <%text>## Useful when the site is available under different names or protocols.</%text>
228 227 <%text>## Defaults to what is provided in the WSGI environment.</%text>
229 228 #canonical_url = https://kallithea.example.com/repos
230 229
231 230 <%text>## gist URL alias, used to create nicer urls for gist. This should be an</%text>
232 231 <%text>## url that does rewrites to _admin/gists/<gistid>.</%text>
233 232 <%text>## example: http://gist.example.com/{gistid}. Empty means use the internal</%text>
234 233 <%text>## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid></%text>
235 234 gist_alias_url =
236 235
237 236 <%text>## white list of API enabled controllers. This allows to add list of</%text>
238 237 <%text>## controllers to which access will be enabled by api_key. eg: to enable</%text>
239 238 <%text>## api access to raw_files put `FilesController:raw`, to enable access to patches</%text>
240 239 <%text>## add `ChangesetController:changeset_patch`. This list should be "," separated</%text>
241 240 <%text>## Syntax is <ControllerClass>:<function>. Check debug logs for generated names</%text>
242 241 <%text>## Recommended settings below are commented out:</%text>
243 242 api_access_controllers_whitelist =
244 243 # ChangesetController:changeset_patch,
245 244 # ChangesetController:changeset_raw,
246 245 # FilesController:raw,
247 246 # FilesController:archivefile
248 247
249 248 <%text>## default encoding used to convert from and to unicode</%text>
250 249 <%text>## can be also a comma separated list of encoding in case of mixed encodings</%text>
251 250 default_encoding = utf8
252 251
253 252 <%text>## issue tracker for Kallithea (leave blank to disable, absent for default)</%text>
254 253 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
255 254
256 255 <%text>## issue tracking mapping for commits messages</%text>
257 256 <%text>## comment out issue_pat, issue_server, issue_prefix to enable</%text>
258 257
259 258 <%text>## pattern to get the issues from commit messages</%text>
260 259 <%text>## default one used here is #<numbers> with a regex passive group for `#`</%text>
261 260 <%text>## {id} will be all groups matched from this pattern</%text>
262 261
263 262 issue_pat = (?:\s*#)(\d+)
264 263
265 264 <%text>## server url to the issue, each {id} will be replaced with match</%text>
266 265 <%text>## fetched from the regex and {repo} is replaced with full repository name</%text>
267 266 <%text>## including groups {repo_name} is replaced with just name of repo</%text>
268 267
269 268 issue_server_link = https://issues.example.com/{repo}/issue/{id}
270 269
271 270 <%text>## prefix to add to link to indicate it's an url</%text>
272 271 <%text>## #314 will be replaced by <issue_prefix><id></%text>
273 272
274 273 issue_prefix = #
275 274
276 275 <%text>## issue_pat, issue_server_link, issue_prefix can have suffixes to specify</%text>
277 276 <%text>## multiple patterns, to other issues server, wiki or others</%text>
278 277 <%text>## below an example how to create a wiki pattern</%text>
279 278 # wiki-some-id -> https://wiki.example.com/some-id
280 279
281 280 #issue_pat_wiki = (?:wiki-)(.+)
282 281 #issue_server_link_wiki = https://wiki.example.com/{id}
283 282 #issue_prefix_wiki = WIKI-
284 283
285 284 <%text>## alternative return HTTP header for failed authentication. Default HTTP</%text>
286 285 <%text>## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with</%text>
287 286 <%text>## handling that. Set this variable to 403 to return HTTPForbidden</%text>
288 287 auth_ret_code =
289 288
290 289 <%text>## locking return code. When repository is locked return this HTTP code. 2XX</%text>
291 290 <%text>## codes don't break the transactions while 4XX codes do</%text>
292 291 lock_ret_code = 423
293 292
294 293 <%text>## allows to change the repository location in settings page</%text>
295 294 allow_repo_location_change = True
296 295
297 296 <%text>## allows to setup custom hooks in settings page</%text>
298 297 allow_custom_hooks_settings = True
299 298
300 299 <%text>## extra extensions for indexing, space separated and without the leading '.'.</%text>
301 300 # index.extensions =
302 301 # gemfile
303 302 # lock
304 303
305 304 <%text>## extra filenames for indexing, space separated</%text>
306 305 # index.filenames =
307 306 # .dockerignore
308 307 # .editorconfig
309 308 # INSTALL
310 309 # CHANGELOG
311 310
312 311 <%text>####################################</%text>
313 312 <%text>### CELERY CONFIG ####</%text>
314 313 <%text>####################################</%text>
315 314
316 315 use_celery = false
317 316
318 317 <%text>## Example: connect to the virtual host 'rabbitmqhost' on localhost as rabbitmq:</%text>
319 318 broker.url = amqp://rabbitmq:qewqew@localhost:5672/rabbitmqhost
320 319
321 320 celery.imports = kallithea.lib.celerylib.tasks
322 321 celery.accept.content = pickle
323 322 celery.result.backend = amqp
324 323 celery.result.dburi = amqp://
325 324 celery.result.serialier = json
326 325
327 326 #celery.send.task.error.emails = true
328 327 #celery.amqp.task.result.expires = 18000
329 328
330 329 celeryd.concurrency = 2
331 330 celeryd.max.tasks.per.child = 1
332 331
333 332 <%text>## If true, tasks will never be sent to the queue, but executed locally instead.</%text>
334 333 celery.always.eager = false
335 334
336 335 <%text>####################################</%text>
337 336 <%text>### BEAKER CACHE ####</%text>
338 337 <%text>####################################</%text>
339 338
340 339 beaker.cache.data_dir = ${here}/data/cache/data
341 340 beaker.cache.lock_dir = ${here}/data/cache/lock
342 341
343 342 beaker.cache.regions = short_term,long_term,sql_cache_short
344 343
345 344 beaker.cache.short_term.type = memory
346 345 beaker.cache.short_term.expire = 60
347 346 beaker.cache.short_term.key_length = 256
348 347
349 348 beaker.cache.long_term.type = memory
350 349 beaker.cache.long_term.expire = 36000
351 350 beaker.cache.long_term.key_length = 256
352 351
353 352 beaker.cache.sql_cache_short.type = memory
354 353 beaker.cache.sql_cache_short.expire = 10
355 354 beaker.cache.sql_cache_short.key_length = 256
356 355
357 356 <%text>####################################</%text>
358 357 <%text>### BEAKER SESSION ####</%text>
359 358 <%text>####################################</%text>
360 359
361 360 <%text>## Name of session cookie. Should be unique for a given host and path, even when running</%text>
362 361 <%text>## on different ports. Otherwise, cookie sessions will be shared and messed up.</%text>
363 362 beaker.session.key = kallithea
364 363 <%text>## Sessions should always only be accessible by the browser, not directly by JavaScript.</%text>
365 364 beaker.session.httponly = true
366 365 <%text>## Session lifetime. 2592000 seconds is 30 days.</%text>
367 366 beaker.session.timeout = 2592000
368 367
369 368 <%text>## Server secret used with HMAC to ensure integrity of cookies.</%text>
370 369 beaker.session.secret = ${uuid()}
371 370 <%text>## Further, encrypt the data with AES.</%text>
372 371 #beaker.session.encrypt_key = <key_for_encryption>
373 372 #beaker.session.validate_key = <validation_key>
374 373
375 374 <%text>## Type of storage used for the session, current types are</%text>
376 375 <%text>## dbm, file, memcached, database, and memory.</%text>
377 376
378 377 <%text>## File system storage of session data. (default)</%text>
379 378 #beaker.session.type = file
380 379
381 380 <%text>## Cookie only, store all session data inside the cookie. Requires secure secrets.</%text>
382 381 #beaker.session.type = cookie
383 382
384 383 <%text>## Database storage of session data.</%text>
385 384 #beaker.session.type = ext:database
386 385 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
387 386 #beaker.session.table_name = db_session
388 387
389 388 %if error_aggregation_service == 'appenlight':
390 389 <%text>############################</%text>
391 390 <%text>## ERROR HANDLING SYSTEMS ##</%text>
392 391 <%text>############################</%text>
393 392
394 393 <%text>####################</%text>
395 394 <%text>### [appenlight] ###</%text>
396 395 <%text>####################</%text>
397 396
398 397 <%text>## AppEnlight is tailored to work with Kallithea, see</%text>
399 398 <%text>## http://appenlight.com for details how to obtain an account</%text>
400 399 <%text>## you must install python package `appenlight_client` to make it work</%text>
401 400
402 401 <%text>## appenlight enabled</%text>
403 402 appenlight = false
404 403
405 404 appenlight.server_url = https://api.appenlight.com
406 405 appenlight.api_key = YOUR_API_KEY
407 406
408 407 <%text>## TWEAK AMOUNT OF INFO SENT HERE</%text>
409 408
410 409 <%text>## enables 404 error logging (default False)</%text>
411 410 appenlight.report_404 = false
412 411
413 412 <%text>## time in seconds after request is considered being slow (default 1)</%text>
414 413 appenlight.slow_request_time = 1
415 414
416 415 <%text>## record slow requests in application</%text>
417 416 <%text>## (needs to be enabled for slow datastore recording and time tracking)</%text>
418 417 appenlight.slow_requests = true
419 418
420 419 <%text>## enable hooking to application loggers</%text>
421 420 #appenlight.logging = true
422 421
423 422 <%text>## minimum log level for log capture</%text>
424 423 #appenlight.logging.level = WARNING
425 424
426 425 <%text>## send logs only from erroneous/slow requests</%text>
427 426 <%text>## (saves API quota for intensive logging)</%text>
428 427 appenlight.logging_on_error = false
429 428
430 429 <%text>## list of additional keywords that should be grabbed from environ object</%text>
431 430 <%text>## can be string with comma separated list of words in lowercase</%text>
432 431 <%text>## (by default client will always send following info:</%text>
433 432 <%text>## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that</%text>
434 433 <%text>## start with HTTP* this list be extended with additional keywords here</%text>
435 434 appenlight.environ_keys_whitelist =
436 435
437 436 <%text>## list of keywords that should be blanked from request object</%text>
438 437 <%text>## can be string with comma separated list of words in lowercase</%text>
439 438 <%text>## (by default client will always blank keys that contain following words</%text>
440 439 <%text>## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'</%text>
441 440 <%text>## this list be extended with additional keywords set here</%text>
442 441 appenlight.request_keys_blacklist =
443 442
444 443 <%text>## list of namespaces that should be ignores when gathering log entries</%text>
445 444 <%text>## can be string with comma separated list of namespaces</%text>
446 445 <%text>## (by default the client ignores own entries: appenlight_client.client)</%text>
447 446 appenlight.log_namespace_blacklist =
448 447
449 448 %elif error_aggregation_service == 'sentry':
450 449 <%text>################</%text>
451 450 <%text>### [sentry] ###</%text>
452 451 <%text>################</%text>
453 452
454 453 <%text>## sentry is a alternative open source error aggregator</%text>
455 454 <%text>## you must install python packages `sentry` and `raven` to enable</%text>
456 455
457 456 sentry.dsn = YOUR_DNS
458 457 sentry.servers =
459 458 sentry.name =
460 459 sentry.key =
461 460 sentry.public_key =
462 461 sentry.secret_key =
463 462 sentry.project =
464 463 sentry.site =
465 464 sentry.include_paths =
466 465 sentry.exclude_paths =
467 466
468 467 %endif
469 468 <%text>################################################################################</%text>
470 <%text>## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##</%text>
469 <%text>## WARNING: *DEBUG MODE MUST BE OFF IN A PRODUCTION ENVIRONMENT* ##</%text>
471 470 <%text>## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##</%text>
472 471 <%text>## execute malicious code after an exception is raised. ##</%text>
473 472 <%text>################################################################################</%text>
474 set debug = false
473 debug = false
475 474
476 475 <%text>##################################</%text>
477 476 <%text>### LOGVIEW CONFIG ###</%text>
478 477 <%text>##################################</%text>
479 478
480 479 logview.sqlalchemy = #faa
481 480 logview.pylons.templating = #bfb
482 481 logview.pylons.util = #eee
483 482
484 483 <%text>#########################################################</%text>
485 484 <%text>### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###</%text>
486 485 <%text>#########################################################</%text>
487 486
488 487 %if database_engine == 'sqlite':
489 488 # SQLITE [default]
490 489 sqlalchemy.url = sqlite:///${here}/kallithea.db?timeout=60
491 490
492 491 %elif database_engine == 'postgres':
493 492 # POSTGRESQL
494 493 sqlalchemy.url = postgresql://user:pass@localhost/kallithea
495 494
496 495 %elif database_engine == 'mysql':
497 496 # MySQL
498 497 sqlalchemy.url = mysql://user:pass@localhost/kallithea?charset=utf8
499 498
500 499 %endif
501 500 # see sqlalchemy docs for others
502 501
503 502 sqlalchemy.echo = false
504 503 sqlalchemy.pool_recycle = 3600
505 504
506 505 <%text>################################</%text>
507 506 <%text>### ALEMBIC CONFIGURATION ####</%text>
508 507 <%text>################################</%text>
509 508
510 509 [alembic]
511 510 script_location = kallithea:alembic
512 511
513 512 <%text>################################</%text>
514 513 <%text>### LOGGING CONFIGURATION ####</%text>
515 514 <%text>################################</%text>
516 515
517 516 [loggers]
518 517 keys = root, routes, kallithea, sqlalchemy, tg, gearbox, beaker, templates, whoosh_indexer
519 518
520 519 [handlers]
521 520 keys = console, console_sql
522 521
523 522 [formatters]
524 523 keys = generic, color_formatter, color_formatter_sql
525 524
526 525 <%text>#############</%text>
527 526 <%text>## LOGGERS ##</%text>
528 527 <%text>#############</%text>
529 528
530 529 [logger_root]
531 530 level = NOTSET
532 531 handlers = console
533 532
534 533 [logger_routes]
535 534 level = DEBUG
536 535 handlers =
537 536 qualname = routes.middleware
538 537 <%text>## "level = DEBUG" logs the route matched and routing variables.</%text>
539 538 propagate = 1
540 539
541 540 [logger_beaker]
542 541 level = DEBUG
543 542 handlers =
544 543 qualname = beaker.container
545 544 propagate = 1
546 545
547 546 [logger_templates]
548 547 level = INFO
549 548 handlers =
550 549 qualname = pylons.templating
551 550 propagate = 1
552 551
553 552 [logger_kallithea]
554 553 level = DEBUG
555 554 handlers =
556 555 qualname = kallithea
557 556 propagate = 1
558 557
559 558 [logger_tg]
560 559 level = DEBUG
561 560 handlers =
562 561 qualname = tg
563 562 propagate = 1
564 563
565 564 [logger_gearbox]
566 565 level = DEBUG
567 566 handlers =
568 567 qualname = gearbox
569 568 propagate = 1
570 569
571 570 [logger_sqlalchemy]
572 571 level = INFO
573 572 handlers = console_sql
574 573 qualname = sqlalchemy.engine
575 574 propagate = 0
576 575
577 576 [logger_whoosh_indexer]
578 577 level = DEBUG
579 578 handlers =
580 579 qualname = whoosh_indexer
581 580 propagate = 1
582 581
583 582 <%text>##############</%text>
584 583 <%text>## HANDLERS ##</%text>
585 584 <%text>##############</%text>
586 585
587 586 [handler_console]
588 587 class = StreamHandler
589 588 args = (sys.stderr,)
590 589 level = INFO
591 590 formatter = generic
592 591
593 592 [handler_console_sql]
594 593 class = StreamHandler
595 594 args = (sys.stderr,)
596 595 level = WARN
597 596 formatter = generic
598 597
599 598 <%text>################</%text>
600 599 <%text>## FORMATTERS ##</%text>
601 600 <%text>################</%text>
602 601
603 602 [formatter_generic]
604 603 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
605 604 datefmt = %Y-%m-%d %H:%M:%S
606 605
607 606 [formatter_color_formatter]
608 607 class = kallithea.lib.colored_formatter.ColorFormatter
609 608 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
610 609 datefmt = %Y-%m-%d %H:%M:%S
611 610
612 611 [formatter_color_formatter_sql]
613 612 class = kallithea.lib.colored_formatter.ColorFormatterSql
614 613 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
615 614 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,619 +1,618 b''
1 1 ################################################################################
2 2 ################################################################################
3 3 # Kallithea - config for tests: #
4 4 # initial_repo_scan = true #
5 5 # sqlalchemy and kallithea_test.sqlite #
6 6 # custom logging #
7 7 # #
8 8 # The %(here)s variable will be replaced with the parent directory of this file#
9 9 ################################################################################
10 10 ################################################################################
11 11
12 12 [DEFAULT]
13 debug = true
14 13
15 14 ################################################################################
16 15 ## Email settings ##
17 16 ## ##
18 17 ## Refer to the documentation ("Email settings") for more details. ##
19 18 ## ##
20 19 ## It is recommended to use a valid sender address that passes access ##
21 20 ## validation and spam filtering in mail servers. ##
22 21 ################################################################################
23 22
24 23 ## 'From' header for application emails. You can optionally add a name.
25 24 ## Default:
26 25 #app_email_from = Kallithea
27 26 ## Examples:
28 27 #app_email_from = Kallithea <kallithea-noreply@example.com>
29 28 #app_email_from = kallithea-noreply@example.com
30 29
31 30 ## Subject prefix for application emails.
32 31 ## A space between this prefix and the real subject is automatically added.
33 32 ## Default:
34 33 #email_prefix =
35 34 ## Example:
36 35 #email_prefix = [Kallithea]
37 36
38 37 ## Recipients for error emails and fallback recipients of application mails.
39 38 ## Multiple addresses can be specified, space-separated.
40 39 ## Only addresses are allowed, do not add any name part.
41 40 ## Default:
42 41 #email_to =
43 42 ## Examples:
44 43 #email_to = admin@example.com
45 44 #email_to = admin@example.com another_admin@example.com
46 45
47 46 ## 'From' header for error emails. You can optionally add a name.
48 47 ## Default:
49 48 #error_email_from = pylons@yourapp.com
50 49 ## Examples:
51 50 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
52 51 #error_email_from = paste_error@example.com
53 52
54 53 ## SMTP server settings
55 54 ## If specifying credentials, make sure to use secure connections.
56 55 ## Default: Send unencrypted unauthenticated mails to the specified smtp_server.
57 56 ## For "SSL", use smtp_use_ssl = true and smtp_port = 465.
58 57 ## For "STARTTLS", use smtp_use_tls = true and smtp_port = 587.
59 58 #smtp_server = smtp.example.com
60 59 #smtp_username =
61 60 #smtp_password =
62 61 #smtp_port = 25
63 62 #smtp_use_ssl = false
64 63 #smtp_use_tls = false
65 64
66 65 [server:main]
67 66 ## Gearbox default web server ##
68 67 #use = egg:gearbox#wsgiref
69 68 ## nr of worker threads to spawn
70 69 #threadpool_workers = 1
71 70 ## max request before thread respawn
72 71 #threadpool_max_requests = 100
73 72 ## option to use threads of process
74 73 #use_threadpool = true
75 74
76 75 ## Gearbox gevent web server ##
77 76 #use = egg:gearbox#gevent
78 77
79 78 ## WAITRESS ##
80 79 use = egg:waitress#main
81 80 ## number of worker threads
82 81 threads = 1
83 82 ## MAX BODY SIZE 100GB
84 83 max_request_body_size = 107374182400
85 84 ## use poll instead of select, fixes fd limits, may not work on old
86 85 ## windows systems.
87 86 #asyncore_use_poll = True
88 87
89 88 ## GUNICORN ##
90 89 #use = egg:gunicorn#main
91 90 ## number of process workers. You must set `instance_id = *` when this option
92 91 ## is set to more than one worker
93 92 #workers = 1
94 93 ## process name
95 94 #proc_name = kallithea
96 95 ## type of worker class, one of sync, eventlet, gevent, tornado
97 96 ## recommended for bigger setup is using of of other than sync one
98 97 #worker_class = sync
99 98 #max_requests = 1000
100 99 ## amount of time a worker can handle request before it gets killed and
101 100 ## restarted
102 101 #timeout = 3600
103 102
104 103 ## UWSGI ##
105 104 ## run with uwsgi --ini-paste-logged <inifile.ini>
106 105 #[uwsgi]
107 106 #socket = /tmp/uwsgi.sock
108 107 #master = true
109 108 #http = 127.0.0.1:5000
110 109
111 110 ## set as deamon and redirect all output to file
112 111 #daemonize = ./uwsgi_kallithea.log
113 112
114 113 ## master process PID
115 114 #pidfile = ./uwsgi_kallithea.pid
116 115
117 116 ## stats server with workers statistics, use uwsgitop
118 117 ## for monitoring, `uwsgitop 127.0.0.1:1717`
119 118 #stats = 127.0.0.1:1717
120 119 #memory-report = true
121 120
122 121 ## log 5XX errors
123 122 #log-5xx = true
124 123
125 124 ## Set the socket listen queue size.
126 125 #listen = 256
127 126
128 127 ## Gracefully Reload workers after the specified amount of managed requests
129 128 ## (avoid memory leaks).
130 129 #max-requests = 1000
131 130
132 131 ## enable large buffers
133 132 #buffer-size = 65535
134 133
135 134 ## socket and http timeouts ##
136 135 #http-timeout = 3600
137 136 #socket-timeout = 3600
138 137
139 138 ## Log requests slower than the specified number of milliseconds.
140 139 #log-slow = 10
141 140
142 141 ## Exit if no app can be loaded.
143 142 #need-app = true
144 143
145 144 ## Set lazy mode (load apps in workers instead of master).
146 145 #lazy = true
147 146
148 147 ## scaling ##
149 148 ## set cheaper algorithm to use, if not set default will be used
150 149 #cheaper-algo = spare
151 150
152 151 ## minimum number of workers to keep at all times
153 152 #cheaper = 1
154 153
155 154 ## number of workers to spawn at startup
156 155 #cheaper-initial = 1
157 156
158 157 ## maximum number of workers that can be spawned
159 158 #workers = 4
160 159
161 160 ## how many workers should be spawned at a time
162 161 #cheaper-step = 1
163 162
164 163 ## COMMON ##
165 164 host = 127.0.0.1
166 165 #port = 5000
167 166 port = 4999
168 167
169 168 ## middleware for hosting the WSGI application under a URL prefix
170 169 #[filter:proxy-prefix]
171 170 #use = egg:PasteDeploy#prefix
172 171 #prefix = /<your-prefix>
173 172
174 173 [app:main]
175 174 use = egg:kallithea
176 175 ## enable proxy prefix middleware
177 176 #filter-with = proxy-prefix
178 177
179 178 full_stack = true
180 179 static_files = true
181 180 ## Available Languages:
182 181 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
183 182 lang =
184 183 #cache_dir = %(here)s/data
185 184 cache_dir = %(here)s/../../data/test/cache
186 185 #index_dir = %(here)s/data/index
187 186 index_dir = %(here)s/../../data/test/index
188 187
189 188 ## perform a full repository scan on each server start, this should be
190 189 ## set to false after first startup, to allow faster server restarts.
191 190 #initial_repo_scan = false
192 191 initial_repo_scan = true
193 192
194 193 ## uncomment and set this path to use archive download cache
195 194 #archive_cache_dir = %(here)s/tarballcache
196 195 archive_cache_dir = %(here)s/../../data/test/tarballcache
197 196
198 197 ## change this to unique ID for security
199 198 app_instance_uuid = test
200 199
201 200 ## cut off limit for large diffs (size in bytes)
202 201 cut_off_limit = 256000
203 202
204 203 ## force https in Kallithea, fixes https redirects, assumes it's always https
205 204 force_https = false
206 205
207 206 ## use Strict-Transport-Security headers
208 207 use_htsts = false
209 208
210 209 ## number of commits stats will parse on each iteration
211 210 commit_parse_limit = 25
212 211
213 212 ## path to git executable
214 213 git_path = git
215 214
216 215 ## git rev filter option, --all is the default filter, if you need to
217 216 ## hide all refs in changelog switch this to --branches --tags
218 217 #git_rev_filter = --branches --tags
219 218
220 219 ## RSS feed options
221 220 rss_cut_off_limit = 256000
222 221 rss_items_per_page = 10
223 222 rss_include_diff = false
224 223
225 224 ## options for showing and identifying changesets
226 225 show_sha_length = 12
227 226 #show_revision_number = false
228 227 show_revision_number = true
229 228
230 229 ## Canonical URL to use when creating full URLs in UI and texts.
231 230 ## Useful when the site is available under different names or protocols.
232 231 ## Defaults to what is provided in the WSGI environment.
233 232 #canonical_url = https://kallithea.example.com/repos
234 233
235 234 ## gist URL alias, used to create nicer urls for gist. This should be an
236 235 ## url that does rewrites to _admin/gists/<gistid>.
237 236 ## example: http://gist.example.com/{gistid}. Empty means use the internal
238 237 ## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid>
239 238 gist_alias_url =
240 239
241 240 ## white list of API enabled controllers. This allows to add list of
242 241 ## controllers to which access will be enabled by api_key. eg: to enable
243 242 ## api access to raw_files put `FilesController:raw`, to enable access to patches
244 243 ## add `ChangesetController:changeset_patch`. This list should be "," separated
245 244 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
246 245 ## Recommended settings below are commented out:
247 246 api_access_controllers_whitelist =
248 247 # ChangesetController:changeset_patch,
249 248 # ChangesetController:changeset_raw,
250 249 # FilesController:raw,
251 250 # FilesController:archivefile
252 251
253 252 ## default encoding used to convert from and to unicode
254 253 ## can be also a comma separated list of encoding in case of mixed encodings
255 254 default_encoding = utf8
256 255
257 256 ## issue tracker for Kallithea (leave blank to disable, absent for default)
258 257 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
259 258
260 259 ## issue tracking mapping for commits messages
261 260 ## comment out issue_pat, issue_server, issue_prefix to enable
262 261
263 262 ## pattern to get the issues from commit messages
264 263 ## default one used here is #<numbers> with a regex passive group for `#`
265 264 ## {id} will be all groups matched from this pattern
266 265
267 266 issue_pat = (?:\s*#)(\d+)
268 267
269 268 ## server url to the issue, each {id} will be replaced with match
270 269 ## fetched from the regex and {repo} is replaced with full repository name
271 270 ## including groups {repo_name} is replaced with just name of repo
272 271
273 272 issue_server_link = https://issues.example.com/{repo}/issue/{id}
274 273
275 274 ## prefix to add to link to indicate it's an url
276 275 ## #314 will be replaced by <issue_prefix><id>
277 276
278 277 issue_prefix = #
279 278
280 279 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
281 280 ## multiple patterns, to other issues server, wiki or others
282 281 ## below an example how to create a wiki pattern
283 282 # wiki-some-id -> https://wiki.example.com/some-id
284 283
285 284 #issue_pat_wiki = (?:wiki-)(.+)
286 285 #issue_server_link_wiki = https://wiki.example.com/{id}
287 286 #issue_prefix_wiki = WIKI-
288 287
289 288 ## alternative return HTTP header for failed authentication. Default HTTP
290 289 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
291 290 ## handling that. Set this variable to 403 to return HTTPForbidden
292 291 auth_ret_code =
293 292
294 293 ## locking return code. When repository is locked return this HTTP code. 2XX
295 294 ## codes don't break the transactions while 4XX codes do
296 295 lock_ret_code = 423
297 296
298 297 ## allows to change the repository location in settings page
299 298 allow_repo_location_change = True
300 299
301 300 ## allows to setup custom hooks in settings page
302 301 allow_custom_hooks_settings = True
303 302
304 303 ## extra extensions for indexing, space separated and without the leading '.'.
305 304 # index.extensions =
306 305 # gemfile
307 306 # lock
308 307
309 308 ## extra filenames for indexing, space separated
310 309 # index.filenames =
311 310 # .dockerignore
312 311 # .editorconfig
313 312 # INSTALL
314 313 # CHANGELOG
315 314
316 315 ####################################
317 316 ### CELERY CONFIG ####
318 317 ####################################
319 318
320 319 use_celery = false
321 320
322 321 ## Example: connect to the virtual host 'rabbitmqhost' on localhost as rabbitmq:
323 322 broker.url = amqp://rabbitmq:qewqew@localhost:5672/rabbitmqhost
324 323
325 324 celery.imports = kallithea.lib.celerylib.tasks
326 325 celery.accept.content = pickle
327 326 celery.result.backend = amqp
328 327 celery.result.dburi = amqp://
329 328 celery.result.serialier = json
330 329
331 330 #celery.send.task.error.emails = true
332 331 #celery.amqp.task.result.expires = 18000
333 332
334 333 celeryd.concurrency = 2
335 334 celeryd.max.tasks.per.child = 1
336 335
337 336 ## If true, tasks will never be sent to the queue, but executed locally instead.
338 337 celery.always.eager = false
339 338
340 339 ####################################
341 340 ### BEAKER CACHE ####
342 341 ####################################
343 342
344 343 #beaker.cache.data_dir = %(here)s/data/cache/data
345 344 beaker.cache.data_dir = %(here)s/../../data/test/cache/data
346 345 #beaker.cache.lock_dir = %(here)s/data/cache/lock
347 346 beaker.cache.lock_dir = %(here)s/../../data/test/cache/lock
348 347
349 348 beaker.cache.regions = short_term,long_term,sql_cache_short
350 349
351 350 beaker.cache.short_term.type = memory
352 351 beaker.cache.short_term.expire = 60
353 352 beaker.cache.short_term.key_length = 256
354 353
355 354 beaker.cache.long_term.type = memory
356 355 beaker.cache.long_term.expire = 36000
357 356 beaker.cache.long_term.key_length = 256
358 357
359 358 beaker.cache.sql_cache_short.type = memory
360 359 #beaker.cache.sql_cache_short.expire = 10
361 360 beaker.cache.sql_cache_short.expire = 1
362 361 beaker.cache.sql_cache_short.key_length = 256
363 362
364 363 ####################################
365 364 ### BEAKER SESSION ####
366 365 ####################################
367 366
368 367 ## Name of session cookie. Should be unique for a given host and path, even when running
369 368 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
370 369 beaker.session.key = kallithea
371 370 ## Sessions should always only be accessible by the browser, not directly by JavaScript.
372 371 beaker.session.httponly = true
373 372 ## Session lifetime. 2592000 seconds is 30 days.
374 373 beaker.session.timeout = 2592000
375 374
376 375 ## Server secret used with HMAC to ensure integrity of cookies.
377 376 beaker.session.secret = {74e0cd75-b339-478b-b129-07dd221def1f}
378 377 ## Further, encrypt the data with AES.
379 378 #beaker.session.encrypt_key = <key_for_encryption>
380 379 #beaker.session.validate_key = <validation_key>
381 380
382 381 ## Type of storage used for the session, current types are
383 382 ## dbm, file, memcached, database, and memory.
384 383
385 384 ## File system storage of session data. (default)
386 385 #beaker.session.type = file
387 386
388 387 ## Cookie only, store all session data inside the cookie. Requires secure secrets.
389 388 #beaker.session.type = cookie
390 389
391 390 ## Database storage of session data.
392 391 #beaker.session.type = ext:database
393 392 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
394 393 #beaker.session.table_name = db_session
395 394
396 395 ############################
397 396 ## ERROR HANDLING SYSTEMS ##
398 397 ############################
399 398
400 399 ####################
401 400 ### [appenlight] ###
402 401 ####################
403 402
404 403 ## AppEnlight is tailored to work with Kallithea, see
405 404 ## http://appenlight.com for details how to obtain an account
406 405 ## you must install python package `appenlight_client` to make it work
407 406
408 407 ## appenlight enabled
409 408 appenlight = false
410 409
411 410 appenlight.server_url = https://api.appenlight.com
412 411 appenlight.api_key = YOUR_API_KEY
413 412
414 413 ## TWEAK AMOUNT OF INFO SENT HERE
415 414
416 415 ## enables 404 error logging (default False)
417 416 appenlight.report_404 = false
418 417
419 418 ## time in seconds after request is considered being slow (default 1)
420 419 appenlight.slow_request_time = 1
421 420
422 421 ## record slow requests in application
423 422 ## (needs to be enabled for slow datastore recording and time tracking)
424 423 appenlight.slow_requests = true
425 424
426 425 ## enable hooking to application loggers
427 426 #appenlight.logging = true
428 427
429 428 ## minimum log level for log capture
430 429 #appenlight.logging.level = WARNING
431 430
432 431 ## send logs only from erroneous/slow requests
433 432 ## (saves API quota for intensive logging)
434 433 appenlight.logging_on_error = false
435 434
436 435 ## list of additional keywords that should be grabbed from environ object
437 436 ## can be string with comma separated list of words in lowercase
438 437 ## (by default client will always send following info:
439 438 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
440 439 ## start with HTTP* this list be extended with additional keywords here
441 440 appenlight.environ_keys_whitelist =
442 441
443 442 ## list of keywords that should be blanked from request object
444 443 ## can be string with comma separated list of words in lowercase
445 444 ## (by default client will always blank keys that contain following words
446 445 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
447 446 ## this list be extended with additional keywords set here
448 447 appenlight.request_keys_blacklist =
449 448
450 449 ## list of namespaces that should be ignores when gathering log entries
451 450 ## can be string with comma separated list of namespaces
452 451 ## (by default the client ignores own entries: appenlight_client.client)
453 452 appenlight.log_namespace_blacklist =
454 453
455 454 ################
456 455 ### [sentry] ###
457 456 ################
458 457
459 458 ## sentry is a alternative open source error aggregator
460 459 ## you must install python packages `sentry` and `raven` to enable
461 460
462 461 sentry.dsn = YOUR_DNS
463 462 sentry.servers =
464 463 sentry.name =
465 464 sentry.key =
466 465 sentry.public_key =
467 466 sentry.secret_key =
468 467 sentry.project =
469 468 sentry.site =
470 469 sentry.include_paths =
471 470 sentry.exclude_paths =
472 471
473 472 ################################################################################
474 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
473 ## WARNING: *DEBUG MODE MUST BE OFF IN A PRODUCTION ENVIRONMENT* ##
475 474 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
476 475 ## execute malicious code after an exception is raised. ##
477 476 ################################################################################
478 set debug = false
477 debug = false
479 478
480 479 ##################################
481 480 ### LOGVIEW CONFIG ###
482 481 ##################################
483 482
484 483 logview.sqlalchemy = #faa
485 484 logview.pylons.templating = #bfb
486 485 logview.pylons.util = #eee
487 486
488 487 #########################################################
489 488 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
490 489 #########################################################
491 490
492 491 # SQLITE [default]
493 492 #sqlalchemy.url = sqlite:///%(here)s/kallithea.db?timeout=60
494 493 sqlalchemy.url = sqlite:///%(here)s/kallithea_test.sqlite
495 494
496 495 # POSTGRESQL
497 496 #sqlalchemy.url = postgresql://user:pass@localhost/kallithea
498 497
499 498 # MySQL
500 499 #sqlalchemy.url = mysql://user:pass@localhost/kallithea?charset=utf8
501 500
502 501 # see sqlalchemy docs for others
503 502
504 503 sqlalchemy.echo = false
505 504 sqlalchemy.pool_recycle = 3600
506 505
507 506 ################################
508 507 ### ALEMBIC CONFIGURATION ####
509 508 ################################
510 509
511 510 [alembic]
512 511 script_location = kallithea:alembic
513 512
514 513 ################################
515 514 ### LOGGING CONFIGURATION ####
516 515 ################################
517 516
518 517 [loggers]
519 518 keys = root, routes, kallithea, sqlalchemy, tg, gearbox, beaker, templates, whoosh_indexer
520 519
521 520 [handlers]
522 521 keys = console, console_sql
523 522
524 523 [formatters]
525 524 keys = generic, color_formatter, color_formatter_sql
526 525
527 526 #############
528 527 ## LOGGERS ##
529 528 #############
530 529
531 530 [logger_root]
532 531 level = NOTSET
533 532 handlers = console
534 533
535 534 [logger_routes]
536 535 level = DEBUG
537 536 handlers =
538 537 qualname = routes.middleware
539 538 ## "level = DEBUG" logs the route matched and routing variables.
540 539 propagate = 1
541 540
542 541 [logger_beaker]
543 542 level = DEBUG
544 543 handlers =
545 544 qualname = beaker.container
546 545 propagate = 1
547 546
548 547 [logger_templates]
549 548 level = INFO
550 549 handlers =
551 550 qualname = pylons.templating
552 551 propagate = 1
553 552
554 553 [logger_kallithea]
555 554 level = DEBUG
556 555 handlers =
557 556 qualname = kallithea
558 557 propagate = 1
559 558
560 559 [logger_tg]
561 560 level = DEBUG
562 561 handlers =
563 562 qualname = tg
564 563 propagate = 1
565 564
566 565 [logger_gearbox]
567 566 level = DEBUG
568 567 handlers =
569 568 qualname = gearbox
570 569 propagate = 1
571 570
572 571 [logger_sqlalchemy]
573 572 level = INFO
574 573 handlers = console_sql
575 574 qualname = sqlalchemy.engine
576 575 propagate = 0
577 576
578 577 [logger_whoosh_indexer]
579 578 level = DEBUG
580 579 handlers =
581 580 qualname = whoosh_indexer
582 581 propagate = 1
583 582
584 583 ##############
585 584 ## HANDLERS ##
586 585 ##############
587 586
588 587 [handler_console]
589 588 class = StreamHandler
590 589 args = (sys.stderr,)
591 590 #level = INFO
592 591 level = DEBUG
593 592 #formatter = generic
594 593 formatter = color_formatter
595 594
596 595 [handler_console_sql]
597 596 class = StreamHandler
598 597 args = (sys.stderr,)
599 598 level = WARN
600 599 #formatter = generic
601 600 formatter = color_formatter_sql
602 601
603 602 ################
604 603 ## FORMATTERS ##
605 604 ################
606 605
607 606 [formatter_generic]
608 607 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
609 608 datefmt = %Y-%m-%d %H:%M:%S
610 609
611 610 [formatter_color_formatter]
612 611 class = kallithea.lib.colored_formatter.ColorFormatter
613 612 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
614 613 datefmt = %Y-%m-%d %H:%M:%S
615 614
616 615 [formatter_color_formatter_sql]
617 616 class = kallithea.lib.colored_formatter.ColorFormatterSql
618 617 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
619 618 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,168 +1,168 b''
1 1 #!/usr/bin/env python2
2 2 """
3 3 Based on kallithea/lib/paster_commands/template.ini.mako, generate
4 4 development.ini
5 5 kallithea/tests/test.ini
6 6 """
7 7
8 8 import re
9 9
10 10 makofile = 'kallithea/lib/paster_commands/template.ini.mako'
11 11
12 12 # the mako conditionals used in all other ini files and templates
13 13 selected_mako_conditionals = set([
14 14 "database_engine == 'sqlite'",
15 15 "http_server == 'waitress'",
16 16 "error_aggregation_service == 'appenlight'",
17 17 "error_aggregation_service == 'sentry'",
18 18 ])
19 19
20 20 # the mako variables used in all other ini files and templates
21 21 mako_variable_values = {
22 22 'host': '127.0.0.1',
23 23 'port': '5000',
24 24 'here': '%(here)s',
25 25 'uuid()': '${app_instance_uuid}',
26 26 }
27 27
28 28 # files to be generated from the mako template
29 29 ini_files = [
30 30 ('kallithea/tests/test.ini',
31 31 '''
32 32 Kallithea - config for tests:
33 33 initial_repo_scan = true
34 34 sqlalchemy and kallithea_test.sqlite
35 35 custom logging
36 36
37 37 The %(here)s variable will be replaced with the parent directory of this file
38 38 ''',
39 39 {
40 40 '[server:main]': {
41 41 'port': '4999',
42 42 },
43 43 '[app:main]': {
44 44 'initial_repo_scan': 'true',
45 45 'app_instance_uuid': 'test',
46 46 'show_revision_number': 'true',
47 47 'beaker.cache.sql_cache_short.expire': '1',
48 48 'beaker.session.secret': '{74e0cd75-b339-478b-b129-07dd221def1f}',
49 49 'cache_dir': '%(here)s/../../data/test/cache',
50 50 'index_dir': '%(here)s/../../data/test/index',
51 51 'archive_cache_dir': '%(here)s/../../data/test/tarballcache',
52 52 'beaker.cache.data_dir': '%(here)s/../../data/test/cache/data',
53 53 'beaker.cache.lock_dir': '%(here)s/../../data/test/cache/lock',
54 54 'sqlalchemy.url': 'sqlite:///%(here)s/kallithea_test.sqlite',
55 55 },
56 56 '[handler_console]': {
57 57 'level': 'DEBUG',
58 58 'formatter': 'color_formatter',
59 59 },
60 60 # The 'handler_console_sql' block is very similar to the one in
61 61 # development.ini, but without the explicit 'level=DEBUG' setting:
62 62 # it causes duplicate sqlalchemy debug logs, one through
63 63 # handler_console_sql and another through another path.
64 64 '[handler_console_sql]': {
65 65 'formatter': 'color_formatter_sql',
66 66 },
67 67 },
68 68 ),
69 69 ('development.ini',
70 70 '''
71 71 Kallithea - Development config:
72 72 listening on *:5000
73 73 sqlite and kallithea.db
74 74 initial_repo_scan = true
75 set debug = true
75 debug = true
76 76 verbose and colorful logging
77 77
78 78 The %(here)s variable will be replaced with the parent directory of this file
79 79 ''',
80 80 {
81 81 '[server:main]': {
82 82 'host': '0.0.0.0',
83 83 },
84 84 '[app:main]': {
85 85 'initial_repo_scan': 'true',
86 'set debug': 'true',
86 'debug': 'true',
87 87 'app_instance_uuid': 'development-not-secret',
88 88 'beaker.session.secret': 'development-not-secret',
89 89 },
90 90 '[handler_console]': {
91 91 'level': 'DEBUG',
92 92 'formatter': 'color_formatter',
93 93 },
94 94 '[handler_console_sql]': {
95 95 'level': 'DEBUG',
96 96 'formatter': 'color_formatter_sql',
97 97 },
98 98 },
99 99 ),
100 100 ]
101 101
102 102
103 103 def main():
104 104 # make sure all mako lines starting with '#' (the '##' comments) are marked up as <text>
105 105 print 'reading:', makofile
106 106 mako_org = file(makofile).read()
107 107 mako_no_text_markup = re.sub(r'</?%text>', '', mako_org)
108 108 mako_marked_up = re.sub(r'\n(##.*)', r'\n<%text>\1</%text>', mako_no_text_markup, flags=re.MULTILINE)
109 109 if mako_marked_up != mako_org:
110 110 print 'writing:', makofile
111 111 file(makofile, 'w').write(mako_marked_up)
112 112
113 113 # select the right mako conditionals for the other less sophisticated formats
114 114 def sub_conditionals(m):
115 115 """given a %if...%endif match, replace with just the selected
116 116 conditional sections enabled and the rest as comments
117 117 """
118 118 conditional_lines = m.group(1)
119 119 def sub_conditional(m):
120 120 """given a conditional and the corresponding lines, return them raw
121 121 or commented out, based on whether conditional is selected
122 122 """
123 123 criteria, lines = m.groups()
124 124 if criteria not in selected_mako_conditionals:
125 125 lines = '\n'.join((l if not l or l.startswith('#') else '#' + l) for l in lines.split('\n'))
126 126 return lines
127 127 conditional_lines = re.sub(r'^%(?:el)?if (.*):\n((?:^[^%\n].*\n|\n)*)',
128 128 sub_conditional, conditional_lines, flags=re.MULTILINE)
129 129 return conditional_lines
130 130 mako_no_conditionals = re.sub(r'^(%if .*\n(?:[^%\n].*\n|%elif .*\n|\n)*)%endif\n',
131 131 sub_conditionals, mako_no_text_markup, flags=re.MULTILINE)
132 132
133 133 # expand mako variables
134 134 def pyrepl(m):
135 135 return mako_variable_values.get(m.group(1), m.group(0))
136 136 mako_no_variables = re.sub(r'\${([^}]*)}', pyrepl, mako_no_conditionals)
137 137
138 138 # remove utf-8 coding header
139 139 base_ini = re.sub(r'^## -\*- coding: utf-8 -\*-\n', '', mako_no_variables)
140 140
141 141 # create ini files
142 142 for fn, desc, settings in ini_files:
143 143 print 'updating:', fn
144 144 ini_lines = re.sub(
145 145 '# Kallithea - config file generated with kallithea-config *#\n',
146 146 ''.join('# %-77s#\n' % l.strip() for l in desc.strip().split('\n')),
147 147 base_ini)
148 148 def process_section(m):
149 149 """process a ini section, replacing values as necessary"""
150 150 sectionname, lines = m.groups()
151 151 if sectionname in settings:
152 152 section_settings = settings[sectionname]
153 153 def process_line(m):
154 154 """process a section line and update value if necessary"""
155 155 setting, value = m.groups()
156 156 line = m.group(0)
157 157 if setting in section_settings:
158 158 line = '%s = %s' % (setting, section_settings[setting])
159 159 if '$' not in value:
160 160 line = '#%s = %s\n%s' % (setting, value, line)
161 161 return line.rstrip()
162 162 lines = re.sub(r'^([^#\n].*) = ?(.*)', process_line, lines, flags=re.MULTILINE)
163 163 return sectionname + '\n' + lines
164 164 ini_lines = re.sub(r'^(\[.*\])\n((?:(?:[^[\n].*)?\n)*)', process_section, ini_lines, flags=re.MULTILINE)
165 165 file(fn, 'w').write(ini_lines)
166 166
167 167 if __name__ == '__main__':
168 168 main()
General Comments 0
You need to be logged in to leave comments. Login now