Show More
@@ -1,470 +1,465 b'' | |||
|
1 | 1 | ################################################################################ |
|
2 | 2 | ################################################################################ |
|
3 | 3 | # Kallithea - config file generated with kallithea-config # |
|
4 | 4 | # # |
|
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 | |
|
11 | 11 | ################################################################################ |
|
12 | 12 | ## Email settings ## |
|
13 | 13 | ## ## |
|
14 | 14 | ## Refer to the documentation ("Email settings") for more details. ## |
|
15 | 15 | ## ## |
|
16 | 16 | ## It is recommended to use a valid sender address that passes access ## |
|
17 | 17 | ## validation and spam filtering in mail servers. ## |
|
18 | 18 | ################################################################################ |
|
19 | 19 | |
|
20 | 20 | ## 'From' header for application emails. You can optionally add a name. |
|
21 | 21 | ## Default: |
|
22 | 22 | #app_email_from = Kallithea |
|
23 | 23 | ## Examples: |
|
24 | 24 | #app_email_from = Kallithea <kallithea-noreply@example.com> |
|
25 | 25 | #app_email_from = kallithea-noreply@example.com |
|
26 | 26 | |
|
27 | 27 | ## Subject prefix for application emails. |
|
28 | 28 | ## A space between this prefix and the real subject is automatically added. |
|
29 | 29 | ## Default: |
|
30 | 30 | #email_prefix = |
|
31 | 31 | ## Example: |
|
32 | 32 | #email_prefix = [Kallithea] |
|
33 | 33 | |
|
34 | 34 | ## Recipients for error emails and fallback recipients of application mails. |
|
35 | 35 | ## Multiple addresses can be specified, comma-separated. |
|
36 | 36 | ## Only addresses are allowed, do not add any name part. |
|
37 | 37 | ## Default: |
|
38 | 38 | #email_to = |
|
39 | 39 | ## Examples: |
|
40 | 40 | #email_to = admin@example.com |
|
41 | 41 | #email_to = admin@example.com,another_admin@example.com |
|
42 | 42 | email_to = |
|
43 | 43 | |
|
44 | 44 | ## 'From' header for error emails. You can optionally add a name. |
|
45 | 45 | ## Default: (none) |
|
46 | 46 | ## Examples: |
|
47 | 47 | #error_email_from = Kallithea Errors <kallithea-noreply@example.com> |
|
48 | 48 | #error_email_from = kallithea_errors@example.com |
|
49 | 49 | error_email_from = |
|
50 | 50 | |
|
51 | 51 | ## SMTP server settings |
|
52 | 52 | ## If specifying credentials, make sure to use secure connections. |
|
53 | 53 | ## Default: Send unencrypted unauthenticated mails to the specified smtp_server. |
|
54 | 54 | ## For "SSL", use smtp_use_ssl = true and smtp_port = 465. |
|
55 | 55 | ## For "STARTTLS", use smtp_use_tls = true and smtp_port = 587. |
|
56 | 56 | smtp_server = |
|
57 | 57 | #smtp_username = |
|
58 | 58 | #smtp_password = |
|
59 | 59 | smtp_port = |
|
60 | 60 | #smtp_use_ssl = false |
|
61 | 61 | #smtp_use_tls = false |
|
62 | 62 | |
|
63 | 63 | ## Entry point for 'gearbox serve' |
|
64 | 64 | [server:main] |
|
65 | 65 | #host = 127.0.0.1 |
|
66 | 66 | host = 0.0.0.0 |
|
67 | 67 | port = 5000 |
|
68 | 68 | |
|
69 | 69 | ## WAITRESS ## |
|
70 | 70 | use = egg:waitress#main |
|
71 | 71 | ## number of worker threads |
|
72 | 72 | threads = 1 |
|
73 | 73 | ## MAX BODY SIZE 100GB |
|
74 | 74 | max_request_body_size = 107374182400 |
|
75 | 75 | ## use poll instead of select, fixes fd limits, may not work on old |
|
76 | 76 | ## windows systems. |
|
77 | 77 | #asyncore_use_poll = True |
|
78 | 78 | |
|
79 | 79 | ## middleware for hosting the WSGI application under a URL prefix |
|
80 | 80 | #[filter:proxy-prefix] |
|
81 | 81 | #use = egg:PasteDeploy#prefix |
|
82 | 82 | #prefix = /<your-prefix> |
|
83 | 83 | |
|
84 | 84 | [app:main] |
|
85 | 85 | use = egg:kallithea |
|
86 | 86 | ## enable proxy prefix middleware |
|
87 | 87 | #filter-with = proxy-prefix |
|
88 | 88 | |
|
89 | 89 | full_stack = true |
|
90 | 90 | static_files = true |
|
91 | 91 | |
|
92 | 92 | ## Internationalization (see setup documentation for details) |
|
93 | 93 | ## By default, the language requested by the browser is used if available. |
|
94 | 94 | #i18n.enable = false |
|
95 | 95 | ## Fallback language, empty for English (valid values are the names of subdirectories in kallithea/i18n): |
|
96 | 96 | i18n.lang = |
|
97 | 97 | |
|
98 | 98 | cache_dir = %(here)s/data |
|
99 | 99 | index_dir = %(here)s/data/index |
|
100 | 100 | |
|
101 | ## perform a full repository scan on each server start, this should be | |
|
102 | ## set to false after first startup, to allow faster server restarts. | |
|
103 | #initial_repo_scan = false | |
|
104 | initial_repo_scan = true | |
|
105 | ||
|
106 | 101 | ## uncomment and set this path to use archive download cache |
|
107 | 102 | archive_cache_dir = %(here)s/tarballcache |
|
108 | 103 | |
|
109 | 104 | ## change this to unique ID for security |
|
110 | 105 | #app_instance_uuid = VERY-SECRET |
|
111 | 106 | app_instance_uuid = development-not-secret |
|
112 | 107 | |
|
113 | 108 | ## cut off limit for large diffs (size in bytes) |
|
114 | 109 | cut_off_limit = 256000 |
|
115 | 110 | |
|
116 | 111 | ## force https in Kallithea, fixes https redirects, assumes it's always https |
|
117 | 112 | force_https = false |
|
118 | 113 | |
|
119 | 114 | ## use Strict-Transport-Security headers |
|
120 | 115 | use_htsts = false |
|
121 | 116 | |
|
122 | 117 | ## number of commits stats will parse on each iteration |
|
123 | 118 | commit_parse_limit = 25 |
|
124 | 119 | |
|
125 | 120 | ## path to git executable |
|
126 | 121 | git_path = git |
|
127 | 122 | |
|
128 | 123 | ## git rev filter option, --all is the default filter, if you need to |
|
129 | 124 | ## hide all refs in changelog switch this to --branches --tags |
|
130 | 125 | #git_rev_filter = --branches --tags |
|
131 | 126 | |
|
132 | 127 | ## RSS feed options |
|
133 | 128 | rss_cut_off_limit = 256000 |
|
134 | 129 | rss_items_per_page = 10 |
|
135 | 130 | rss_include_diff = false |
|
136 | 131 | |
|
137 | 132 | ## options for showing and identifying changesets |
|
138 | 133 | show_sha_length = 12 |
|
139 | 134 | show_revision_number = false |
|
140 | 135 | |
|
141 | 136 | ## Canonical URL to use when creating full URLs in UI and texts. |
|
142 | 137 | ## Useful when the site is available under different names or protocols. |
|
143 | 138 | ## Defaults to what is provided in the WSGI environment. |
|
144 | 139 | #canonical_url = https://kallithea.example.com/repos |
|
145 | 140 | |
|
146 | 141 | ## gist URL alias, used to create nicer urls for gist. This should be an |
|
147 | 142 | ## url that does rewrites to _admin/gists/<gistid>. |
|
148 | 143 | ## example: http://gist.example.com/{gistid}. Empty means use the internal |
|
149 | 144 | ## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid> |
|
150 | 145 | gist_alias_url = |
|
151 | 146 | |
|
152 | 147 | ## white list of API enabled controllers. This allows to add list of |
|
153 | 148 | ## controllers to which access will be enabled by api_key. eg: to enable |
|
154 | 149 | ## api access to raw_files put `FilesController:raw`, to enable access to patches |
|
155 | 150 | ## add `ChangesetController:changeset_patch`. This list should be "," separated |
|
156 | 151 | ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names |
|
157 | 152 | ## Recommended settings below are commented out: |
|
158 | 153 | api_access_controllers_whitelist = |
|
159 | 154 | # ChangesetController:changeset_patch, |
|
160 | 155 | # ChangesetController:changeset_raw, |
|
161 | 156 | # FilesController:raw, |
|
162 | 157 | # FilesController:archivefile |
|
163 | 158 | |
|
164 | 159 | ## default encoding used to convert from and to unicode |
|
165 | 160 | ## can be also a comma separated list of encoding in case of mixed encodings |
|
166 | 161 | default_encoding = utf8 |
|
167 | 162 | |
|
168 | 163 | ## issue tracker for Kallithea (leave blank to disable, absent for default) |
|
169 | 164 | #bugtracker = https://bitbucket.org/conservancy/kallithea/issues |
|
170 | 165 | |
|
171 | 166 | ## issue tracking mapping for commit messages, comments, PR descriptions, ... |
|
172 | 167 | ## Refer to the documentation ("Integration with issue trackers") for more details. |
|
173 | 168 | |
|
174 | 169 | ## regular expression to match issue references |
|
175 | 170 | ## This pattern may/should contain parenthesized groups, that can |
|
176 | 171 | ## be referred to in issue_server_link or issue_sub using Python backreferences |
|
177 | 172 | ## (e.g. \1, \2, ...). You can also create named groups with '(?P<groupname>)'. |
|
178 | 173 | ## To require mandatory whitespace before the issue pattern, use: |
|
179 | 174 | ## (?:^|(?<=\s)) before the actual pattern, and for mandatory whitespace |
|
180 | 175 | ## behind the issue pattern, use (?:$|(?=\s)) after the actual pattern. |
|
181 | 176 | |
|
182 | 177 | issue_pat = #(\d+) |
|
183 | 178 | |
|
184 | 179 | ## server url to the issue |
|
185 | 180 | ## This pattern may/should contain backreferences to parenthesized groups in issue_pat. |
|
186 | 181 | ## A backreference can be \1, \2, ... or \g<groupname> if you specified a named group |
|
187 | 182 | ## called 'groupname' in issue_pat. |
|
188 | 183 | ## The special token {repo} is replaced with the full repository name |
|
189 | 184 | ## including repository groups, while {repo_name} is replaced with just |
|
190 | 185 | ## the name of the repository. |
|
191 | 186 | |
|
192 | 187 | issue_server_link = https://issues.example.com/{repo}/issue/\1 |
|
193 | 188 | |
|
194 | 189 | ## substitution pattern to use as the link text |
|
195 | 190 | ## If issue_sub is empty, the text matched by issue_pat is retained verbatim |
|
196 | 191 | ## for the link text. Otherwise, the link text is that of issue_sub, with any |
|
197 | 192 | ## backreferences to groups in issue_pat replaced. |
|
198 | 193 | |
|
199 | 194 | issue_sub = |
|
200 | 195 | |
|
201 | 196 | ## issue_pat, issue_server_link and issue_sub can have suffixes to specify |
|
202 | 197 | ## multiple patterns, to other issues server, wiki or others |
|
203 | 198 | ## below an example how to create a wiki pattern |
|
204 | 199 | # wiki-some-id -> https://wiki.example.com/some-id |
|
205 | 200 | |
|
206 | 201 | #issue_pat_wiki = wiki-(\S+) |
|
207 | 202 | #issue_server_link_wiki = https://wiki.example.com/\1 |
|
208 | 203 | #issue_sub_wiki = WIKI-\1 |
|
209 | 204 | |
|
210 | 205 | ## alternative return HTTP header for failed authentication. Default HTTP |
|
211 | 206 | ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with |
|
212 | 207 | ## handling that. Set this variable to 403 to return HTTPForbidden |
|
213 | 208 | auth_ret_code = |
|
214 | 209 | |
|
215 | 210 | ## locking return code. When repository is locked return this HTTP code. 2XX |
|
216 | 211 | ## codes don't break the transactions while 4XX codes do |
|
217 | 212 | lock_ret_code = 423 |
|
218 | 213 | |
|
219 | 214 | ## allows to change the repository location in settings page |
|
220 | 215 | allow_repo_location_change = True |
|
221 | 216 | |
|
222 | 217 | ## allows to setup custom hooks in settings page |
|
223 | 218 | allow_custom_hooks_settings = True |
|
224 | 219 | |
|
225 | 220 | ## extra extensions for indexing, space separated and without the leading '.'. |
|
226 | 221 | # index.extensions = |
|
227 | 222 | # gemfile |
|
228 | 223 | # lock |
|
229 | 224 | |
|
230 | 225 | ## extra filenames for indexing, space separated |
|
231 | 226 | # index.filenames = |
|
232 | 227 | # .dockerignore |
|
233 | 228 | # .editorconfig |
|
234 | 229 | # INSTALL |
|
235 | 230 | # CHANGELOG |
|
236 | 231 | |
|
237 | 232 | #################################### |
|
238 | 233 | ### CELERY CONFIG #### |
|
239 | 234 | #################################### |
|
240 | 235 | |
|
241 | 236 | use_celery = false |
|
242 | 237 | |
|
243 | 238 | ## Example: connect to the virtual host 'rabbitmqhost' on localhost as rabbitmq: |
|
244 | 239 | broker.url = amqp://rabbitmq:qewqew@localhost:5672/rabbitmqhost |
|
245 | 240 | |
|
246 | 241 | celery.imports = kallithea.lib.celerylib.tasks |
|
247 | 242 | celery.accept.content = pickle |
|
248 | 243 | celery.result.backend = amqp |
|
249 | 244 | celery.result.dburi = amqp:// |
|
250 | 245 | celery.result.serialier = json |
|
251 | 246 | |
|
252 | 247 | #celery.send.task.error.emails = true |
|
253 | 248 | #celery.amqp.task.result.expires = 18000 |
|
254 | 249 | |
|
255 | 250 | celeryd.concurrency = 2 |
|
256 | 251 | celeryd.max.tasks.per.child = 1 |
|
257 | 252 | |
|
258 | 253 | ## If true, tasks will never be sent to the queue, but executed locally instead. |
|
259 | 254 | celery.always.eager = false |
|
260 | 255 | |
|
261 | 256 | #################################### |
|
262 | 257 | ### BEAKER CACHE #### |
|
263 | 258 | #################################### |
|
264 | 259 | |
|
265 | 260 | beaker.cache.data_dir = %(here)s/data/cache/data |
|
266 | 261 | beaker.cache.lock_dir = %(here)s/data/cache/lock |
|
267 | 262 | |
|
268 | 263 | beaker.cache.regions = short_term,long_term,sql_cache_short |
|
269 | 264 | |
|
270 | 265 | beaker.cache.short_term.type = memory |
|
271 | 266 | beaker.cache.short_term.expire = 60 |
|
272 | 267 | beaker.cache.short_term.key_length = 256 |
|
273 | 268 | |
|
274 | 269 | beaker.cache.long_term.type = memory |
|
275 | 270 | beaker.cache.long_term.expire = 36000 |
|
276 | 271 | beaker.cache.long_term.key_length = 256 |
|
277 | 272 | |
|
278 | 273 | beaker.cache.sql_cache_short.type = memory |
|
279 | 274 | beaker.cache.sql_cache_short.expire = 10 |
|
280 | 275 | beaker.cache.sql_cache_short.key_length = 256 |
|
281 | 276 | |
|
282 | 277 | #################################### |
|
283 | 278 | ### BEAKER SESSION #### |
|
284 | 279 | #################################### |
|
285 | 280 | |
|
286 | 281 | ## Name of session cookie. Should be unique for a given host and path, even when running |
|
287 | 282 | ## on different ports. Otherwise, cookie sessions will be shared and messed up. |
|
288 | 283 | beaker.session.key = kallithea |
|
289 | 284 | ## Sessions should always only be accessible by the browser, not directly by JavaScript. |
|
290 | 285 | beaker.session.httponly = true |
|
291 | 286 | ## Session lifetime. 2592000 seconds is 30 days. |
|
292 | 287 | beaker.session.timeout = 2592000 |
|
293 | 288 | |
|
294 | 289 | ## Server secret used with HMAC to ensure integrity of cookies. |
|
295 | 290 | #beaker.session.secret = VERY-SECRET |
|
296 | 291 | beaker.session.secret = development-not-secret |
|
297 | 292 | ## Further, encrypt the data with AES. |
|
298 | 293 | #beaker.session.encrypt_key = <key_for_encryption> |
|
299 | 294 | #beaker.session.validate_key = <validation_key> |
|
300 | 295 | |
|
301 | 296 | ## Type of storage used for the session, current types are |
|
302 | 297 | ## dbm, file, memcached, database, and memory. |
|
303 | 298 | |
|
304 | 299 | ## File system storage of session data. (default) |
|
305 | 300 | #beaker.session.type = file |
|
306 | 301 | |
|
307 | 302 | ## Cookie only, store all session data inside the cookie. Requires secure secrets. |
|
308 | 303 | #beaker.session.type = cookie |
|
309 | 304 | |
|
310 | 305 | ## Database storage of session data. |
|
311 | 306 | #beaker.session.type = ext:database |
|
312 | 307 | #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea |
|
313 | 308 | #beaker.session.table_name = db_session |
|
314 | 309 | |
|
315 | 310 | ################################################################################ |
|
316 | 311 | ## WARNING: *DEBUG MODE MUST BE OFF IN A PRODUCTION ENVIRONMENT* ## |
|
317 | 312 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
318 | 313 | ## execute malicious code after an exception is raised. ## |
|
319 | 314 | ################################################################################ |
|
320 | 315 | #debug = false |
|
321 | 316 | debug = true |
|
322 | 317 | |
|
323 | 318 | ################################## |
|
324 | 319 | ### LOGVIEW CONFIG ### |
|
325 | 320 | ################################## |
|
326 | 321 | |
|
327 | 322 | logview.sqlalchemy = #faa |
|
328 | 323 | logview.pylons.templating = #bfb |
|
329 | 324 | logview.pylons.util = #eee |
|
330 | 325 | |
|
331 | 326 | ######################################################### |
|
332 | 327 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
333 | 328 | ######################################################### |
|
334 | 329 | |
|
335 | 330 | # SQLITE [default] |
|
336 | 331 | sqlalchemy.url = sqlite:///%(here)s/kallithea.db?timeout=60 |
|
337 | 332 | |
|
338 | 333 | # see sqlalchemy docs for others |
|
339 | 334 | |
|
340 | 335 | sqlalchemy.pool_recycle = 3600 |
|
341 | 336 | |
|
342 | 337 | ################################ |
|
343 | 338 | ### ALEMBIC CONFIGURATION #### |
|
344 | 339 | ################################ |
|
345 | 340 | |
|
346 | 341 | [alembic] |
|
347 | 342 | script_location = kallithea:alembic |
|
348 | 343 | |
|
349 | 344 | ################################ |
|
350 | 345 | ### LOGGING CONFIGURATION #### |
|
351 | 346 | ################################ |
|
352 | 347 | |
|
353 | 348 | [loggers] |
|
354 | 349 | keys = root, routes, kallithea, sqlalchemy, tg, gearbox, beaker, templates, whoosh_indexer, werkzeug, backlash |
|
355 | 350 | |
|
356 | 351 | [handlers] |
|
357 | 352 | keys = console, console_sql |
|
358 | 353 | |
|
359 | 354 | [formatters] |
|
360 | 355 | keys = generic, color_formatter, color_formatter_sql |
|
361 | 356 | |
|
362 | 357 | ############# |
|
363 | 358 | ## LOGGERS ## |
|
364 | 359 | ############# |
|
365 | 360 | |
|
366 | 361 | [logger_root] |
|
367 | 362 | level = NOTSET |
|
368 | 363 | handlers = console |
|
369 | 364 | |
|
370 | 365 | [logger_routes] |
|
371 | 366 | #level = WARN |
|
372 | 367 | level = DEBUG |
|
373 | 368 | handlers = |
|
374 | 369 | qualname = routes.middleware |
|
375 | 370 | ## "level = DEBUG" logs the route matched and routing variables. |
|
376 | 371 | propagate = 1 |
|
377 | 372 | |
|
378 | 373 | [logger_beaker] |
|
379 | 374 | #level = WARN |
|
380 | 375 | level = DEBUG |
|
381 | 376 | handlers = |
|
382 | 377 | qualname = beaker.container |
|
383 | 378 | propagate = 1 |
|
384 | 379 | |
|
385 | 380 | [logger_templates] |
|
386 | 381 | #level = WARN |
|
387 | 382 | level = INFO |
|
388 | 383 | handlers = |
|
389 | 384 | qualname = pylons.templating |
|
390 | 385 | propagate = 1 |
|
391 | 386 | |
|
392 | 387 | [logger_kallithea] |
|
393 | 388 | #level = WARN |
|
394 | 389 | level = DEBUG |
|
395 | 390 | handlers = |
|
396 | 391 | qualname = kallithea |
|
397 | 392 | propagate = 1 |
|
398 | 393 | |
|
399 | 394 | [logger_tg] |
|
400 | 395 | #level = WARN |
|
401 | 396 | level = DEBUG |
|
402 | 397 | handlers = |
|
403 | 398 | qualname = tg |
|
404 | 399 | propagate = 1 |
|
405 | 400 | |
|
406 | 401 | [logger_gearbox] |
|
407 | 402 | #level = WARN |
|
408 | 403 | level = DEBUG |
|
409 | 404 | handlers = |
|
410 | 405 | qualname = gearbox |
|
411 | 406 | propagate = 1 |
|
412 | 407 | |
|
413 | 408 | [logger_sqlalchemy] |
|
414 | 409 | level = WARN |
|
415 | 410 | handlers = console_sql |
|
416 | 411 | qualname = sqlalchemy.engine |
|
417 | 412 | propagate = 0 |
|
418 | 413 | |
|
419 | 414 | [logger_whoosh_indexer] |
|
420 | 415 | #level = WARN |
|
421 | 416 | level = DEBUG |
|
422 | 417 | handlers = |
|
423 | 418 | qualname = whoosh_indexer |
|
424 | 419 | propagate = 1 |
|
425 | 420 | |
|
426 | 421 | [logger_werkzeug] |
|
427 | 422 | level = WARN |
|
428 | 423 | handlers = |
|
429 | 424 | qualname = werkzeug |
|
430 | 425 | propagate = 1 |
|
431 | 426 | |
|
432 | 427 | [logger_backlash] |
|
433 | 428 | level = WARN |
|
434 | 429 | handlers = |
|
435 | 430 | qualname = backlash |
|
436 | 431 | propagate = 1 |
|
437 | 432 | |
|
438 | 433 | ############## |
|
439 | 434 | ## HANDLERS ## |
|
440 | 435 | ############## |
|
441 | 436 | |
|
442 | 437 | [handler_console] |
|
443 | 438 | class = StreamHandler |
|
444 | 439 | args = (sys.stderr,) |
|
445 | 440 | #formatter = generic |
|
446 | 441 | formatter = color_formatter |
|
447 | 442 | |
|
448 | 443 | [handler_console_sql] |
|
449 | 444 | class = StreamHandler |
|
450 | 445 | args = (sys.stderr,) |
|
451 | 446 | #formatter = generic |
|
452 | 447 | formatter = color_formatter_sql |
|
453 | 448 | |
|
454 | 449 | ################ |
|
455 | 450 | ## FORMATTERS ## |
|
456 | 451 | ################ |
|
457 | 452 | |
|
458 | 453 | [formatter_generic] |
|
459 | 454 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
460 | 455 | datefmt = %Y-%m-%d %H:%M:%S |
|
461 | 456 | |
|
462 | 457 | [formatter_color_formatter] |
|
463 | 458 | class = kallithea.lib.colored_formatter.ColorFormatter |
|
464 | 459 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
465 | 460 | datefmt = %Y-%m-%d %H:%M:%S |
|
466 | 461 | |
|
467 | 462 | [formatter_color_formatter_sql] |
|
468 | 463 | class = kallithea.lib.colored_formatter.ColorFormatterSql |
|
469 | 464 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
470 | 465 | datefmt = %Y-%m-%d %H:%M:%S |
@@ -1,196 +1,192 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | # This program is free software: you can redistribute it and/or modify |
|
3 | 3 | # it under the terms of the GNU General Public License as published by |
|
4 | 4 | # the Free Software Foundation, either version 3 of the License, or |
|
5 | 5 | # (at your option) any later version. |
|
6 | 6 | # |
|
7 | 7 | # This program is distributed in the hope that it will be useful, |
|
8 | 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9 | 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
10 | 10 | # GNU General Public License for more details. |
|
11 | 11 | # |
|
12 | 12 | # You should have received a copy of the GNU General Public License |
|
13 | 13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
14 | 14 | """ |
|
15 | 15 | Global configuration file for TurboGears2 specific settings in Kallithea. |
|
16 | 16 | |
|
17 | 17 | This file complements the .ini file. |
|
18 | 18 | """ |
|
19 | 19 | |
|
20 | 20 | import platform |
|
21 | 21 | import os, sys, logging |
|
22 | 22 | |
|
23 | 23 | import tg |
|
24 | 24 | from tg import hooks |
|
25 | 25 | from tg.configuration import AppConfig |
|
26 | 26 | from tg.support.converters import asbool |
|
27 | 27 | import alembic.config |
|
28 | 28 | from alembic.script.base import ScriptDirectory |
|
29 | 29 | from alembic.migration import MigrationContext |
|
30 | 30 | from sqlalchemy import create_engine |
|
31 | 31 | |
|
32 | 32 | from kallithea.lib.middleware.https_fixup import HttpsFixup |
|
33 | 33 | from kallithea.lib.middleware.simplegit import SimpleGit |
|
34 | 34 | from kallithea.lib.middleware.simplehg import SimpleHg |
|
35 | 35 | from kallithea.lib.auth import set_available_permissions |
|
36 | 36 | from kallithea.lib.utils import load_rcextensions, make_ui, set_app_settings, set_vcs_config, \ |
|
37 | 37 | set_indexer_config, check_git_version, repo2db_mapper |
|
38 | 38 | from kallithea.lib.utils2 import str2bool |
|
39 | 39 | import kallithea.model.base |
|
40 | 40 | from kallithea.model.scm import ScmModel |
|
41 | 41 | |
|
42 | 42 | import formencode |
|
43 | 43 | |
|
44 | 44 | log = logging.getLogger(__name__) |
|
45 | 45 | |
|
46 | 46 | |
|
47 | 47 | class KallitheaAppConfig(AppConfig): |
|
48 | 48 | # Note: AppConfig has a misleading name, as it's not the application |
|
49 | 49 | # configuration, but the application configurator. The AppConfig values are |
|
50 | 50 | # used as a template to create the actual configuration, which might |
|
51 | 51 | # overwrite or extend the one provided by the configurator template. |
|
52 | 52 | |
|
53 | 53 | # To make it clear, AppConfig creates the config and sets into it the same |
|
54 | 54 | # values that AppConfig itself has. Then the values from the config file and |
|
55 | 55 | # gearbox options are loaded and merged into the configuration. Then an |
|
56 | 56 | # after_init_config(conf) method of AppConfig is called for any change that |
|
57 | 57 | # might depend on options provided by configuration files. |
|
58 | 58 | |
|
59 | 59 | def __init__(self): |
|
60 | 60 | super(KallitheaAppConfig, self).__init__() |
|
61 | 61 | |
|
62 | 62 | self['package'] = kallithea |
|
63 | 63 | |
|
64 | 64 | self['prefer_toscawidgets2'] = False |
|
65 | 65 | self['use_toscawidgets'] = False |
|
66 | 66 | |
|
67 | 67 | self['renderers'] = [] |
|
68 | 68 | |
|
69 | 69 | # Enable json in expose |
|
70 | 70 | self['renderers'].append('json') |
|
71 | 71 | |
|
72 | 72 | # Configure template rendering |
|
73 | 73 | self['renderers'].append('mako') |
|
74 | 74 | self['default_renderer'] = 'mako' |
|
75 | 75 | self['use_dotted_templatenames'] = False |
|
76 | 76 | |
|
77 | 77 | # Configure Sessions, store data as JSON to avoid pickle security issues |
|
78 | 78 | self['session.enabled'] = True |
|
79 | 79 | self['session.data_serializer'] = 'json' |
|
80 | 80 | |
|
81 | 81 | # Configure the base SQLALchemy Setup |
|
82 | 82 | self['use_sqlalchemy'] = True |
|
83 | 83 | self['model'] = kallithea.model.base |
|
84 | 84 | self['DBSession'] = kallithea.model.meta.Session |
|
85 | 85 | |
|
86 | 86 | # Configure App without an authentication backend. |
|
87 | 87 | self['auth_backend'] = None |
|
88 | 88 | |
|
89 | 89 | # Use custom error page for these errors. By default, Turbogears2 does not add |
|
90 | 90 | # 400 in this list. |
|
91 | 91 | # Explicitly listing all is considered more robust than appending to defaults, |
|
92 | 92 | # in light of possible future framework changes. |
|
93 | 93 | self['errorpage.status_codes'] = [400, 401, 403, 404] |
|
94 | 94 | |
|
95 | 95 | # Disable transaction manager -- currently Kallithea takes care of transactions itself |
|
96 | 96 | self['tm.enabled'] = False |
|
97 | 97 | |
|
98 | 98 | |
|
99 | 99 | base_config = KallitheaAppConfig() |
|
100 | 100 | |
|
101 | 101 | # TODO still needed as long as we use pylonslib |
|
102 | 102 | sys.modules['pylons'] = tg |
|
103 | 103 | |
|
104 | 104 | # DebugBar, a debug toolbar for TurboGears2. |
|
105 | 105 | # (https://github.com/TurboGears/tgext.debugbar) |
|
106 | 106 | # To enable it, install 'tgext.debugbar' and 'kajiki', and run Kallithea with |
|
107 | 107 | # 'debug = true' (not in production!) |
|
108 | 108 | # See the Kallithea documentation for more information. |
|
109 | 109 | try: |
|
110 | 110 | from tgext.debugbar import enable_debugbar |
|
111 | 111 | import kajiki # only to check its existence |
|
112 | 112 | except ImportError: |
|
113 | 113 | pass |
|
114 | 114 | else: |
|
115 | 115 | base_config['renderers'].append('kajiki') |
|
116 | 116 | enable_debugbar(base_config) |
|
117 | 117 | |
|
118 | 118 | |
|
119 | 119 | def setup_configuration(app): |
|
120 | 120 | config = app.config |
|
121 | 121 | |
|
122 | 122 | if config.get('ignore_alembic_revision', False): |
|
123 | 123 | log.warn('database alembic revision checking is disabled') |
|
124 | 124 | else: |
|
125 | 125 | dbconf = config['sqlalchemy.url'] |
|
126 | 126 | alembic_cfg = alembic.config.Config() |
|
127 | 127 | alembic_cfg.set_main_option('script_location', 'kallithea:alembic') |
|
128 | 128 | alembic_cfg.set_main_option('sqlalchemy.url', dbconf) |
|
129 | 129 | script_dir = ScriptDirectory.from_config(alembic_cfg) |
|
130 | 130 | available_heads = sorted(script_dir.get_heads()) |
|
131 | 131 | |
|
132 | 132 | engine = create_engine(dbconf) |
|
133 | 133 | with engine.connect() as conn: |
|
134 | 134 | context = MigrationContext.configure(conn) |
|
135 | 135 | current_heads = sorted(str(s) for s in context.get_current_heads()) |
|
136 | 136 | if current_heads != available_heads: |
|
137 | 137 | log.error('Failed to run Kallithea:\n\n' |
|
138 | 138 | 'The database version does not match the Kallithea version.\n' |
|
139 | 139 | 'Please read the documentation on how to upgrade or downgrade the database.\n' |
|
140 | 140 | 'Current database version id(s): %s\n' |
|
141 | 141 | 'Expected database version id(s): %s\n' |
|
142 | 142 | 'If you are a developer and you know what you are doing, you can add `ignore_alembic_revision = True` ' |
|
143 | 143 | 'to your .ini file to skip the check.\n' % (' '.join(current_heads), ' '.join(available_heads))) |
|
144 | 144 | sys.exit(1) |
|
145 | 145 | |
|
146 | 146 | # store some globals into kallithea |
|
147 | 147 | kallithea.CELERY_ON = str2bool(config['app_conf'].get('use_celery')) |
|
148 | 148 | kallithea.CELERY_EAGER = str2bool(config['app_conf'].get('celery.always.eager')) |
|
149 | 149 | kallithea.CONFIG = config |
|
150 | 150 | |
|
151 | 151 | load_rcextensions(root_path=config['here']) |
|
152 | 152 | |
|
153 | 153 | set_available_permissions(config) |
|
154 | 154 | repos_path = make_ui('db').configitems('paths')[0][1] |
|
155 | 155 | config['base_path'] = repos_path |
|
156 | 156 | set_app_settings(config) |
|
157 | 157 | |
|
158 | 158 | instance_id = kallithea.CONFIG.get('instance_id', '*') |
|
159 | 159 | if instance_id == '*': |
|
160 | 160 | instance_id = '%s-%s' % (platform.uname()[1], os.getpid()) |
|
161 | 161 | kallithea.CONFIG['instance_id'] = instance_id |
|
162 | 162 | |
|
163 | 163 | # update kallithea.CONFIG with the meanwhile changed 'config' |
|
164 | 164 | kallithea.CONFIG.update(config) |
|
165 | 165 | |
|
166 | 166 | # configure vcs and indexer libraries (they are supposed to be independent |
|
167 | 167 | # as much as possible and thus avoid importing tg.config or |
|
168 | 168 | # kallithea.CONFIG). |
|
169 | 169 | set_vcs_config(kallithea.CONFIG) |
|
170 | 170 | set_indexer_config(kallithea.CONFIG) |
|
171 | 171 | |
|
172 | 172 | check_git_version() |
|
173 | 173 | |
|
174 | if str2bool(config.get('initial_repo_scan', True)): | |
|
175 | repo2db_mapper(ScmModel().repo_scan(repos_path), | |
|
176 | remove_obsolete=False, install_git_hooks=False) | |
|
177 | ||
|
178 | 174 | |
|
179 | 175 | hooks.register('configure_new_app', setup_configuration) |
|
180 | 176 | |
|
181 | 177 | |
|
182 | 178 | def setup_application(app): |
|
183 | 179 | config = app.config |
|
184 | 180 | |
|
185 | 181 | # we want our low level middleware to get to the request ASAP. We don't |
|
186 | 182 | # need any stack middleware in them - especially no StatusCodeRedirect buffering |
|
187 | 183 | app = SimpleHg(app, config) |
|
188 | 184 | app = SimpleGit(app, config) |
|
189 | 185 | |
|
190 | 186 | # Enable https redirects based on HTTP_X_URL_SCHEME set by proxy |
|
191 | 187 | if any(asbool(config.get(x)) for x in ['https_fixup', 'force_https', 'use_htsts']): |
|
192 | 188 | app = HttpsFixup(app, config) |
|
193 | 189 | return app |
|
194 | 190 | |
|
195 | 191 | |
|
196 | 192 | hooks.register('before_config', setup_application) |
@@ -1,649 +1,645 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 | # # |
|
6 | 6 | # The %(here)s variable will be replaced with the parent directory of this file# |
|
7 | 7 | <%text>################################################################################</%text> |
|
8 | 8 | <%text>################################################################################</%text> |
|
9 | 9 | |
|
10 | 10 | [DEFAULT] |
|
11 | 11 | |
|
12 | 12 | <%text>################################################################################</%text> |
|
13 | 13 | <%text>## Email settings ##</%text> |
|
14 | 14 | <%text>## ##</%text> |
|
15 | 15 | <%text>## Refer to the documentation ("Email settings") for more details. ##</%text> |
|
16 | 16 | <%text>## ##</%text> |
|
17 | 17 | <%text>## It is recommended to use a valid sender address that passes access ##</%text> |
|
18 | 18 | <%text>## validation and spam filtering in mail servers. ##</%text> |
|
19 | 19 | <%text>################################################################################</%text> |
|
20 | 20 | |
|
21 | 21 | <%text>## 'From' header for application emails. You can optionally add a name.</%text> |
|
22 | 22 | <%text>## Default:</%text> |
|
23 | 23 | #app_email_from = Kallithea |
|
24 | 24 | <%text>## Examples:</%text> |
|
25 | 25 | #app_email_from = Kallithea <kallithea-noreply@example.com> |
|
26 | 26 | #app_email_from = kallithea-noreply@example.com |
|
27 | 27 | |
|
28 | 28 | <%text>## Subject prefix for application emails.</%text> |
|
29 | 29 | <%text>## A space between this prefix and the real subject is automatically added.</%text> |
|
30 | 30 | <%text>## Default:</%text> |
|
31 | 31 | #email_prefix = |
|
32 | 32 | <%text>## Example:</%text> |
|
33 | 33 | #email_prefix = [Kallithea] |
|
34 | 34 | |
|
35 | 35 | <%text>## Recipients for error emails and fallback recipients of application mails.</%text> |
|
36 | 36 | <%text>## Multiple addresses can be specified, comma-separated.</%text> |
|
37 | 37 | <%text>## Only addresses are allowed, do not add any name part.</%text> |
|
38 | 38 | <%text>## Default:</%text> |
|
39 | 39 | #email_to = |
|
40 | 40 | <%text>## Examples:</%text> |
|
41 | 41 | #email_to = admin@example.com |
|
42 | 42 | #email_to = admin@example.com,another_admin@example.com |
|
43 | 43 | email_to = |
|
44 | 44 | |
|
45 | 45 | <%text>## 'From' header for error emails. You can optionally add a name.</%text> |
|
46 | 46 | <%text>## Default: (none)</%text> |
|
47 | 47 | <%text>## Examples:</%text> |
|
48 | 48 | #error_email_from = Kallithea Errors <kallithea-noreply@example.com> |
|
49 | 49 | #error_email_from = kallithea_errors@example.com |
|
50 | 50 | error_email_from = |
|
51 | 51 | |
|
52 | 52 | <%text>## SMTP server settings</%text> |
|
53 | 53 | <%text>## If specifying credentials, make sure to use secure connections.</%text> |
|
54 | 54 | <%text>## Default: Send unencrypted unauthenticated mails to the specified smtp_server.</%text> |
|
55 | 55 | <%text>## For "SSL", use smtp_use_ssl = true and smtp_port = 465.</%text> |
|
56 | 56 | <%text>## For "STARTTLS", use smtp_use_tls = true and smtp_port = 587.</%text> |
|
57 | 57 | smtp_server = |
|
58 | 58 | #smtp_username = |
|
59 | 59 | #smtp_password = |
|
60 | 60 | smtp_port = |
|
61 | 61 | #smtp_use_ssl = false |
|
62 | 62 | #smtp_use_tls = false |
|
63 | 63 | |
|
64 | 64 | %if http_server != 'uwsgi': |
|
65 | 65 | <%text>## Entry point for 'gearbox serve'</%text> |
|
66 | 66 | [server:main] |
|
67 | 67 | host = ${host} |
|
68 | 68 | port = ${port} |
|
69 | 69 | |
|
70 | 70 | %if http_server == 'gearbox': |
|
71 | 71 | <%text>## Gearbox default web server ##</%text> |
|
72 | 72 | use = egg:gearbox#wsgiref |
|
73 | 73 | <%text>## nr of worker threads to spawn</%text> |
|
74 | 74 | threadpool_workers = 1 |
|
75 | 75 | <%text>## max request before thread respawn</%text> |
|
76 | 76 | threadpool_max_requests = 100 |
|
77 | 77 | <%text>## option to use threads of process</%text> |
|
78 | 78 | use_threadpool = true |
|
79 | 79 | |
|
80 | 80 | %elif http_server == 'gevent': |
|
81 | 81 | <%text>## Gearbox gevent web server ##</%text> |
|
82 | 82 | use = egg:gearbox#gevent |
|
83 | 83 | |
|
84 | 84 | %elif http_server == 'waitress': |
|
85 | 85 | <%text>## WAITRESS ##</%text> |
|
86 | 86 | use = egg:waitress#main |
|
87 | 87 | <%text>## number of worker threads</%text> |
|
88 | 88 | threads = 1 |
|
89 | 89 | <%text>## MAX BODY SIZE 100GB</%text> |
|
90 | 90 | max_request_body_size = 107374182400 |
|
91 | 91 | <%text>## use poll instead of select, fixes fd limits, may not work on old</%text> |
|
92 | 92 | <%text>## windows systems.</%text> |
|
93 | 93 | #asyncore_use_poll = True |
|
94 | 94 | |
|
95 | 95 | %elif http_server == 'gunicorn': |
|
96 | 96 | <%text>## GUNICORN ##</%text> |
|
97 | 97 | use = egg:gunicorn#main |
|
98 | 98 | <%text>## number of process workers. You must set `instance_id = *` when this option</%text> |
|
99 | 99 | <%text>## is set to more than one worker</%text> |
|
100 | 100 | workers = 4 |
|
101 | 101 | <%text>## process name</%text> |
|
102 | 102 | proc_name = kallithea |
|
103 | 103 | <%text>## type of worker class, one of sync, eventlet, gevent, tornado</%text> |
|
104 | 104 | <%text>## recommended for bigger setup is using of of other than sync one</%text> |
|
105 | 105 | worker_class = sync |
|
106 | 106 | max_requests = 1000 |
|
107 | 107 | <%text>## amount of time a worker can handle request before it gets killed and</%text> |
|
108 | 108 | <%text>## restarted</%text> |
|
109 | 109 | timeout = 3600 |
|
110 | 110 | |
|
111 | 111 | %endif |
|
112 | 112 | %else: |
|
113 | 113 | <%text>## UWSGI ##</%text> |
|
114 | 114 | <%text>## run with uwsgi --ini-paste-logged <inifile.ini></%text> |
|
115 | 115 | [uwsgi] |
|
116 | 116 | socket = /tmp/uwsgi.sock |
|
117 | 117 | master = true |
|
118 | 118 | http = ${host}:${port} |
|
119 | 119 | |
|
120 | 120 | <%text>## set as daemon and redirect all output to file</%text> |
|
121 | 121 | #daemonize = ./uwsgi_kallithea.log |
|
122 | 122 | |
|
123 | 123 | <%text>## master process PID</%text> |
|
124 | 124 | pidfile = ./uwsgi_kallithea.pid |
|
125 | 125 | |
|
126 | 126 | <%text>## stats server with workers statistics, use uwsgitop</%text> |
|
127 | 127 | <%text>## for monitoring, `uwsgitop 127.0.0.1:1717`</%text> |
|
128 | 128 | stats = 127.0.0.1:1717 |
|
129 | 129 | memory-report = true |
|
130 | 130 | |
|
131 | 131 | <%text>## log 5XX errors</%text> |
|
132 | 132 | log-5xx = true |
|
133 | 133 | |
|
134 | 134 | <%text>## Set the socket listen queue size.</%text> |
|
135 | 135 | listen = 128 |
|
136 | 136 | |
|
137 | 137 | <%text>## Gracefully Reload workers after the specified amount of managed requests</%text> |
|
138 | 138 | <%text>## (avoid memory leaks).</%text> |
|
139 | 139 | max-requests = 1000 |
|
140 | 140 | |
|
141 | 141 | <%text>## enable large buffers</%text> |
|
142 | 142 | buffer-size = 65535 |
|
143 | 143 | |
|
144 | 144 | <%text>## socket and http timeouts ##</%text> |
|
145 | 145 | http-timeout = 3600 |
|
146 | 146 | socket-timeout = 3600 |
|
147 | 147 | |
|
148 | 148 | <%text>## Log requests slower than the specified number of milliseconds.</%text> |
|
149 | 149 | log-slow = 10 |
|
150 | 150 | |
|
151 | 151 | <%text>## Exit if no app can be loaded.</%text> |
|
152 | 152 | need-app = true |
|
153 | 153 | |
|
154 | 154 | <%text>## Set lazy mode (load apps in workers instead of master).</%text> |
|
155 | 155 | lazy = true |
|
156 | 156 | |
|
157 | 157 | <%text>## scaling ##</%text> |
|
158 | 158 | <%text>## set cheaper algorithm to use, if not set default will be used</%text> |
|
159 | 159 | cheaper-algo = spare |
|
160 | 160 | |
|
161 | 161 | <%text>## minimum number of workers to keep at all times</%text> |
|
162 | 162 | cheaper = 1 |
|
163 | 163 | |
|
164 | 164 | <%text>## number of workers to spawn at startup</%text> |
|
165 | 165 | cheaper-initial = 1 |
|
166 | 166 | |
|
167 | 167 | <%text>## maximum number of workers that can be spawned</%text> |
|
168 | 168 | workers = 4 |
|
169 | 169 | |
|
170 | 170 | <%text>## how many workers should be spawned at a time</%text> |
|
171 | 171 | cheaper-step = 1 |
|
172 | 172 | |
|
173 | 173 | %endif |
|
174 | 174 | <%text>## middleware for hosting the WSGI application under a URL prefix</%text> |
|
175 | 175 | #[filter:proxy-prefix] |
|
176 | 176 | #use = egg:PasteDeploy#prefix |
|
177 | 177 | #prefix = /<your-prefix> |
|
178 | 178 | |
|
179 | 179 | [app:main] |
|
180 | 180 | use = egg:kallithea |
|
181 | 181 | <%text>## enable proxy prefix middleware</%text> |
|
182 | 182 | #filter-with = proxy-prefix |
|
183 | 183 | |
|
184 | 184 | full_stack = true |
|
185 | 185 | static_files = true |
|
186 | 186 | |
|
187 | 187 | <%text>## Internationalization (see setup documentation for details)</%text> |
|
188 | 188 | <%text>## By default, the language requested by the browser is used if available.</%text> |
|
189 | 189 | #i18n.enable = false |
|
190 | 190 | <%text>## Fallback language, empty for English (valid values are the names of subdirectories in kallithea/i18n):</%text> |
|
191 | 191 | i18n.lang = |
|
192 | 192 | |
|
193 | 193 | cache_dir = %(here)s/data |
|
194 | 194 | index_dir = %(here)s/data/index |
|
195 | 195 | |
|
196 | <%text>## perform a full repository scan on each server start, this should be</%text> | |
|
197 | <%text>## set to false after first startup, to allow faster server restarts.</%text> | |
|
198 | initial_repo_scan = false | |
|
199 | ||
|
200 | 196 | <%text>## uncomment and set this path to use archive download cache</%text> |
|
201 | 197 | archive_cache_dir = %(here)s/tarballcache |
|
202 | 198 | |
|
203 | 199 | <%text>## change this to unique ID for security</%text> |
|
204 | 200 | app_instance_uuid = ${uuid()} |
|
205 | 201 | |
|
206 | 202 | <%text>## cut off limit for large diffs (size in bytes)</%text> |
|
207 | 203 | cut_off_limit = 256000 |
|
208 | 204 | |
|
209 | 205 | <%text>## force https in Kallithea, fixes https redirects, assumes it's always https</%text> |
|
210 | 206 | force_https = false |
|
211 | 207 | |
|
212 | 208 | <%text>## use Strict-Transport-Security headers</%text> |
|
213 | 209 | use_htsts = false |
|
214 | 210 | |
|
215 | 211 | <%text>## number of commits stats will parse on each iteration</%text> |
|
216 | 212 | commit_parse_limit = 25 |
|
217 | 213 | |
|
218 | 214 | <%text>## path to git executable</%text> |
|
219 | 215 | git_path = git |
|
220 | 216 | |
|
221 | 217 | <%text>## git rev filter option, --all is the default filter, if you need to</%text> |
|
222 | 218 | <%text>## hide all refs in changelog switch this to --branches --tags</%text> |
|
223 | 219 | #git_rev_filter = --branches --tags |
|
224 | 220 | |
|
225 | 221 | <%text>## RSS feed options</%text> |
|
226 | 222 | rss_cut_off_limit = 256000 |
|
227 | 223 | rss_items_per_page = 10 |
|
228 | 224 | rss_include_diff = false |
|
229 | 225 | |
|
230 | 226 | <%text>## options for showing and identifying changesets</%text> |
|
231 | 227 | show_sha_length = 12 |
|
232 | 228 | show_revision_number = false |
|
233 | 229 | |
|
234 | 230 | <%text>## Canonical URL to use when creating full URLs in UI and texts.</%text> |
|
235 | 231 | <%text>## Useful when the site is available under different names or protocols.</%text> |
|
236 | 232 | <%text>## Defaults to what is provided in the WSGI environment.</%text> |
|
237 | 233 | #canonical_url = https://kallithea.example.com/repos |
|
238 | 234 | |
|
239 | 235 | <%text>## gist URL alias, used to create nicer urls for gist. This should be an</%text> |
|
240 | 236 | <%text>## url that does rewrites to _admin/gists/<gistid>.</%text> |
|
241 | 237 | <%text>## example: http://gist.example.com/{gistid}. Empty means use the internal</%text> |
|
242 | 238 | <%text>## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid></%text> |
|
243 | 239 | gist_alias_url = |
|
244 | 240 | |
|
245 | 241 | <%text>## white list of API enabled controllers. This allows to add list of</%text> |
|
246 | 242 | <%text>## controllers to which access will be enabled by api_key. eg: to enable</%text> |
|
247 | 243 | <%text>## api access to raw_files put `FilesController:raw`, to enable access to patches</%text> |
|
248 | 244 | <%text>## add `ChangesetController:changeset_patch`. This list should be "," separated</%text> |
|
249 | 245 | <%text>## Syntax is <ControllerClass>:<function>. Check debug logs for generated names</%text> |
|
250 | 246 | <%text>## Recommended settings below are commented out:</%text> |
|
251 | 247 | api_access_controllers_whitelist = |
|
252 | 248 | # ChangesetController:changeset_patch, |
|
253 | 249 | # ChangesetController:changeset_raw, |
|
254 | 250 | # FilesController:raw, |
|
255 | 251 | # FilesController:archivefile |
|
256 | 252 | |
|
257 | 253 | <%text>## default encoding used to convert from and to unicode</%text> |
|
258 | 254 | <%text>## can be also a comma separated list of encoding in case of mixed encodings</%text> |
|
259 | 255 | default_encoding = utf8 |
|
260 | 256 | |
|
261 | 257 | <%text>## issue tracker for Kallithea (leave blank to disable, absent for default)</%text> |
|
262 | 258 | #bugtracker = https://bitbucket.org/conservancy/kallithea/issues |
|
263 | 259 | |
|
264 | 260 | <%text>## issue tracking mapping for commit messages, comments, PR descriptions, ...</%text> |
|
265 | 261 | <%text>## Refer to the documentation ("Integration with issue trackers") for more details.</%text> |
|
266 | 262 | |
|
267 | 263 | <%text>## regular expression to match issue references</%text> |
|
268 | 264 | <%text>## This pattern may/should contain parenthesized groups, that can</%text> |
|
269 | 265 | <%text>## be referred to in issue_server_link or issue_sub using Python backreferences</%text> |
|
270 | 266 | <%text>## (e.g. \1, \2, ...). You can also create named groups with '(?P<groupname>)'.</%text> |
|
271 | 267 | <%text>## To require mandatory whitespace before the issue pattern, use:</%text> |
|
272 | 268 | <%text>## (?:^|(?<=\s)) before the actual pattern, and for mandatory whitespace</%text> |
|
273 | 269 | <%text>## behind the issue pattern, use (?:$|(?=\s)) after the actual pattern.</%text> |
|
274 | 270 | |
|
275 | 271 | issue_pat = #(\d+) |
|
276 | 272 | |
|
277 | 273 | <%text>## server url to the issue</%text> |
|
278 | 274 | <%text>## This pattern may/should contain backreferences to parenthesized groups in issue_pat.</%text> |
|
279 | 275 | <%text>## A backreference can be \1, \2, ... or \g<groupname> if you specified a named group</%text> |
|
280 | 276 | <%text>## called 'groupname' in issue_pat.</%text> |
|
281 | 277 | <%text>## The special token {repo} is replaced with the full repository name</%text> |
|
282 | 278 | <%text>## including repository groups, while {repo_name} is replaced with just</%text> |
|
283 | 279 | <%text>## the name of the repository.</%text> |
|
284 | 280 | |
|
285 | 281 | issue_server_link = https://issues.example.com/{repo}/issue/\1 |
|
286 | 282 | |
|
287 | 283 | <%text>## substitution pattern to use as the link text</%text> |
|
288 | 284 | <%text>## If issue_sub is empty, the text matched by issue_pat is retained verbatim</%text> |
|
289 | 285 | <%text>## for the link text. Otherwise, the link text is that of issue_sub, with any</%text> |
|
290 | 286 | <%text>## backreferences to groups in issue_pat replaced.</%text> |
|
291 | 287 | |
|
292 | 288 | issue_sub = |
|
293 | 289 | |
|
294 | 290 | <%text>## issue_pat, issue_server_link and issue_sub can have suffixes to specify</%text> |
|
295 | 291 | <%text>## multiple patterns, to other issues server, wiki or others</%text> |
|
296 | 292 | <%text>## below an example how to create a wiki pattern</%text> |
|
297 | 293 | # wiki-some-id -> https://wiki.example.com/some-id |
|
298 | 294 | |
|
299 | 295 | #issue_pat_wiki = wiki-(\S+) |
|
300 | 296 | #issue_server_link_wiki = https://wiki.example.com/\1 |
|
301 | 297 | #issue_sub_wiki = WIKI-\1 |
|
302 | 298 | |
|
303 | 299 | <%text>## alternative return HTTP header for failed authentication. Default HTTP</%text> |
|
304 | 300 | <%text>## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with</%text> |
|
305 | 301 | <%text>## handling that. Set this variable to 403 to return HTTPForbidden</%text> |
|
306 | 302 | auth_ret_code = |
|
307 | 303 | |
|
308 | 304 | <%text>## locking return code. When repository is locked return this HTTP code. 2XX</%text> |
|
309 | 305 | <%text>## codes don't break the transactions while 4XX codes do</%text> |
|
310 | 306 | lock_ret_code = 423 |
|
311 | 307 | |
|
312 | 308 | <%text>## allows to change the repository location in settings page</%text> |
|
313 | 309 | allow_repo_location_change = True |
|
314 | 310 | |
|
315 | 311 | <%text>## allows to setup custom hooks in settings page</%text> |
|
316 | 312 | allow_custom_hooks_settings = True |
|
317 | 313 | |
|
318 | 314 | <%text>## extra extensions for indexing, space separated and without the leading '.'.</%text> |
|
319 | 315 | # index.extensions = |
|
320 | 316 | # gemfile |
|
321 | 317 | # lock |
|
322 | 318 | |
|
323 | 319 | <%text>## extra filenames for indexing, space separated</%text> |
|
324 | 320 | # index.filenames = |
|
325 | 321 | # .dockerignore |
|
326 | 322 | # .editorconfig |
|
327 | 323 | # INSTALL |
|
328 | 324 | # CHANGELOG |
|
329 | 325 | |
|
330 | 326 | <%text>####################################</%text> |
|
331 | 327 | <%text>### CELERY CONFIG ####</%text> |
|
332 | 328 | <%text>####################################</%text> |
|
333 | 329 | |
|
334 | 330 | use_celery = false |
|
335 | 331 | |
|
336 | 332 | <%text>## Example: connect to the virtual host 'rabbitmqhost' on localhost as rabbitmq:</%text> |
|
337 | 333 | broker.url = amqp://rabbitmq:qewqew@localhost:5672/rabbitmqhost |
|
338 | 334 | |
|
339 | 335 | celery.imports = kallithea.lib.celerylib.tasks |
|
340 | 336 | celery.accept.content = pickle |
|
341 | 337 | celery.result.backend = amqp |
|
342 | 338 | celery.result.dburi = amqp:// |
|
343 | 339 | celery.result.serialier = json |
|
344 | 340 | |
|
345 | 341 | #celery.send.task.error.emails = true |
|
346 | 342 | #celery.amqp.task.result.expires = 18000 |
|
347 | 343 | |
|
348 | 344 | celeryd.concurrency = 2 |
|
349 | 345 | celeryd.max.tasks.per.child = 1 |
|
350 | 346 | |
|
351 | 347 | <%text>## If true, tasks will never be sent to the queue, but executed locally instead.</%text> |
|
352 | 348 | celery.always.eager = false |
|
353 | 349 | |
|
354 | 350 | <%text>####################################</%text> |
|
355 | 351 | <%text>### BEAKER CACHE ####</%text> |
|
356 | 352 | <%text>####################################</%text> |
|
357 | 353 | |
|
358 | 354 | beaker.cache.data_dir = %(here)s/data/cache/data |
|
359 | 355 | beaker.cache.lock_dir = %(here)s/data/cache/lock |
|
360 | 356 | |
|
361 | 357 | beaker.cache.regions = short_term,long_term,sql_cache_short |
|
362 | 358 | |
|
363 | 359 | beaker.cache.short_term.type = memory |
|
364 | 360 | beaker.cache.short_term.expire = 60 |
|
365 | 361 | beaker.cache.short_term.key_length = 256 |
|
366 | 362 | |
|
367 | 363 | beaker.cache.long_term.type = memory |
|
368 | 364 | beaker.cache.long_term.expire = 36000 |
|
369 | 365 | beaker.cache.long_term.key_length = 256 |
|
370 | 366 | |
|
371 | 367 | beaker.cache.sql_cache_short.type = memory |
|
372 | 368 | beaker.cache.sql_cache_short.expire = 10 |
|
373 | 369 | beaker.cache.sql_cache_short.key_length = 256 |
|
374 | 370 | |
|
375 | 371 | <%text>####################################</%text> |
|
376 | 372 | <%text>### BEAKER SESSION ####</%text> |
|
377 | 373 | <%text>####################################</%text> |
|
378 | 374 | |
|
379 | 375 | <%text>## Name of session cookie. Should be unique for a given host and path, even when running</%text> |
|
380 | 376 | <%text>## on different ports. Otherwise, cookie sessions will be shared and messed up.</%text> |
|
381 | 377 | beaker.session.key = kallithea |
|
382 | 378 | <%text>## Sessions should always only be accessible by the browser, not directly by JavaScript.</%text> |
|
383 | 379 | beaker.session.httponly = true |
|
384 | 380 | <%text>## Session lifetime. 2592000 seconds is 30 days.</%text> |
|
385 | 381 | beaker.session.timeout = 2592000 |
|
386 | 382 | |
|
387 | 383 | <%text>## Server secret used with HMAC to ensure integrity of cookies.</%text> |
|
388 | 384 | beaker.session.secret = ${uuid()} |
|
389 | 385 | <%text>## Further, encrypt the data with AES.</%text> |
|
390 | 386 | #beaker.session.encrypt_key = <key_for_encryption> |
|
391 | 387 | #beaker.session.validate_key = <validation_key> |
|
392 | 388 | |
|
393 | 389 | <%text>## Type of storage used for the session, current types are</%text> |
|
394 | 390 | <%text>## dbm, file, memcached, database, and memory.</%text> |
|
395 | 391 | |
|
396 | 392 | <%text>## File system storage of session data. (default)</%text> |
|
397 | 393 | #beaker.session.type = file |
|
398 | 394 | |
|
399 | 395 | <%text>## Cookie only, store all session data inside the cookie. Requires secure secrets.</%text> |
|
400 | 396 | #beaker.session.type = cookie |
|
401 | 397 | |
|
402 | 398 | <%text>## Database storage of session data.</%text> |
|
403 | 399 | #beaker.session.type = ext:database |
|
404 | 400 | #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea |
|
405 | 401 | #beaker.session.table_name = db_session |
|
406 | 402 | |
|
407 | 403 | %if error_aggregation_service == 'appenlight': |
|
408 | 404 | <%text>############################</%text> |
|
409 | 405 | <%text>## ERROR HANDLING SYSTEMS ##</%text> |
|
410 | 406 | <%text>############################</%text> |
|
411 | 407 | |
|
412 | 408 | # Propagate email settings to ErrorReporter of TurboGears2 |
|
413 | 409 | # You do not normally need to change these lines |
|
414 | 410 | get trace_errors.error_email = email_to |
|
415 | 411 | get trace_errors.smtp_server = smtp_server |
|
416 | 412 | get trace_errors.smtp_port = smtp_port |
|
417 | 413 | get trace_errors.from_address = error_email_from |
|
418 | 414 | |
|
419 | 415 | <%text>####################</%text> |
|
420 | 416 | <%text>### [appenlight] ###</%text> |
|
421 | 417 | <%text>####################</%text> |
|
422 | 418 | |
|
423 | 419 | <%text>## AppEnlight is tailored to work with Kallithea, see</%text> |
|
424 | 420 | <%text>## http://appenlight.com for details how to obtain an account</%text> |
|
425 | 421 | <%text>## you must install python package `appenlight_client` to make it work</%text> |
|
426 | 422 | |
|
427 | 423 | <%text>## appenlight enabled</%text> |
|
428 | 424 | appenlight = false |
|
429 | 425 | |
|
430 | 426 | appenlight.server_url = https://api.appenlight.com |
|
431 | 427 | appenlight.api_key = YOUR_API_KEY |
|
432 | 428 | |
|
433 | 429 | <%text>## TWEAK AMOUNT OF INFO SENT HERE</%text> |
|
434 | 430 | |
|
435 | 431 | <%text>## enables 404 error logging (default False)</%text> |
|
436 | 432 | appenlight.report_404 = false |
|
437 | 433 | |
|
438 | 434 | <%text>## time in seconds after request is considered being slow (default 1)</%text> |
|
439 | 435 | appenlight.slow_request_time = 1 |
|
440 | 436 | |
|
441 | 437 | <%text>## record slow requests in application</%text> |
|
442 | 438 | <%text>## (needs to be enabled for slow datastore recording and time tracking)</%text> |
|
443 | 439 | appenlight.slow_requests = true |
|
444 | 440 | |
|
445 | 441 | <%text>## enable hooking to application loggers</%text> |
|
446 | 442 | #appenlight.logging = true |
|
447 | 443 | |
|
448 | 444 | <%text>## minimum log level for log capture</%text> |
|
449 | 445 | #appenlight.logging.level = WARNING |
|
450 | 446 | |
|
451 | 447 | <%text>## send logs only from erroneous/slow requests</%text> |
|
452 | 448 | <%text>## (saves API quota for intensive logging)</%text> |
|
453 | 449 | appenlight.logging_on_error = false |
|
454 | 450 | |
|
455 | 451 | <%text>## list of additional keywords that should be grabbed from environ object</%text> |
|
456 | 452 | <%text>## can be string with comma separated list of words in lowercase</%text> |
|
457 | 453 | <%text>## (by default client will always send following info:</%text> |
|
458 | 454 | <%text>## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that</%text> |
|
459 | 455 | <%text>## start with HTTP* this list be extended with additional keywords here</%text> |
|
460 | 456 | appenlight.environ_keys_whitelist = |
|
461 | 457 | |
|
462 | 458 | <%text>## list of keywords that should be blanked from request object</%text> |
|
463 | 459 | <%text>## can be string with comma separated list of words in lowercase</%text> |
|
464 | 460 | <%text>## (by default client will always blank keys that contain following words</%text> |
|
465 | 461 | <%text>## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'</%text> |
|
466 | 462 | <%text>## this list be extended with additional keywords set here</%text> |
|
467 | 463 | appenlight.request_keys_blacklist = |
|
468 | 464 | |
|
469 | 465 | <%text>## list of namespaces that should be ignores when gathering log entries</%text> |
|
470 | 466 | <%text>## can be string with comma separated list of namespaces</%text> |
|
471 | 467 | <%text>## (by default the client ignores own entries: appenlight_client.client)</%text> |
|
472 | 468 | appenlight.log_namespace_blacklist = |
|
473 | 469 | |
|
474 | 470 | %elif error_aggregation_service == 'sentry': |
|
475 | 471 | <%text>################</%text> |
|
476 | 472 | <%text>### [sentry] ###</%text> |
|
477 | 473 | <%text>################</%text> |
|
478 | 474 | |
|
479 | 475 | <%text>## sentry is a alternative open source error aggregator</%text> |
|
480 | 476 | <%text>## you must install python packages `sentry` and `raven` to enable</%text> |
|
481 | 477 | |
|
482 | 478 | sentry.dsn = YOUR_DNS |
|
483 | 479 | sentry.servers = |
|
484 | 480 | sentry.name = |
|
485 | 481 | sentry.key = |
|
486 | 482 | sentry.public_key = |
|
487 | 483 | sentry.secret_key = |
|
488 | 484 | sentry.project = |
|
489 | 485 | sentry.site = |
|
490 | 486 | sentry.include_paths = |
|
491 | 487 | sentry.exclude_paths = |
|
492 | 488 | |
|
493 | 489 | %endif |
|
494 | 490 | <%text>################################################################################</%text> |
|
495 | 491 | <%text>## WARNING: *DEBUG MODE MUST BE OFF IN A PRODUCTION ENVIRONMENT* ##</%text> |
|
496 | 492 | <%text>## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##</%text> |
|
497 | 493 | <%text>## execute malicious code after an exception is raised. ##</%text> |
|
498 | 494 | <%text>################################################################################</%text> |
|
499 | 495 | debug = false |
|
500 | 496 | |
|
501 | 497 | <%text>##################################</%text> |
|
502 | 498 | <%text>### LOGVIEW CONFIG ###</%text> |
|
503 | 499 | <%text>##################################</%text> |
|
504 | 500 | |
|
505 | 501 | logview.sqlalchemy = #faa |
|
506 | 502 | logview.pylons.templating = #bfb |
|
507 | 503 | logview.pylons.util = #eee |
|
508 | 504 | |
|
509 | 505 | <%text>#########################################################</%text> |
|
510 | 506 | <%text>### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###</%text> |
|
511 | 507 | <%text>#########################################################</%text> |
|
512 | 508 | |
|
513 | 509 | %if database_engine == 'sqlite': |
|
514 | 510 | # SQLITE [default] |
|
515 | 511 | sqlalchemy.url = sqlite:///%(here)s/kallithea.db?timeout=60 |
|
516 | 512 | |
|
517 | 513 | %elif database_engine == 'postgres': |
|
518 | 514 | # POSTGRESQL |
|
519 | 515 | sqlalchemy.url = postgresql://user:pass@localhost/kallithea |
|
520 | 516 | |
|
521 | 517 | %elif database_engine == 'mysql': |
|
522 | 518 | # MySQL |
|
523 | 519 | sqlalchemy.url = mysql://user:pass@localhost/kallithea?charset=utf8 |
|
524 | 520 | |
|
525 | 521 | %endif |
|
526 | 522 | # see sqlalchemy docs for others |
|
527 | 523 | |
|
528 | 524 | sqlalchemy.pool_recycle = 3600 |
|
529 | 525 | |
|
530 | 526 | <%text>################################</%text> |
|
531 | 527 | <%text>### ALEMBIC CONFIGURATION ####</%text> |
|
532 | 528 | <%text>################################</%text> |
|
533 | 529 | |
|
534 | 530 | [alembic] |
|
535 | 531 | script_location = kallithea:alembic |
|
536 | 532 | |
|
537 | 533 | <%text>################################</%text> |
|
538 | 534 | <%text>### LOGGING CONFIGURATION ####</%text> |
|
539 | 535 | <%text>################################</%text> |
|
540 | 536 | |
|
541 | 537 | [loggers] |
|
542 | 538 | keys = root, routes, kallithea, sqlalchemy, tg, gearbox, beaker, templates, whoosh_indexer, werkzeug, backlash |
|
543 | 539 | |
|
544 | 540 | [handlers] |
|
545 | 541 | keys = console, console_sql |
|
546 | 542 | |
|
547 | 543 | [formatters] |
|
548 | 544 | keys = generic, color_formatter, color_formatter_sql |
|
549 | 545 | |
|
550 | 546 | <%text>#############</%text> |
|
551 | 547 | <%text>## LOGGERS ##</%text> |
|
552 | 548 | <%text>#############</%text> |
|
553 | 549 | |
|
554 | 550 | [logger_root] |
|
555 | 551 | level = NOTSET |
|
556 | 552 | handlers = console |
|
557 | 553 | |
|
558 | 554 | [logger_routes] |
|
559 | 555 | level = WARN |
|
560 | 556 | handlers = |
|
561 | 557 | qualname = routes.middleware |
|
562 | 558 | <%text>## "level = DEBUG" logs the route matched and routing variables.</%text> |
|
563 | 559 | propagate = 1 |
|
564 | 560 | |
|
565 | 561 | [logger_beaker] |
|
566 | 562 | level = WARN |
|
567 | 563 | handlers = |
|
568 | 564 | qualname = beaker.container |
|
569 | 565 | propagate = 1 |
|
570 | 566 | |
|
571 | 567 | [logger_templates] |
|
572 | 568 | level = WARN |
|
573 | 569 | handlers = |
|
574 | 570 | qualname = pylons.templating |
|
575 | 571 | propagate = 1 |
|
576 | 572 | |
|
577 | 573 | [logger_kallithea] |
|
578 | 574 | level = WARN |
|
579 | 575 | handlers = |
|
580 | 576 | qualname = kallithea |
|
581 | 577 | propagate = 1 |
|
582 | 578 | |
|
583 | 579 | [logger_tg] |
|
584 | 580 | level = WARN |
|
585 | 581 | handlers = |
|
586 | 582 | qualname = tg |
|
587 | 583 | propagate = 1 |
|
588 | 584 | |
|
589 | 585 | [logger_gearbox] |
|
590 | 586 | level = WARN |
|
591 | 587 | handlers = |
|
592 | 588 | qualname = gearbox |
|
593 | 589 | propagate = 1 |
|
594 | 590 | |
|
595 | 591 | [logger_sqlalchemy] |
|
596 | 592 | level = WARN |
|
597 | 593 | handlers = console_sql |
|
598 | 594 | qualname = sqlalchemy.engine |
|
599 | 595 | propagate = 0 |
|
600 | 596 | |
|
601 | 597 | [logger_whoosh_indexer] |
|
602 | 598 | level = WARN |
|
603 | 599 | handlers = |
|
604 | 600 | qualname = whoosh_indexer |
|
605 | 601 | propagate = 1 |
|
606 | 602 | |
|
607 | 603 | [logger_werkzeug] |
|
608 | 604 | level = WARN |
|
609 | 605 | handlers = |
|
610 | 606 | qualname = werkzeug |
|
611 | 607 | propagate = 1 |
|
612 | 608 | |
|
613 | 609 | [logger_backlash] |
|
614 | 610 | level = WARN |
|
615 | 611 | handlers = |
|
616 | 612 | qualname = backlash |
|
617 | 613 | propagate = 1 |
|
618 | 614 | |
|
619 | 615 | <%text>##############</%text> |
|
620 | 616 | <%text>## HANDLERS ##</%text> |
|
621 | 617 | <%text>##############</%text> |
|
622 | 618 | |
|
623 | 619 | [handler_console] |
|
624 | 620 | class = StreamHandler |
|
625 | 621 | args = (sys.stderr,) |
|
626 | 622 | formatter = generic |
|
627 | 623 | |
|
628 | 624 | [handler_console_sql] |
|
629 | 625 | class = StreamHandler |
|
630 | 626 | args = (sys.stderr,) |
|
631 | 627 | formatter = generic |
|
632 | 628 | |
|
633 | 629 | <%text>################</%text> |
|
634 | 630 | <%text>## FORMATTERS ##</%text> |
|
635 | 631 | <%text>################</%text> |
|
636 | 632 | |
|
637 | 633 | [formatter_generic] |
|
638 | 634 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
639 | 635 | datefmt = %Y-%m-%d %H:%M:%S |
|
640 | 636 | |
|
641 | 637 | [formatter_color_formatter] |
|
642 | 638 | class = kallithea.lib.colored_formatter.ColorFormatter |
|
643 | 639 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
644 | 640 | datefmt = %Y-%m-%d %H:%M:%S |
|
645 | 641 | |
|
646 | 642 | [formatter_color_formatter_sql] |
|
647 | 643 | class = kallithea.lib.colored_formatter.ColorFormatterSql |
|
648 | 644 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
649 | 645 | datefmt = %Y-%m-%d %H:%M:%S |
@@ -1,75 +1,74 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 | from kallithea.lib import inifile |
|
11 | 11 | |
|
12 | 12 | # files to be generated from the mako template |
|
13 | 13 | ini_files = [ |
|
14 | 14 | ('development.ini', |
|
15 | 15 | { |
|
16 | 16 | '[server:main]': { |
|
17 | 17 | 'host': '0.0.0.0', |
|
18 | 18 | }, |
|
19 | 19 | '[app:main]': { |
|
20 | 'initial_repo_scan': 'true', | |
|
21 | 20 | 'debug': 'true', |
|
22 | 21 | 'app_instance_uuid': 'development-not-secret', |
|
23 | 22 | 'beaker.session.secret': 'development-not-secret', |
|
24 | 23 | }, |
|
25 | 24 | '[handler_console]': { |
|
26 | 25 | 'formatter': 'color_formatter', |
|
27 | 26 | }, |
|
28 | 27 | '[handler_console_sql]': { |
|
29 | 28 | 'formatter': 'color_formatter_sql', |
|
30 | 29 | }, |
|
31 | 30 | '[logger_routes]': { |
|
32 | 31 | 'level': 'DEBUG', |
|
33 | 32 | }, |
|
34 | 33 | '[logger_beaker]': { |
|
35 | 34 | 'level': 'DEBUG', |
|
36 | 35 | }, |
|
37 | 36 | '[logger_templates]': { |
|
38 | 37 | 'level': 'INFO', |
|
39 | 38 | }, |
|
40 | 39 | '[logger_kallithea]': { |
|
41 | 40 | 'level': 'DEBUG', |
|
42 | 41 | }, |
|
43 | 42 | '[logger_tg]': { |
|
44 | 43 | 'level': 'DEBUG', |
|
45 | 44 | }, |
|
46 | 45 | '[logger_gearbox]': { |
|
47 | 46 | 'level': 'DEBUG', |
|
48 | 47 | }, |
|
49 | 48 | '[logger_whoosh_indexer]': { |
|
50 | 49 | 'level': 'DEBUG', |
|
51 | 50 | }, |
|
52 | 51 | }, |
|
53 | 52 | ), |
|
54 | 53 | ] |
|
55 | 54 | |
|
56 | 55 | |
|
57 | 56 | def main(): |
|
58 | 57 | # make sure all mako lines starting with '#' (the '##' comments) are marked up as <text> |
|
59 | 58 | makofile = inifile.template_file |
|
60 | 59 | print 'reading:', makofile |
|
61 | 60 | mako_org = open(makofile).read() |
|
62 | 61 | mako_no_text_markup = re.sub(r'</?%text>', '', mako_org) |
|
63 | 62 | mako_marked_up = re.sub(r'\n(##.*)', r'\n<%text>\1</%text>', mako_no_text_markup, flags=re.MULTILINE) |
|
64 | 63 | if mako_marked_up != mako_org: |
|
65 | 64 | print 'writing:', makofile |
|
66 | 65 | open(makofile, 'w').write(mako_marked_up) |
|
67 | 66 | |
|
68 | 67 | # create ini files |
|
69 | 68 | for fn, settings in ini_files: |
|
70 | 69 | print 'updating:', fn |
|
71 | 70 | inifile.create(fn, None, settings) |
|
72 | 71 | |
|
73 | 72 | |
|
74 | 73 | if __name__ == '__main__': |
|
75 | 74 | main() |
General Comments 0
You need to be logged in to leave comments.
Login now