Show More
@@ -1,444 +1,446 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 | 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 | 15 | |
|
16 | 16 | ################################################################################ |
|
17 | 17 | ## Email settings ## |
|
18 | 18 | ## ## |
|
19 | 19 | ## Refer to the documentation ("Email settings") for more details. ## |
|
20 | 20 | ## ## |
|
21 | 21 | ## It is recommended to use a valid sender address that passes access ## |
|
22 | 22 | ## validation and spam filtering in mail servers. ## |
|
23 | 23 | ################################################################################ |
|
24 | 24 | |
|
25 | 25 | ## 'From' header for application emails. You can optionally add a name. |
|
26 | 26 | ## Default: |
|
27 | 27 | #app_email_from = Kallithea |
|
28 | 28 | ## Examples: |
|
29 | 29 | #app_email_from = Kallithea <kallithea-noreply@example.com> |
|
30 | 30 | #app_email_from = kallithea-noreply@example.com |
|
31 | 31 | |
|
32 | 32 | ## Subject prefix for application emails. |
|
33 | 33 | ## A space between this prefix and the real subject is automatically added. |
|
34 | 34 | ## Default: |
|
35 | 35 | #email_prefix = |
|
36 | 36 | ## Example: |
|
37 | 37 | #email_prefix = [Kallithea] |
|
38 | 38 | |
|
39 | 39 | ## Recipients for error emails and fallback recipients of application mails. |
|
40 | 40 | ## Multiple addresses can be specified, space-separated. |
|
41 | 41 | ## Only addresses are allowed, do not add any name part. |
|
42 | 42 | ## Default: |
|
43 | 43 | #email_to = |
|
44 | 44 | ## Examples: |
|
45 | 45 | #email_to = admin@example.com |
|
46 | 46 | #email_to = admin@example.com another_admin@example.com |
|
47 | 47 | email_to = |
|
48 | 48 | |
|
49 | 49 | ## 'From' header for error emails. You can optionally add a name. |
|
50 | 50 | ## Default: (none) |
|
51 | 51 | ## Examples: |
|
52 | 52 | #error_email_from = Kallithea Errors <kallithea-noreply@example.com> |
|
53 | 53 | #error_email_from = kallithea_errors@example.com |
|
54 | 54 | error_email_from = |
|
55 | 55 | |
|
56 | 56 | ## SMTP server settings |
|
57 | 57 | ## If specifying credentials, make sure to use secure connections. |
|
58 | 58 | ## Default: Send unencrypted unauthenticated mails to the specified smtp_server. |
|
59 | 59 | ## For "SSL", use smtp_use_ssl = true and smtp_port = 465. |
|
60 | 60 | ## For "STARTTLS", use smtp_use_tls = true and smtp_port = 587. |
|
61 | 61 | smtp_server = |
|
62 | 62 | #smtp_username = |
|
63 | 63 | #smtp_password = |
|
64 | 64 | smtp_port = |
|
65 | 65 | #smtp_use_ssl = false |
|
66 | 66 | #smtp_use_tls = false |
|
67 | 67 | |
|
68 | 68 | [server:main] |
|
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 | ## COMMON ## |
|
80 | 80 | #host = 127.0.0.1 |
|
81 | 81 | host = 0.0.0.0 |
|
82 | 82 | port = 5000 |
|
83 | 83 | |
|
84 | 84 | ## middleware for hosting the WSGI application under a URL prefix |
|
85 | 85 | #[filter:proxy-prefix] |
|
86 | 86 | #use = egg:PasteDeploy#prefix |
|
87 | 87 | #prefix = /<your-prefix> |
|
88 | 88 | |
|
89 | 89 | [app:main] |
|
90 | 90 | use = egg:kallithea |
|
91 | 91 | ## enable proxy prefix middleware |
|
92 | 92 | #filter-with = proxy-prefix |
|
93 | 93 | |
|
94 | 94 | full_stack = true |
|
95 | 95 | static_files = true |
|
96 | 96 | |
|
97 | 97 | ## Internationalization (see setup documentation for details) |
|
98 | 98 | ## By default, the language requested by the browser is used if available. |
|
99 | 99 | #i18n.enable = false |
|
100 | 100 | ## Fallback language, empty for English (valid values are the names of subdirectories in kallithea/i18n): |
|
101 | 101 | i18n.lang = |
|
102 | 102 | |
|
103 | 103 | cache_dir = %(here)s/data |
|
104 | 104 | index_dir = %(here)s/data/index |
|
105 | 105 | |
|
106 | 106 | ## perform a full repository scan on each server start, this should be |
|
107 | 107 | ## set to false after first startup, to allow faster server restarts. |
|
108 | 108 | #initial_repo_scan = false |
|
109 | 109 | initial_repo_scan = true |
|
110 | 110 | |
|
111 | 111 | ## uncomment and set this path to use archive download cache |
|
112 | 112 | archive_cache_dir = %(here)s/tarballcache |
|
113 | 113 | |
|
114 | 114 | ## change this to unique ID for security |
|
115 | #app_instance_uuid = VERY-SECRET | |
|
115 | 116 | app_instance_uuid = development-not-secret |
|
116 | 117 | |
|
117 | 118 | ## cut off limit for large diffs (size in bytes) |
|
118 | 119 | cut_off_limit = 256000 |
|
119 | 120 | |
|
120 | 121 | ## force https in Kallithea, fixes https redirects, assumes it's always https |
|
121 | 122 | force_https = false |
|
122 | 123 | |
|
123 | 124 | ## use Strict-Transport-Security headers |
|
124 | 125 | use_htsts = false |
|
125 | 126 | |
|
126 | 127 | ## number of commits stats will parse on each iteration |
|
127 | 128 | commit_parse_limit = 25 |
|
128 | 129 | |
|
129 | 130 | ## path to git executable |
|
130 | 131 | git_path = git |
|
131 | 132 | |
|
132 | 133 | ## git rev filter option, --all is the default filter, if you need to |
|
133 | 134 | ## hide all refs in changelog switch this to --branches --tags |
|
134 | 135 | #git_rev_filter = --branches --tags |
|
135 | 136 | |
|
136 | 137 | ## RSS feed options |
|
137 | 138 | rss_cut_off_limit = 256000 |
|
138 | 139 | rss_items_per_page = 10 |
|
139 | 140 | rss_include_diff = false |
|
140 | 141 | |
|
141 | 142 | ## options for showing and identifying changesets |
|
142 | 143 | show_sha_length = 12 |
|
143 | 144 | show_revision_number = false |
|
144 | 145 | |
|
145 | 146 | ## Canonical URL to use when creating full URLs in UI and texts. |
|
146 | 147 | ## Useful when the site is available under different names or protocols. |
|
147 | 148 | ## Defaults to what is provided in the WSGI environment. |
|
148 | 149 | #canonical_url = https://kallithea.example.com/repos |
|
149 | 150 | |
|
150 | 151 | ## gist URL alias, used to create nicer urls for gist. This should be an |
|
151 | 152 | ## url that does rewrites to _admin/gists/<gistid>. |
|
152 | 153 | ## example: http://gist.example.com/{gistid}. Empty means use the internal |
|
153 | 154 | ## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid> |
|
154 | 155 | gist_alias_url = |
|
155 | 156 | |
|
156 | 157 | ## white list of API enabled controllers. This allows to add list of |
|
157 | 158 | ## controllers to which access will be enabled by api_key. eg: to enable |
|
158 | 159 | ## api access to raw_files put `FilesController:raw`, to enable access to patches |
|
159 | 160 | ## add `ChangesetController:changeset_patch`. This list should be "," separated |
|
160 | 161 | ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names |
|
161 | 162 | ## Recommended settings below are commented out: |
|
162 | 163 | api_access_controllers_whitelist = |
|
163 | 164 | # ChangesetController:changeset_patch, |
|
164 | 165 | # ChangesetController:changeset_raw, |
|
165 | 166 | # FilesController:raw, |
|
166 | 167 | # FilesController:archivefile |
|
167 | 168 | |
|
168 | 169 | ## default encoding used to convert from and to unicode |
|
169 | 170 | ## can be also a comma separated list of encoding in case of mixed encodings |
|
170 | 171 | default_encoding = utf8 |
|
171 | 172 | |
|
172 | 173 | ## issue tracker for Kallithea (leave blank to disable, absent for default) |
|
173 | 174 | #bugtracker = https://bitbucket.org/conservancy/kallithea/issues |
|
174 | 175 | |
|
175 | 176 | ## issue tracking mapping for commits messages |
|
176 | 177 | ## comment out issue_pat, issue_server, issue_prefix to enable |
|
177 | 178 | |
|
178 | 179 | ## pattern to get the issues from commit messages |
|
179 | 180 | ## default one used here is #<numbers> with a regex passive group for `#` |
|
180 | 181 | ## {id} will be all groups matched from this pattern |
|
181 | 182 | |
|
182 | 183 | issue_pat = (?:\s*#)(\d+) |
|
183 | 184 | |
|
184 | 185 | ## server url to the issue, each {id} will be replaced with match |
|
185 | 186 | ## fetched from the regex and {repo} is replaced with full repository name |
|
186 | 187 | ## including groups {repo_name} is replaced with just name of repo |
|
187 | 188 | |
|
188 | 189 | issue_server_link = https://issues.example.com/{repo}/issue/{id} |
|
189 | 190 | |
|
190 | 191 | ## prefix to add to link to indicate it's an url |
|
191 | 192 | ## #314 will be replaced by <issue_prefix><id> |
|
192 | 193 | |
|
193 | 194 | issue_prefix = # |
|
194 | 195 | |
|
195 | 196 | ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify |
|
196 | 197 | ## multiple patterns, to other issues server, wiki or others |
|
197 | 198 | ## below an example how to create a wiki pattern |
|
198 | 199 | # wiki-some-id -> https://wiki.example.com/some-id |
|
199 | 200 | |
|
200 | 201 | #issue_pat_wiki = (?:wiki-)(.+) |
|
201 | 202 | #issue_server_link_wiki = https://wiki.example.com/{id} |
|
202 | 203 | #issue_prefix_wiki = WIKI- |
|
203 | 204 | |
|
204 | 205 | ## alternative return HTTP header for failed authentication. Default HTTP |
|
205 | 206 | ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with |
|
206 | 207 | ## handling that. Set this variable to 403 to return HTTPForbidden |
|
207 | 208 | auth_ret_code = |
|
208 | 209 | |
|
209 | 210 | ## locking return code. When repository is locked return this HTTP code. 2XX |
|
210 | 211 | ## codes don't break the transactions while 4XX codes do |
|
211 | 212 | lock_ret_code = 423 |
|
212 | 213 | |
|
213 | 214 | ## allows to change the repository location in settings page |
|
214 | 215 | allow_repo_location_change = True |
|
215 | 216 | |
|
216 | 217 | ## allows to setup custom hooks in settings page |
|
217 | 218 | allow_custom_hooks_settings = True |
|
218 | 219 | |
|
219 | 220 | ## extra extensions for indexing, space separated and without the leading '.'. |
|
220 | 221 | # index.extensions = |
|
221 | 222 | # gemfile |
|
222 | 223 | # lock |
|
223 | 224 | |
|
224 | 225 | ## extra filenames for indexing, space separated |
|
225 | 226 | # index.filenames = |
|
226 | 227 | # .dockerignore |
|
227 | 228 | # .editorconfig |
|
228 | 229 | # INSTALL |
|
229 | 230 | # CHANGELOG |
|
230 | 231 | |
|
231 | 232 | #################################### |
|
232 | 233 | ### CELERY CONFIG #### |
|
233 | 234 | #################################### |
|
234 | 235 | |
|
235 | 236 | use_celery = false |
|
236 | 237 | |
|
237 | 238 | ## Example: connect to the virtual host 'rabbitmqhost' on localhost as rabbitmq: |
|
238 | 239 | broker.url = amqp://rabbitmq:qewqew@localhost:5672/rabbitmqhost |
|
239 | 240 | |
|
240 | 241 | celery.imports = kallithea.lib.celerylib.tasks |
|
241 | 242 | celery.accept.content = pickle |
|
242 | 243 | celery.result.backend = amqp |
|
243 | 244 | celery.result.dburi = amqp:// |
|
244 | 245 | celery.result.serialier = json |
|
245 | 246 | |
|
246 | 247 | #celery.send.task.error.emails = true |
|
247 | 248 | #celery.amqp.task.result.expires = 18000 |
|
248 | 249 | |
|
249 | 250 | celeryd.concurrency = 2 |
|
250 | 251 | celeryd.max.tasks.per.child = 1 |
|
251 | 252 | |
|
252 | 253 | ## If true, tasks will never be sent to the queue, but executed locally instead. |
|
253 | 254 | celery.always.eager = false |
|
254 | 255 | |
|
255 | 256 | #################################### |
|
256 | 257 | ### BEAKER CACHE #### |
|
257 | 258 | #################################### |
|
258 | 259 | |
|
259 | 260 | beaker.cache.data_dir = %(here)s/data/cache/data |
|
260 | 261 | beaker.cache.lock_dir = %(here)s/data/cache/lock |
|
261 | 262 | |
|
262 | 263 | beaker.cache.regions = short_term,long_term,sql_cache_short |
|
263 | 264 | |
|
264 | 265 | beaker.cache.short_term.type = memory |
|
265 | 266 | beaker.cache.short_term.expire = 60 |
|
266 | 267 | beaker.cache.short_term.key_length = 256 |
|
267 | 268 | |
|
268 | 269 | beaker.cache.long_term.type = memory |
|
269 | 270 | beaker.cache.long_term.expire = 36000 |
|
270 | 271 | beaker.cache.long_term.key_length = 256 |
|
271 | 272 | |
|
272 | 273 | beaker.cache.sql_cache_short.type = memory |
|
273 | 274 | beaker.cache.sql_cache_short.expire = 10 |
|
274 | 275 | beaker.cache.sql_cache_short.key_length = 256 |
|
275 | 276 | |
|
276 | 277 | #################################### |
|
277 | 278 | ### BEAKER SESSION #### |
|
278 | 279 | #################################### |
|
279 | 280 | |
|
280 | 281 | ## Name of session cookie. Should be unique for a given host and path, even when running |
|
281 | 282 | ## on different ports. Otherwise, cookie sessions will be shared and messed up. |
|
282 | 283 | beaker.session.key = kallithea |
|
283 | 284 | ## Sessions should always only be accessible by the browser, not directly by JavaScript. |
|
284 | 285 | beaker.session.httponly = true |
|
285 | 286 | ## Session lifetime. 2592000 seconds is 30 days. |
|
286 | 287 | beaker.session.timeout = 2592000 |
|
287 | 288 | |
|
288 | 289 | ## Server secret used with HMAC to ensure integrity of cookies. |
|
290 | #beaker.session.secret = VERY-SECRET | |
|
289 | 291 | beaker.session.secret = development-not-secret |
|
290 | 292 | ## Further, encrypt the data with AES. |
|
291 | 293 | #beaker.session.encrypt_key = <key_for_encryption> |
|
292 | 294 | #beaker.session.validate_key = <validation_key> |
|
293 | 295 | |
|
294 | 296 | ## Type of storage used for the session, current types are |
|
295 | 297 | ## dbm, file, memcached, database, and memory. |
|
296 | 298 | |
|
297 | 299 | ## File system storage of session data. (default) |
|
298 | 300 | #beaker.session.type = file |
|
299 | 301 | |
|
300 | 302 | ## Cookie only, store all session data inside the cookie. Requires secure secrets. |
|
301 | 303 | #beaker.session.type = cookie |
|
302 | 304 | |
|
303 | 305 | ## Database storage of session data. |
|
304 | 306 | #beaker.session.type = ext:database |
|
305 | 307 | #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea |
|
306 | 308 | #beaker.session.table_name = db_session |
|
307 | 309 | |
|
308 | 310 | ################################################################################ |
|
309 | 311 | ## WARNING: *DEBUG MODE MUST BE OFF IN A PRODUCTION ENVIRONMENT* ## |
|
310 | 312 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
311 | 313 | ## execute malicious code after an exception is raised. ## |
|
312 | 314 | ################################################################################ |
|
313 | 315 | #debug = false |
|
314 | 316 | debug = true |
|
315 | 317 | |
|
316 | 318 | ################################## |
|
317 | 319 | ### LOGVIEW CONFIG ### |
|
318 | 320 | ################################## |
|
319 | 321 | |
|
320 | 322 | logview.sqlalchemy = #faa |
|
321 | 323 | logview.pylons.templating = #bfb |
|
322 | 324 | logview.pylons.util = #eee |
|
323 | 325 | |
|
324 | 326 | ######################################################### |
|
325 | 327 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
326 | 328 | ######################################################### |
|
327 | 329 | |
|
328 | 330 | # SQLITE [default] |
|
329 | 331 | sqlalchemy.url = sqlite:///%(here)s/kallithea.db?timeout=60 |
|
330 | 332 | |
|
331 | 333 | # see sqlalchemy docs for others |
|
332 | 334 | |
|
333 | 335 | sqlalchemy.pool_recycle = 3600 |
|
334 | 336 | |
|
335 | 337 | ################################ |
|
336 | 338 | ### ALEMBIC CONFIGURATION #### |
|
337 | 339 | ################################ |
|
338 | 340 | |
|
339 | 341 | [alembic] |
|
340 | 342 | script_location = kallithea:alembic |
|
341 | 343 | |
|
342 | 344 | ################################ |
|
343 | 345 | ### LOGGING CONFIGURATION #### |
|
344 | 346 | ################################ |
|
345 | 347 | |
|
346 | 348 | [loggers] |
|
347 | 349 | keys = root, routes, kallithea, sqlalchemy, tg, gearbox, beaker, templates, whoosh_indexer |
|
348 | 350 | |
|
349 | 351 | [handlers] |
|
350 | 352 | keys = console, console_sql |
|
351 | 353 | |
|
352 | 354 | [formatters] |
|
353 | 355 | keys = generic, color_formatter, color_formatter_sql |
|
354 | 356 | |
|
355 | 357 | ############# |
|
356 | 358 | ## LOGGERS ## |
|
357 | 359 | ############# |
|
358 | 360 | |
|
359 | 361 | [logger_root] |
|
360 | 362 | level = NOTSET |
|
361 | 363 | handlers = console |
|
362 | 364 | |
|
363 | 365 | [logger_routes] |
|
364 | 366 | level = DEBUG |
|
365 | 367 | handlers = |
|
366 | 368 | qualname = routes.middleware |
|
367 | 369 | ## "level = DEBUG" logs the route matched and routing variables. |
|
368 | 370 | propagate = 1 |
|
369 | 371 | |
|
370 | 372 | [logger_beaker] |
|
371 | 373 | level = DEBUG |
|
372 | 374 | handlers = |
|
373 | 375 | qualname = beaker.container |
|
374 | 376 | propagate = 1 |
|
375 | 377 | |
|
376 | 378 | [logger_templates] |
|
377 | 379 | level = INFO |
|
378 | 380 | handlers = |
|
379 | 381 | qualname = pylons.templating |
|
380 | 382 | propagate = 1 |
|
381 | 383 | |
|
382 | 384 | [logger_kallithea] |
|
383 | 385 | level = DEBUG |
|
384 | 386 | handlers = |
|
385 | 387 | qualname = kallithea |
|
386 | 388 | propagate = 1 |
|
387 | 389 | |
|
388 | 390 | [logger_tg] |
|
389 | 391 | level = DEBUG |
|
390 | 392 | handlers = |
|
391 | 393 | qualname = tg |
|
392 | 394 | propagate = 1 |
|
393 | 395 | |
|
394 | 396 | [logger_gearbox] |
|
395 | 397 | level = DEBUG |
|
396 | 398 | handlers = |
|
397 | 399 | qualname = gearbox |
|
398 | 400 | propagate = 1 |
|
399 | 401 | |
|
400 | 402 | [logger_sqlalchemy] |
|
401 | 403 | level = WARN |
|
402 | 404 | handlers = console_sql |
|
403 | 405 | qualname = sqlalchemy.engine |
|
404 | 406 | propagate = 0 |
|
405 | 407 | |
|
406 | 408 | [logger_whoosh_indexer] |
|
407 | 409 | level = DEBUG |
|
408 | 410 | handlers = |
|
409 | 411 | qualname = whoosh_indexer |
|
410 | 412 | propagate = 1 |
|
411 | 413 | |
|
412 | 414 | ############## |
|
413 | 415 | ## HANDLERS ## |
|
414 | 416 | ############## |
|
415 | 417 | |
|
416 | 418 | [handler_console] |
|
417 | 419 | class = StreamHandler |
|
418 | 420 | args = (sys.stderr,) |
|
419 | 421 | #formatter = generic |
|
420 | 422 | formatter = color_formatter |
|
421 | 423 | |
|
422 | 424 | [handler_console_sql] |
|
423 | 425 | class = StreamHandler |
|
424 | 426 | args = (sys.stderr,) |
|
425 | 427 | #formatter = generic |
|
426 | 428 | formatter = color_formatter_sql |
|
427 | 429 | |
|
428 | 430 | ################ |
|
429 | 431 | ## FORMATTERS ## |
|
430 | 432 | ################ |
|
431 | 433 | |
|
432 | 434 | [formatter_generic] |
|
433 | 435 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
434 | 436 | datefmt = %Y-%m-%d %H:%M:%S |
|
435 | 437 | |
|
436 | 438 | [formatter_color_formatter] |
|
437 | 439 | class = kallithea.lib.colored_formatter.ColorFormatter |
|
438 | 440 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
439 | 441 | datefmt = %Y-%m-%d %H:%M:%S |
|
440 | 442 | |
|
441 | 443 | [formatter_color_formatter_sql] |
|
442 | 444 | class = kallithea.lib.colored_formatter.ColorFormatterSql |
|
443 | 445 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
444 | 446 | datefmt = %Y-%m-%d %H:%M:%S |
@@ -1,118 +1,117 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 | """ |
|
16 | 16 | kallithea.lib.inifile |
|
17 | 17 | ~~~~~~~~~~~~~~~~~~~~~ |
|
18 | 18 | |
|
19 | 19 | Handling of .ini files, mainly creating them from Mako templates and adding |
|
20 | 20 | other custom values. |
|
21 | 21 | """ |
|
22 | 22 | |
|
23 | 23 | import logging |
|
24 | 24 | import re |
|
25 | 25 | |
|
26 | 26 | import mako.template |
|
27 | 27 | |
|
28 | 28 | |
|
29 | 29 | log = logging.getLogger(__name__) |
|
30 | 30 | |
|
31 | 31 | |
|
32 | 32 | def expand(template, desc, mako_variable_values, settings): |
|
33 | 33 | """Expand mako template and tweak it. |
|
34 | 34 | Not entirely stable for random templates as input, but good enough for our |
|
35 | 35 | single template. |
|
36 | 36 | |
|
37 | 37 | >>> template = ''' |
|
38 | 38 | ... [first-section] |
|
39 | 39 | ... |
|
40 | 40 | ... variable=${mako_variable} |
|
41 | 41 | ... variable2 =\tvalue after tab |
|
42 | 42 | ... ## This section had some whitespace and stuff |
|
43 | 43 | ... |
|
44 | 44 | ... |
|
45 | 45 | ... # ${mako_function()} |
|
46 | 46 | ... [second-section] |
|
47 | 47 | ... %if conditional_options == 'option-a': |
|
48 | 48 | ... # Kallithea - config file generated with kallithea-config # |
|
49 | 49 | ... %elif conditional_options == 'option-b': |
|
50 | 50 | ... some_variable = "never mind - option-b will not be used anyway ..." |
|
51 | 51 | ... %endif |
|
52 | 52 | ... ''' |
|
53 | 53 | >>> desc = 'Description\\nof this config file' |
|
54 | 54 | >>> selected_mako_conditionals = [] |
|
55 | 55 | >>> mako_variable_values = {'mako_variable': 'VALUE', 'mako_function': (lambda: 'FUNCTION RESULT'), |
|
56 | 56 | ... 'conditional_options': 'option-a'} |
|
57 | 57 | >>> settings = { # only partially used |
|
58 | 58 | ... '[first-section]': {'variable2': 'VAL2', 'first_extra': 'EXTRA'}, |
|
59 | 59 | ... '[third-section]': {'third_extra': ' 3'}, |
|
60 | 60 | ... '[fourth-section]': {'fourth_extra': '4', 'fourth': '"four"'}, |
|
61 | 61 | ... } |
|
62 | 62 | >>> print expand(template, desc, mako_variable_values, settings) |
|
63 | 63 | <BLANKLINE> |
|
64 | 64 | [first-section] |
|
65 | 65 | <BLANKLINE> |
|
66 | 66 | variable=VALUE |
|
67 | #variable2 = value after tab | |
|
67 | #variable2 = value after tab | |
|
68 | 68 | variable2 = VAL2 |
|
69 | 69 | <BLANKLINE> |
|
70 | 70 | <BLANKLINE> |
|
71 | 71 | # FUNCTION RESULT |
|
72 | 72 | [second-section] |
|
73 | 73 | # Description # |
|
74 | 74 | # of this config file # |
|
75 | 75 | <BLANKLINE> |
|
76 | 76 | """ |
|
77 | 77 | ini_lines = mako.template.Template(template).render(**mako_variable_values) |
|
78 | 78 | |
|
79 | 79 | ini_lines = re.sub( |
|
80 | 80 | '# Kallithea - config file generated with kallithea-config *#\n', |
|
81 | 81 | ''.join('# %-77s#\n' % l.strip() for l in desc.strip().split('\n')), |
|
82 | 82 | ini_lines) |
|
83 | 83 | |
|
84 | 84 | def process_section(m): |
|
85 | 85 | """process a ini section, replacing values as necessary""" |
|
86 | 86 | sectionname, lines = m.groups() |
|
87 | 87 | if sectionname in settings: |
|
88 | 88 | section_settings = settings[sectionname] |
|
89 | 89 | |
|
90 | 90 | def process_line(m): |
|
91 | 91 | """process a section line and update value if necessary""" |
|
92 | 92 | key, value = m.groups() |
|
93 | 93 | line = m.group(0) |
|
94 | 94 | if key in section_settings: |
|
95 | line = '%s = %s' % (key, section_settings[key]) | |
|
96 | if '$' not in value: | |
|
97 | line = '#%s = %s\n%s' % (key, value, line) | |
|
95 | # keep old entry as example - comments might refer to it | |
|
96 | line = '#%s\n%s = %s' % (line, key, section_settings[key]) | |
|
98 | 97 | return line.rstrip() |
|
99 | 98 | |
|
100 | 99 | # process lines that not are comments or empty and look like name=value |
|
101 | 100 | lines = re.sub(r'^([^#\n\s]*)[ \t]*=[ \t]*(.*)$', process_line, lines, flags=re.MULTILINE) |
|
102 | 101 | |
|
103 | 102 | return sectionname + '\n' + lines |
|
104 | 103 | |
|
105 | 104 | # process sections until next section start or end |
|
106 | 105 | ini_lines = re.sub(r'''^ |
|
107 | 106 | (\[.*\])\n |
|
108 | 107 | # after the section name, a number of chunks with: |
|
109 | 108 | ( |
|
110 | 109 | (?: |
|
111 | 110 | # a number of empty or non-section-start lines |
|
112 | 111 | (?:[^\n[].*)?\n |
|
113 | 112 | )* |
|
114 | 113 | ) |
|
115 | 114 | ''', |
|
116 | 115 | process_section, ini_lines, flags=re.MULTILINE|re.VERBOSE) |
|
117 | 116 | |
|
118 | 117 | return ini_lines |
@@ -1,441 +1,443 b'' | |||
|
1 | 1 | ################################################################################ |
|
2 | 2 | ################################################################################ |
|
3 | 3 | # Kallithea - config for tests: # |
|
4 | 4 | # sqlalchemy and kallithea_test.sqlite # |
|
5 | 5 | # custom logging # |
|
6 | 6 | # # |
|
7 | 7 | # The %(here)s variable will be replaced with the parent directory of this file# |
|
8 | 8 | ################################################################################ |
|
9 | 9 | ################################################################################ |
|
10 | 10 | |
|
11 | 11 | [DEFAULT] |
|
12 | 12 | |
|
13 | 13 | ################################################################################ |
|
14 | 14 | ## Email settings ## |
|
15 | 15 | ## ## |
|
16 | 16 | ## Refer to the documentation ("Email settings") for more details. ## |
|
17 | 17 | ## ## |
|
18 | 18 | ## It is recommended to use a valid sender address that passes access ## |
|
19 | 19 | ## validation and spam filtering in mail servers. ## |
|
20 | 20 | ################################################################################ |
|
21 | 21 | |
|
22 | 22 | ## 'From' header for application emails. You can optionally add a name. |
|
23 | 23 | ## Default: |
|
24 | 24 | #app_email_from = Kallithea |
|
25 | 25 | ## Examples: |
|
26 | 26 | #app_email_from = Kallithea <kallithea-noreply@example.com> |
|
27 | 27 | #app_email_from = kallithea-noreply@example.com |
|
28 | 28 | |
|
29 | 29 | ## Subject prefix for application emails. |
|
30 | 30 | ## A space between this prefix and the real subject is automatically added. |
|
31 | 31 | ## Default: |
|
32 | 32 | #email_prefix = |
|
33 | 33 | ## Example: |
|
34 | 34 | #email_prefix = [Kallithea] |
|
35 | 35 | |
|
36 | 36 | ## Recipients for error emails and fallback recipients of application mails. |
|
37 | 37 | ## Multiple addresses can be specified, space-separated. |
|
38 | 38 | ## Only addresses are allowed, do not add any name part. |
|
39 | 39 | ## Default: |
|
40 | 40 | #email_to = |
|
41 | 41 | ## Examples: |
|
42 | 42 | #email_to = admin@example.com |
|
43 | 43 | #email_to = admin@example.com another_admin@example.com |
|
44 | 44 | email_to = |
|
45 | 45 | |
|
46 | 46 | ## 'From' header for error emails. You can optionally add a name. |
|
47 | 47 | ## Default: (none) |
|
48 | 48 | ## Examples: |
|
49 | 49 | #error_email_from = Kallithea Errors <kallithea-noreply@example.com> |
|
50 | 50 | #error_email_from = kallithea_errors@example.com |
|
51 | 51 | error_email_from = |
|
52 | 52 | |
|
53 | 53 | ## SMTP server settings |
|
54 | 54 | ## If specifying credentials, make sure to use secure connections. |
|
55 | 55 | ## Default: Send unencrypted unauthenticated mails to the specified smtp_server. |
|
56 | 56 | ## For "SSL", use smtp_use_ssl = true and smtp_port = 465. |
|
57 | 57 | ## For "STARTTLS", use smtp_use_tls = true and smtp_port = 587. |
|
58 | 58 | smtp_server = |
|
59 | 59 | #smtp_username = |
|
60 | 60 | #smtp_password = |
|
61 | 61 | smtp_port = |
|
62 | 62 | #smtp_use_ssl = false |
|
63 | 63 | #smtp_use_tls = false |
|
64 | 64 | |
|
65 | 65 | [server:main] |
|
66 | 66 | ## WAITRESS ## |
|
67 | 67 | use = egg:waitress#main |
|
68 | 68 | ## number of worker threads |
|
69 | 69 | threads = 1 |
|
70 | 70 | ## MAX BODY SIZE 100GB |
|
71 | 71 | max_request_body_size = 107374182400 |
|
72 | 72 | ## use poll instead of select, fixes fd limits, may not work on old |
|
73 | 73 | ## windows systems. |
|
74 | 74 | #asyncore_use_poll = True |
|
75 | 75 | |
|
76 | 76 | ## COMMON ## |
|
77 | 77 | host = 127.0.0.1 |
|
78 | 78 | #port = 5000 |
|
79 | 79 | port = 4999 |
|
80 | 80 | |
|
81 | 81 | ## middleware for hosting the WSGI application under a URL prefix |
|
82 | 82 | #[filter:proxy-prefix] |
|
83 | 83 | #use = egg:PasteDeploy#prefix |
|
84 | 84 | #prefix = /<your-prefix> |
|
85 | 85 | |
|
86 | 86 | [app:main] |
|
87 | 87 | use = egg:kallithea |
|
88 | 88 | ## enable proxy prefix middleware |
|
89 | 89 | #filter-with = proxy-prefix |
|
90 | 90 | |
|
91 | 91 | full_stack = true |
|
92 | 92 | static_files = true |
|
93 | 93 | |
|
94 | 94 | ## Internationalization (see setup documentation for details) |
|
95 | 95 | ## By default, the language requested by the browser is used if available. |
|
96 | 96 | #i18n.enable = false |
|
97 | 97 | ## Fallback language, empty for English (valid values are the names of subdirectories in kallithea/i18n): |
|
98 | 98 | i18n.lang = |
|
99 | 99 | |
|
100 | 100 | cache_dir = %(here)s/data |
|
101 | 101 | index_dir = %(here)s/data/index |
|
102 | 102 | |
|
103 | 103 | ## perform a full repository scan on each server start, this should be |
|
104 | 104 | ## set to false after first startup, to allow faster server restarts. |
|
105 | 105 | initial_repo_scan = false |
|
106 | 106 | |
|
107 | 107 | ## uncomment and set this path to use archive download cache |
|
108 | 108 | archive_cache_dir = %(here)s/tarballcache |
|
109 | 109 | |
|
110 | 110 | ## change this to unique ID for security |
|
111 | #app_instance_uuid = VERY-SECRET | |
|
111 | 112 | app_instance_uuid = test |
|
112 | 113 | |
|
113 | 114 | ## cut off limit for large diffs (size in bytes) |
|
114 | 115 | cut_off_limit = 256000 |
|
115 | 116 | |
|
116 | 117 | ## force https in Kallithea, fixes https redirects, assumes it's always https |
|
117 | 118 | force_https = false |
|
118 | 119 | |
|
119 | 120 | ## use Strict-Transport-Security headers |
|
120 | 121 | use_htsts = false |
|
121 | 122 | |
|
122 | 123 | ## number of commits stats will parse on each iteration |
|
123 | 124 | commit_parse_limit = 25 |
|
124 | 125 | |
|
125 | 126 | ## path to git executable |
|
126 | 127 | git_path = git |
|
127 | 128 | |
|
128 | 129 | ## git rev filter option, --all is the default filter, if you need to |
|
129 | 130 | ## hide all refs in changelog switch this to --branches --tags |
|
130 | 131 | #git_rev_filter = --branches --tags |
|
131 | 132 | |
|
132 | 133 | ## RSS feed options |
|
133 | 134 | rss_cut_off_limit = 256000 |
|
134 | 135 | rss_items_per_page = 10 |
|
135 | 136 | rss_include_diff = false |
|
136 | 137 | |
|
137 | 138 | ## options for showing and identifying changesets |
|
138 | 139 | show_sha_length = 12 |
|
139 | 140 | #show_revision_number = false |
|
140 | 141 | show_revision_number = true |
|
141 | 142 | |
|
142 | 143 | ## Canonical URL to use when creating full URLs in UI and texts. |
|
143 | 144 | ## Useful when the site is available under different names or protocols. |
|
144 | 145 | ## Defaults to what is provided in the WSGI environment. |
|
145 | 146 | #canonical_url = https://kallithea.example.com/repos |
|
146 | 147 | |
|
147 | 148 | ## gist URL alias, used to create nicer urls for gist. This should be an |
|
148 | 149 | ## url that does rewrites to _admin/gists/<gistid>. |
|
149 | 150 | ## example: http://gist.example.com/{gistid}. Empty means use the internal |
|
150 | 151 | ## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid> |
|
151 | 152 | gist_alias_url = |
|
152 | 153 | |
|
153 | 154 | ## white list of API enabled controllers. This allows to add list of |
|
154 | 155 | ## controllers to which access will be enabled by api_key. eg: to enable |
|
155 | 156 | ## api access to raw_files put `FilesController:raw`, to enable access to patches |
|
156 | 157 | ## add `ChangesetController:changeset_patch`. This list should be "," separated |
|
157 | 158 | ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names |
|
158 | 159 | ## Recommended settings below are commented out: |
|
159 | 160 | api_access_controllers_whitelist = |
|
160 | 161 | # ChangesetController:changeset_patch, |
|
161 | 162 | # ChangesetController:changeset_raw, |
|
162 | 163 | # FilesController:raw, |
|
163 | 164 | # FilesController:archivefile |
|
164 | 165 | |
|
165 | 166 | ## default encoding used to convert from and to unicode |
|
166 | 167 | ## can be also a comma separated list of encoding in case of mixed encodings |
|
167 | 168 | default_encoding = utf8 |
|
168 | 169 | |
|
169 | 170 | ## issue tracker for Kallithea (leave blank to disable, absent for default) |
|
170 | 171 | #bugtracker = https://bitbucket.org/conservancy/kallithea/issues |
|
171 | 172 | |
|
172 | 173 | ## issue tracking mapping for commits messages |
|
173 | 174 | ## comment out issue_pat, issue_server, issue_prefix to enable |
|
174 | 175 | |
|
175 | 176 | ## pattern to get the issues from commit messages |
|
176 | 177 | ## default one used here is #<numbers> with a regex passive group for `#` |
|
177 | 178 | ## {id} will be all groups matched from this pattern |
|
178 | 179 | |
|
179 | 180 | issue_pat = (?:\s*#)(\d+) |
|
180 | 181 | |
|
181 | 182 | ## server url to the issue, each {id} will be replaced with match |
|
182 | 183 | ## fetched from the regex and {repo} is replaced with full repository name |
|
183 | 184 | ## including groups {repo_name} is replaced with just name of repo |
|
184 | 185 | |
|
185 | 186 | issue_server_link = https://issues.example.com/{repo}/issue/{id} |
|
186 | 187 | |
|
187 | 188 | ## prefix to add to link to indicate it's an url |
|
188 | 189 | ## #314 will be replaced by <issue_prefix><id> |
|
189 | 190 | |
|
190 | 191 | issue_prefix = # |
|
191 | 192 | |
|
192 | 193 | ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify |
|
193 | 194 | ## multiple patterns, to other issues server, wiki or others |
|
194 | 195 | ## below an example how to create a wiki pattern |
|
195 | 196 | # wiki-some-id -> https://wiki.example.com/some-id |
|
196 | 197 | |
|
197 | 198 | #issue_pat_wiki = (?:wiki-)(.+) |
|
198 | 199 | #issue_server_link_wiki = https://wiki.example.com/{id} |
|
199 | 200 | #issue_prefix_wiki = WIKI- |
|
200 | 201 | |
|
201 | 202 | ## alternative return HTTP header for failed authentication. Default HTTP |
|
202 | 203 | ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with |
|
203 | 204 | ## handling that. Set this variable to 403 to return HTTPForbidden |
|
204 | 205 | auth_ret_code = |
|
205 | 206 | |
|
206 | 207 | ## locking return code. When repository is locked return this HTTP code. 2XX |
|
207 | 208 | ## codes don't break the transactions while 4XX codes do |
|
208 | 209 | lock_ret_code = 423 |
|
209 | 210 | |
|
210 | 211 | ## allows to change the repository location in settings page |
|
211 | 212 | allow_repo_location_change = True |
|
212 | 213 | |
|
213 | 214 | ## allows to setup custom hooks in settings page |
|
214 | 215 | allow_custom_hooks_settings = True |
|
215 | 216 | |
|
216 | 217 | ## extra extensions for indexing, space separated and without the leading '.'. |
|
217 | 218 | # index.extensions = |
|
218 | 219 | # gemfile |
|
219 | 220 | # lock |
|
220 | 221 | |
|
221 | 222 | ## extra filenames for indexing, space separated |
|
222 | 223 | # index.filenames = |
|
223 | 224 | # .dockerignore |
|
224 | 225 | # .editorconfig |
|
225 | 226 | # INSTALL |
|
226 | 227 | # CHANGELOG |
|
227 | 228 | |
|
228 | 229 | #################################### |
|
229 | 230 | ### CELERY CONFIG #### |
|
230 | 231 | #################################### |
|
231 | 232 | |
|
232 | 233 | use_celery = false |
|
233 | 234 | |
|
234 | 235 | ## Example: connect to the virtual host 'rabbitmqhost' on localhost as rabbitmq: |
|
235 | 236 | broker.url = amqp://rabbitmq:qewqew@localhost:5672/rabbitmqhost |
|
236 | 237 | |
|
237 | 238 | celery.imports = kallithea.lib.celerylib.tasks |
|
238 | 239 | celery.accept.content = pickle |
|
239 | 240 | celery.result.backend = amqp |
|
240 | 241 | celery.result.dburi = amqp:// |
|
241 | 242 | celery.result.serialier = json |
|
242 | 243 | |
|
243 | 244 | #celery.send.task.error.emails = true |
|
244 | 245 | #celery.amqp.task.result.expires = 18000 |
|
245 | 246 | |
|
246 | 247 | celeryd.concurrency = 2 |
|
247 | 248 | celeryd.max.tasks.per.child = 1 |
|
248 | 249 | |
|
249 | 250 | ## If true, tasks will never be sent to the queue, but executed locally instead. |
|
250 | 251 | celery.always.eager = false |
|
251 | 252 | |
|
252 | 253 | #################################### |
|
253 | 254 | ### BEAKER CACHE #### |
|
254 | 255 | #################################### |
|
255 | 256 | |
|
256 | 257 | beaker.cache.data_dir = %(here)s/data/cache/data |
|
257 | 258 | beaker.cache.lock_dir = %(here)s/data/cache/lock |
|
258 | 259 | |
|
259 | 260 | beaker.cache.regions = short_term,long_term,sql_cache_short |
|
260 | 261 | |
|
261 | 262 | beaker.cache.short_term.type = memory |
|
262 | 263 | beaker.cache.short_term.expire = 60 |
|
263 | 264 | beaker.cache.short_term.key_length = 256 |
|
264 | 265 | |
|
265 | 266 | beaker.cache.long_term.type = memory |
|
266 | 267 | beaker.cache.long_term.expire = 36000 |
|
267 | 268 | beaker.cache.long_term.key_length = 256 |
|
268 | 269 | |
|
269 | 270 | beaker.cache.sql_cache_short.type = memory |
|
270 | 271 | #beaker.cache.sql_cache_short.expire = 10 |
|
271 | 272 | beaker.cache.sql_cache_short.expire = 1 |
|
272 | 273 | beaker.cache.sql_cache_short.key_length = 256 |
|
273 | 274 | |
|
274 | 275 | #################################### |
|
275 | 276 | ### BEAKER SESSION #### |
|
276 | 277 | #################################### |
|
277 | 278 | |
|
278 | 279 | ## Name of session cookie. Should be unique for a given host and path, even when running |
|
279 | 280 | ## on different ports. Otherwise, cookie sessions will be shared and messed up. |
|
280 | 281 | beaker.session.key = kallithea |
|
281 | 282 | ## Sessions should always only be accessible by the browser, not directly by JavaScript. |
|
282 | 283 | beaker.session.httponly = true |
|
283 | 284 | ## Session lifetime. 2592000 seconds is 30 days. |
|
284 | 285 | beaker.session.timeout = 2592000 |
|
285 | 286 | |
|
286 | 287 | ## Server secret used with HMAC to ensure integrity of cookies. |
|
288 | #beaker.session.secret = VERY-SECRET | |
|
287 | 289 | beaker.session.secret = {74e0cd75-b339-478b-b129-07dd221def1f} |
|
288 | 290 | ## Further, encrypt the data with AES. |
|
289 | 291 | #beaker.session.encrypt_key = <key_for_encryption> |
|
290 | 292 | #beaker.session.validate_key = <validation_key> |
|
291 | 293 | |
|
292 | 294 | ## Type of storage used for the session, current types are |
|
293 | 295 | ## dbm, file, memcached, database, and memory. |
|
294 | 296 | |
|
295 | 297 | ## File system storage of session data. (default) |
|
296 | 298 | #beaker.session.type = file |
|
297 | 299 | |
|
298 | 300 | ## Cookie only, store all session data inside the cookie. Requires secure secrets. |
|
299 | 301 | #beaker.session.type = cookie |
|
300 | 302 | |
|
301 | 303 | ## Database storage of session data. |
|
302 | 304 | #beaker.session.type = ext:database |
|
303 | 305 | #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea |
|
304 | 306 | #beaker.session.table_name = db_session |
|
305 | 307 | |
|
306 | 308 | ################################################################################ |
|
307 | 309 | ## WARNING: *DEBUG MODE MUST BE OFF IN A PRODUCTION ENVIRONMENT* ## |
|
308 | 310 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
309 | 311 | ## execute malicious code after an exception is raised. ## |
|
310 | 312 | ################################################################################ |
|
311 | 313 | debug = false |
|
312 | 314 | |
|
313 | 315 | ################################## |
|
314 | 316 | ### LOGVIEW CONFIG ### |
|
315 | 317 | ################################## |
|
316 | 318 | |
|
317 | 319 | logview.sqlalchemy = #faa |
|
318 | 320 | logview.pylons.templating = #bfb |
|
319 | 321 | logview.pylons.util = #eee |
|
320 | 322 | |
|
321 | 323 | ######################################################### |
|
322 | 324 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
323 | 325 | ######################################################### |
|
324 | 326 | |
|
325 | 327 | # SQLITE [default] |
|
326 | 328 | sqlalchemy.url = sqlite:///%(here)s/kallithea.db?timeout=60 |
|
327 | 329 | |
|
328 | 330 | # see sqlalchemy docs for others |
|
329 | 331 | |
|
330 | 332 | sqlalchemy.pool_recycle = 3600 |
|
331 | 333 | |
|
332 | 334 | ################################ |
|
333 | 335 | ### ALEMBIC CONFIGURATION #### |
|
334 | 336 | ################################ |
|
335 | 337 | |
|
336 | 338 | [alembic] |
|
337 | 339 | script_location = kallithea:alembic |
|
338 | 340 | |
|
339 | 341 | ################################ |
|
340 | 342 | ### LOGGING CONFIGURATION #### |
|
341 | 343 | ################################ |
|
342 | 344 | |
|
343 | 345 | [loggers] |
|
344 | 346 | keys = root, routes, kallithea, sqlalchemy, tg, gearbox, beaker, templates, whoosh_indexer |
|
345 | 347 | |
|
346 | 348 | [handlers] |
|
347 | 349 | keys = console, console_sql |
|
348 | 350 | |
|
349 | 351 | [formatters] |
|
350 | 352 | keys = generic, color_formatter, color_formatter_sql |
|
351 | 353 | |
|
352 | 354 | ############# |
|
353 | 355 | ## LOGGERS ## |
|
354 | 356 | ############# |
|
355 | 357 | |
|
356 | 358 | [logger_root] |
|
357 | 359 | level = NOTSET |
|
358 | 360 | handlers = console |
|
359 | 361 | |
|
360 | 362 | [logger_routes] |
|
361 | 363 | level = DEBUG |
|
362 | 364 | handlers = |
|
363 | 365 | qualname = routes.middleware |
|
364 | 366 | ## "level = DEBUG" logs the route matched and routing variables. |
|
365 | 367 | propagate = 1 |
|
366 | 368 | |
|
367 | 369 | [logger_beaker] |
|
368 | 370 | level = DEBUG |
|
369 | 371 | handlers = |
|
370 | 372 | qualname = beaker.container |
|
371 | 373 | propagate = 1 |
|
372 | 374 | |
|
373 | 375 | [logger_templates] |
|
374 | 376 | level = INFO |
|
375 | 377 | handlers = |
|
376 | 378 | qualname = pylons.templating |
|
377 | 379 | propagate = 1 |
|
378 | 380 | |
|
379 | 381 | [logger_kallithea] |
|
380 | 382 | level = DEBUG |
|
381 | 383 | handlers = |
|
382 | 384 | qualname = kallithea |
|
383 | 385 | propagate = 1 |
|
384 | 386 | |
|
385 | 387 | [logger_tg] |
|
386 | 388 | level = DEBUG |
|
387 | 389 | handlers = |
|
388 | 390 | qualname = tg |
|
389 | 391 | propagate = 1 |
|
390 | 392 | |
|
391 | 393 | [logger_gearbox] |
|
392 | 394 | level = DEBUG |
|
393 | 395 | handlers = |
|
394 | 396 | qualname = gearbox |
|
395 | 397 | propagate = 1 |
|
396 | 398 | |
|
397 | 399 | [logger_sqlalchemy] |
|
398 | 400 | level = WARN |
|
399 | 401 | handlers = console_sql |
|
400 | 402 | qualname = sqlalchemy.engine |
|
401 | 403 | propagate = 0 |
|
402 | 404 | |
|
403 | 405 | [logger_whoosh_indexer] |
|
404 | 406 | level = DEBUG |
|
405 | 407 | handlers = |
|
406 | 408 | qualname = whoosh_indexer |
|
407 | 409 | propagate = 1 |
|
408 | 410 | |
|
409 | 411 | ############## |
|
410 | 412 | ## HANDLERS ## |
|
411 | 413 | ############## |
|
412 | 414 | |
|
413 | 415 | [handler_console] |
|
414 | 416 | class = StreamHandler |
|
415 | 417 | args = (sys.stderr,) |
|
416 | 418 | #formatter = generic |
|
417 | 419 | formatter = color_formatter |
|
418 | 420 | |
|
419 | 421 | [handler_console_sql] |
|
420 | 422 | class = StreamHandler |
|
421 | 423 | args = (sys.stderr,) |
|
422 | 424 | #formatter = generic |
|
423 | 425 | formatter = color_formatter_sql |
|
424 | 426 | |
|
425 | 427 | ################ |
|
426 | 428 | ## FORMATTERS ## |
|
427 | 429 | ################ |
|
428 | 430 | |
|
429 | 431 | [formatter_generic] |
|
430 | 432 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
431 | 433 | datefmt = %Y-%m-%d %H:%M:%S |
|
432 | 434 | |
|
433 | 435 | [formatter_color_formatter] |
|
434 | 436 | class = kallithea.lib.colored_formatter.ColorFormatter |
|
435 | 437 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
436 | 438 | datefmt = %Y-%m-%d %H:%M:%S |
|
437 | 439 | |
|
438 | 440 | [formatter_color_formatter_sql] |
|
439 | 441 | class = kallithea.lib.colored_formatter.ColorFormatterSql |
|
440 | 442 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
441 | 443 | datefmt = %Y-%m-%d %H:%M:%S |
@@ -1,100 +1,100 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 | makofile = 'kallithea/lib/paster_commands/template.ini.mako' |
|
13 | 13 | |
|
14 | 14 | # the mako variables used in all other ini files and templates |
|
15 | 15 | mako_variable_values = { |
|
16 | 16 | 'database_engine': 'sqlite', |
|
17 | 17 | 'http_server': 'waitress', |
|
18 | 18 | 'host': '127.0.0.1', |
|
19 | 19 | 'port': '5000', |
|
20 | 'uuid': lambda: '${app_instance_uuid}', | |
|
20 | 'uuid': lambda: 'VERY-SECRET', | |
|
21 | 21 | } |
|
22 | 22 | |
|
23 | 23 | # files to be generated from the mako template |
|
24 | 24 | ini_files = [ |
|
25 | 25 | ('kallithea/tests/test.ini', |
|
26 | 26 | ''' |
|
27 | 27 | Kallithea - config for tests: |
|
28 | 28 | sqlalchemy and kallithea_test.sqlite |
|
29 | 29 | custom logging |
|
30 | 30 | ''', |
|
31 | 31 | { |
|
32 | 32 | '[server:main]': { |
|
33 | 33 | 'port': '4999', |
|
34 | 34 | }, |
|
35 | 35 | '[app:main]': { |
|
36 | 36 | 'app_instance_uuid': 'test', |
|
37 | 37 | 'show_revision_number': 'true', |
|
38 | 38 | 'beaker.cache.sql_cache_short.expire': '1', |
|
39 | 39 | 'beaker.session.secret': '{74e0cd75-b339-478b-b129-07dd221def1f}', |
|
40 | 40 | }, |
|
41 | 41 | '[handler_console]': { |
|
42 | 42 | 'formatter': 'color_formatter', |
|
43 | 43 | }, |
|
44 | 44 | # The 'handler_console_sql' block is very similar to the one in |
|
45 | 45 | # development.ini, but without the explicit 'level=DEBUG' setting: |
|
46 | 46 | # it causes duplicate sqlalchemy debug logs, one through |
|
47 | 47 | # handler_console_sql and another through another path. |
|
48 | 48 | '[handler_console_sql]': { |
|
49 | 49 | 'formatter': 'color_formatter_sql', |
|
50 | 50 | }, |
|
51 | 51 | }, |
|
52 | 52 | ), |
|
53 | 53 | ('development.ini', |
|
54 | 54 | ''' |
|
55 | 55 | Kallithea - Development config: |
|
56 | 56 | listening on *:5000 |
|
57 | 57 | sqlite and kallithea.db |
|
58 | 58 | initial_repo_scan = true |
|
59 | 59 | debug = true |
|
60 | 60 | verbose and colorful logging |
|
61 | 61 | ''', |
|
62 | 62 | { |
|
63 | 63 | '[server:main]': { |
|
64 | 64 | 'host': '0.0.0.0', |
|
65 | 65 | }, |
|
66 | 66 | '[app:main]': { |
|
67 | 67 | 'initial_repo_scan': 'true', |
|
68 | 68 | 'debug': 'true', |
|
69 | 69 | 'app_instance_uuid': 'development-not-secret', |
|
70 | 70 | 'beaker.session.secret': 'development-not-secret', |
|
71 | 71 | }, |
|
72 | 72 | '[handler_console]': { |
|
73 | 73 | 'formatter': 'color_formatter', |
|
74 | 74 | }, |
|
75 | 75 | '[handler_console_sql]': { |
|
76 | 76 | 'formatter': 'color_formatter_sql', |
|
77 | 77 | }, |
|
78 | 78 | }, |
|
79 | 79 | ), |
|
80 | 80 | ] |
|
81 | 81 | |
|
82 | 82 | |
|
83 | 83 | def main(): |
|
84 | 84 | # make sure all mako lines starting with '#' (the '##' comments) are marked up as <text> |
|
85 | 85 | print 'reading:', makofile |
|
86 | 86 | mako_org = open(makofile).read() |
|
87 | 87 | mako_no_text_markup = re.sub(r'</?%text>', '', mako_org) |
|
88 | 88 | mako_marked_up = re.sub(r'\n(##.*)', r'\n<%text>\1</%text>', mako_no_text_markup, flags=re.MULTILINE) |
|
89 | 89 | if mako_marked_up != mako_org: |
|
90 | 90 | print 'writing:', makofile |
|
91 | 91 | open(makofile, 'w').write(mako_marked_up) |
|
92 | 92 | |
|
93 | 93 | # create ini files |
|
94 | 94 | for fn, desc, settings in ini_files: |
|
95 | 95 | print 'updating:', fn |
|
96 | 96 | ini_lines = inifile.expand(mako_marked_up, desc, mako_variable_values, settings) |
|
97 | 97 | open(fn, 'w').write(ini_lines) |
|
98 | 98 | |
|
99 | 99 | if __name__ == '__main__': |
|
100 | 100 | main() |
General Comments 0
You need to be logged in to leave comments.
Login now