##// END OF EJS Templates
indexers: load additional indexers settings from ini
Takumi IINO -
r5559:6ed126ef default
parent child Browse files
Show More
@@ -1,586 +1,598 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # Kallithea - Development config: #
3 # Kallithea - Development config: #
4 # listening on *:5000 #
4 # listening on *:5000 #
5 # sqlite and kallithea.db #
5 # sqlite and kallithea.db #
6 # initial_repo_scan = true #
6 # initial_repo_scan = true #
7 # set debug = true #
7 # set debug = true #
8 # verbose and colorful logging #
8 # verbose and colorful logging #
9 # #
9 # #
10 # The %(here)s variable will be replaced with the parent directory of this file#
10 # The %(here)s variable will be replaced with the parent directory of this file#
11 ################################################################################
11 ################################################################################
12 ################################################################################
12 ################################################################################
13
13
14 [DEFAULT]
14 [DEFAULT]
15 debug = true
15 debug = true
16 pdebug = false
16 pdebug = false
17
17
18 ################################################################################
18 ################################################################################
19 ## Email settings ##
19 ## Email settings ##
20 ## ##
20 ## ##
21 ## Refer to the documentation ("Email settings") for more details. ##
21 ## Refer to the documentation ("Email settings") for more details. ##
22 ## ##
22 ## ##
23 ## It is recommended to use a valid sender address that passes access ##
23 ## It is recommended to use a valid sender address that passes access ##
24 ## validation and spam filtering in mail servers. ##
24 ## validation and spam filtering in mail servers. ##
25 ################################################################################
25 ################################################################################
26
26
27 ## 'From' header for application emails. You can optionally add a name.
27 ## 'From' header for application emails. You can optionally add a name.
28 ## Default:
28 ## Default:
29 #app_email_from = Kallithea
29 #app_email_from = Kallithea
30 ## Examples:
30 ## Examples:
31 #app_email_from = Kallithea <kallithea-noreply@example.com>
31 #app_email_from = Kallithea <kallithea-noreply@example.com>
32 #app_email_from = kallithea-noreply@example.com
32 #app_email_from = kallithea-noreply@example.com
33
33
34 ## Subject prefix for application emails.
34 ## Subject prefix for application emails.
35 ## A space between this prefix and the real subject is automatically added.
35 ## A space between this prefix and the real subject is automatically added.
36 ## Default:
36 ## Default:
37 #email_prefix =
37 #email_prefix =
38 ## Example:
38 ## Example:
39 #email_prefix = [Kallithea]
39 #email_prefix = [Kallithea]
40
40
41 ## Recipients for error emails and fallback recipients of application mails.
41 ## Recipients for error emails and fallback recipients of application mails.
42 ## Multiple addresses can be specified, space-separated.
42 ## Multiple addresses can be specified, space-separated.
43 ## Only addresses are allowed, do not add any name part.
43 ## Only addresses are allowed, do not add any name part.
44 ## Default:
44 ## Default:
45 #email_to =
45 #email_to =
46 ## Examples:
46 ## Examples:
47 #email_to = admin@example.com
47 #email_to = admin@example.com
48 #email_to = admin@example.com another_admin@example.com
48 #email_to = admin@example.com another_admin@example.com
49
49
50 ## 'From' header for error emails. You can optionally add a name.
50 ## 'From' header for error emails. You can optionally add a name.
51 ## Default:
51 ## Default:
52 #error_email_from = pylons@yourapp.com
52 #error_email_from = pylons@yourapp.com
53 ## Examples:
53 ## Examples:
54 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
54 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
55 #error_email_from = paste_error@example.com
55 #error_email_from = paste_error@example.com
56
56
57 ## SMTP server settings
57 ## SMTP server settings
58 ## Only smtp_server is mandatory. All other settings take the specified default
58 ## Only smtp_server is mandatory. All other settings take the specified default
59 ## values.
59 ## values.
60 #smtp_server = smtp.example.com
60 #smtp_server = smtp.example.com
61 #smtp_username =
61 #smtp_username =
62 #smtp_password =
62 #smtp_password =
63 #smtp_port = 25
63 #smtp_port = 25
64 #smtp_use_tls = false
64 #smtp_use_tls = false
65 #smtp_use_ssl = false
65 #smtp_use_ssl = false
66 ## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).
66 ## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).
67 ## If empty, use any of the authentication parameters supported by the server.
67 ## If empty, use any of the authentication parameters supported by the server.
68 #smtp_auth =
68 #smtp_auth =
69
69
70 [server:main]
70 [server:main]
71 ## PASTE ##
71 ## PASTE ##
72 #use = egg:Paste#http
72 #use = egg:Paste#http
73 ## nr of worker threads to spawn
73 ## nr of worker threads to spawn
74 #threadpool_workers = 5
74 #threadpool_workers = 5
75 ## max request before thread respawn
75 ## max request before thread respawn
76 #threadpool_max_requests = 10
76 #threadpool_max_requests = 10
77 ## option to use threads of process
77 ## option to use threads of process
78 #use_threadpool = true
78 #use_threadpool = true
79
79
80 ## WAITRESS ##
80 ## WAITRESS ##
81 use = egg:waitress#main
81 use = egg:waitress#main
82 ## number of worker threads
82 ## number of worker threads
83 threads = 5
83 threads = 5
84 ## MAX BODY SIZE 100GB
84 ## MAX BODY SIZE 100GB
85 max_request_body_size = 107374182400
85 max_request_body_size = 107374182400
86 ## use poll instead of select, fixes fd limits, may not work on old
86 ## use poll instead of select, fixes fd limits, may not work on old
87 ## windows systems.
87 ## windows systems.
88 #asyncore_use_poll = True
88 #asyncore_use_poll = True
89
89
90 ## GUNICORN ##
90 ## GUNICORN ##
91 #use = egg:gunicorn#main
91 #use = egg:gunicorn#main
92 ## number of process workers. You must set `instance_id = *` when this option
92 ## number of process workers. You must set `instance_id = *` when this option
93 ## is set to more than one worker
93 ## is set to more than one worker
94 #workers = 1
94 #workers = 1
95 ## process name
95 ## process name
96 #proc_name = kallithea
96 #proc_name = kallithea
97 ## type of worker class, one of sync, eventlet, gevent, tornado
97 ## type of worker class, one of sync, eventlet, gevent, tornado
98 ## recommended for bigger setup is using of of other than sync one
98 ## recommended for bigger setup is using of of other than sync one
99 #worker_class = sync
99 #worker_class = sync
100 #max_requests = 1000
100 #max_requests = 1000
101 ## ammount of time a worker can handle request before it gets killed and
101 ## ammount of time a worker can handle request before it gets killed and
102 ## restarted
102 ## restarted
103 #timeout = 3600
103 #timeout = 3600
104
104
105 ## UWSGI ##
105 ## UWSGI ##
106 ## run with uwsgi --ini-paste-logged <inifile.ini>
106 ## run with uwsgi --ini-paste-logged <inifile.ini>
107 #[uwsgi]
107 #[uwsgi]
108 #socket = /tmp/uwsgi.sock
108 #socket = /tmp/uwsgi.sock
109 #master = true
109 #master = true
110 #http = 127.0.0.1:5000
110 #http = 127.0.0.1:5000
111
111
112 ## set as deamon and redirect all output to file
112 ## set as deamon and redirect all output to file
113 #daemonize = ./uwsgi_kallithea.log
113 #daemonize = ./uwsgi_kallithea.log
114
114
115 ## master process PID
115 ## master process PID
116 #pidfile = ./uwsgi_kallithea.pid
116 #pidfile = ./uwsgi_kallithea.pid
117
117
118 ## stats server with workers statistics, use uwsgitop
118 ## stats server with workers statistics, use uwsgitop
119 ## for monitoring, `uwsgitop 127.0.0.1:1717`
119 ## for monitoring, `uwsgitop 127.0.0.1:1717`
120 #stats = 127.0.0.1:1717
120 #stats = 127.0.0.1:1717
121 #memory-report = true
121 #memory-report = true
122
122
123 ## log 5XX errors
123 ## log 5XX errors
124 #log-5xx = true
124 #log-5xx = true
125
125
126 ## Set the socket listen queue size.
126 ## Set the socket listen queue size.
127 #listen = 256
127 #listen = 256
128
128
129 ## Gracefully Reload workers after the specified amount of managed requests
129 ## Gracefully Reload workers after the specified amount of managed requests
130 ## (avoid memory leaks).
130 ## (avoid memory leaks).
131 #max-requests = 1000
131 #max-requests = 1000
132
132
133 ## enable large buffers
133 ## enable large buffers
134 #buffer-size = 65535
134 #buffer-size = 65535
135
135
136 ## socket and http timeouts ##
136 ## socket and http timeouts ##
137 #http-timeout = 3600
137 #http-timeout = 3600
138 #socket-timeout = 3600
138 #socket-timeout = 3600
139
139
140 ## Log requests slower than the specified number of milliseconds.
140 ## Log requests slower than the specified number of milliseconds.
141 #log-slow = 10
141 #log-slow = 10
142
142
143 ## Exit if no app can be loaded.
143 ## Exit if no app can be loaded.
144 #need-app = true
144 #need-app = true
145
145
146 ## Set lazy mode (load apps in workers instead of master).
146 ## Set lazy mode (load apps in workers instead of master).
147 #lazy = true
147 #lazy = true
148
148
149 ## scaling ##
149 ## scaling ##
150 ## set cheaper algorithm to use, if not set default will be used
150 ## set cheaper algorithm to use, if not set default will be used
151 #cheaper-algo = spare
151 #cheaper-algo = spare
152
152
153 ## minimum number of workers to keep at all times
153 ## minimum number of workers to keep at all times
154 #cheaper = 1
154 #cheaper = 1
155
155
156 ## number of workers to spawn at startup
156 ## number of workers to spawn at startup
157 #cheaper-initial = 1
157 #cheaper-initial = 1
158
158
159 ## maximum number of workers that can be spawned
159 ## maximum number of workers that can be spawned
160 #workers = 4
160 #workers = 4
161
161
162 ## how many workers should be spawned at a time
162 ## how many workers should be spawned at a time
163 #cheaper-step = 1
163 #cheaper-step = 1
164
164
165 ## COMMON ##
165 ## COMMON ##
166 #host = 127.0.0.1
166 #host = 127.0.0.1
167 host = 0.0.0.0
167 host = 0.0.0.0
168 port = 5000
168 port = 5000
169
169
170 ## middleware for hosting the WSGI application under a URL prefix
170 ## middleware for hosting the WSGI application under a URL prefix
171 #[filter:proxy-prefix]
171 #[filter:proxy-prefix]
172 #use = egg:PasteDeploy#prefix
172 #use = egg:PasteDeploy#prefix
173 #prefix = /<your-prefix>
173 #prefix = /<your-prefix>
174
174
175 [app:main]
175 [app:main]
176 use = egg:kallithea
176 use = egg:kallithea
177 ## enable proxy prefix middleware
177 ## enable proxy prefix middleware
178 #filter-with = proxy-prefix
178 #filter-with = proxy-prefix
179
179
180 full_stack = true
180 full_stack = true
181 static_files = true
181 static_files = true
182 ## Available Languages:
182 ## Available Languages:
183 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
183 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
184 lang =
184 lang =
185 cache_dir = %(here)s/data
185 cache_dir = %(here)s/data
186 index_dir = %(here)s/data/index
186 index_dir = %(here)s/data/index
187
187
188 ## perform a full repository scan on each server start, this should be
188 ## perform a full repository scan on each server start, this should be
189 ## set to false after first startup, to allow faster server restarts.
189 ## set to false after first startup, to allow faster server restarts.
190 #initial_repo_scan = false
190 #initial_repo_scan = false
191 initial_repo_scan = true
191 initial_repo_scan = true
192
192
193 ## uncomment and set this path to use archive download cache
193 ## uncomment and set this path to use archive download cache
194 archive_cache_dir = %(here)s/tarballcache
194 archive_cache_dir = %(here)s/tarballcache
195
195
196 ## change this to unique ID for security
196 ## change this to unique ID for security
197 app_instance_uuid = development-not-secret
197 app_instance_uuid = development-not-secret
198
198
199 ## cut off limit for large diffs (size in bytes)
199 ## cut off limit for large diffs (size in bytes)
200 cut_off_limit = 256000
200 cut_off_limit = 256000
201
201
202 ## use cache version of scm repo everywhere
202 ## use cache version of scm repo everywhere
203 vcs_full_cache = true
203 vcs_full_cache = true
204
204
205 ## force https in Kallithea, fixes https redirects, assumes it's always https
205 ## force https in Kallithea, fixes https redirects, assumes it's always https
206 force_https = false
206 force_https = false
207
207
208 ## use Strict-Transport-Security headers
208 ## use Strict-Transport-Security headers
209 use_htsts = false
209 use_htsts = false
210
210
211 ## number of commits stats will parse on each iteration
211 ## number of commits stats will parse on each iteration
212 commit_parse_limit = 25
212 commit_parse_limit = 25
213
213
214 ## path to git executable
214 ## path to git executable
215 git_path = git
215 git_path = git
216
216
217 ## git rev filter option, --all is the default filter, if you need to
217 ## git rev filter option, --all is the default filter, if you need to
218 ## hide all refs in changelog switch this to --branches --tags
218 ## hide all refs in changelog switch this to --branches --tags
219 #git_rev_filter = --branches --tags
219 #git_rev_filter = --branches --tags
220
220
221 ## RSS feed options
221 ## RSS feed options
222 rss_cut_off_limit = 256000
222 rss_cut_off_limit = 256000
223 rss_items_per_page = 10
223 rss_items_per_page = 10
224 rss_include_diff = false
224 rss_include_diff = false
225
225
226 ## options for showing and identifying changesets
226 ## options for showing and identifying changesets
227 show_sha_length = 12
227 show_sha_length = 12
228 show_revision_number = false
228 show_revision_number = false
229
229
230 ## gist URL alias, used to create nicer urls for gist. This should be an
230 ## gist URL alias, used to create nicer urls for gist. This should be an
231 ## url that does rewrites to _admin/gists/<gistid>.
231 ## url that does rewrites to _admin/gists/<gistid>.
232 ## example: http://gist.example.com/{gistid}. Empty means use the internal
232 ## example: http://gist.example.com/{gistid}. Empty means use the internal
233 ## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid>
233 ## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid>
234 gist_alias_url =
234 gist_alias_url =
235
235
236 ## white list of API enabled controllers. This allows to add list of
236 ## white list of API enabled controllers. This allows to add list of
237 ## controllers to which access will be enabled by api_key. eg: to enable
237 ## controllers to which access will be enabled by api_key. eg: to enable
238 ## api access to raw_files put `FilesController:raw`, to enable access to patches
238 ## api access to raw_files put `FilesController:raw`, to enable access to patches
239 ## add `ChangesetController:changeset_patch`. This list should be "," separated
239 ## add `ChangesetController:changeset_patch`. This list should be "," separated
240 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
240 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
241 ## Recommended settings below are commented out:
241 ## Recommended settings below are commented out:
242 api_access_controllers_whitelist =
242 api_access_controllers_whitelist =
243 # ChangesetController:changeset_patch,
243 # ChangesetController:changeset_patch,
244 # ChangesetController:changeset_raw,
244 # ChangesetController:changeset_raw,
245 # FilesController:raw,
245 # FilesController:raw,
246 # FilesController:archivefile
246 # FilesController:archivefile
247
247
248 ## default encoding used to convert from and to unicode
248 ## default encoding used to convert from and to unicode
249 ## can be also a comma seperated list of encoding in case of mixed encodings
249 ## can be also a comma seperated list of encoding in case of mixed encodings
250 default_encoding = utf8
250 default_encoding = utf8
251
251
252 ## issue tracker for Kallithea (leave blank to disable, absent for default)
252 ## issue tracker for Kallithea (leave blank to disable, absent for default)
253 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
253 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
254
254
255 ## issue tracking mapping for commits messages
255 ## issue tracking mapping for commits messages
256 ## comment out issue_pat, issue_server, issue_prefix to enable
256 ## comment out issue_pat, issue_server, issue_prefix to enable
257
257
258 ## pattern to get the issues from commit messages
258 ## pattern to get the issues from commit messages
259 ## default one used here is #<numbers> with a regex passive group for `#`
259 ## default one used here is #<numbers> with a regex passive group for `#`
260 ## {id} will be all groups matched from this pattern
260 ## {id} will be all groups matched from this pattern
261
261
262 issue_pat = (?:\s*#)(\d+)
262 issue_pat = (?:\s*#)(\d+)
263
263
264 ## server url to the issue, each {id} will be replaced with match
264 ## server url to the issue, each {id} will be replaced with match
265 ## fetched from the regex and {repo} is replaced with full repository name
265 ## fetched from the regex and {repo} is replaced with full repository name
266 ## including groups {repo_name} is replaced with just name of repo
266 ## including groups {repo_name} is replaced with just name of repo
267
267
268 issue_server_link = https://issues.example.com/{repo}/issue/{id}
268 issue_server_link = https://issues.example.com/{repo}/issue/{id}
269
269
270 ## prefix to add to link to indicate it's an url
270 ## prefix to add to link to indicate it's an url
271 ## #314 will be replaced by <issue_prefix><id>
271 ## #314 will be replaced by <issue_prefix><id>
272
272
273 issue_prefix = #
273 issue_prefix = #
274
274
275 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
275 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
276 ## multiple patterns, to other issues server, wiki or others
276 ## multiple patterns, to other issues server, wiki or others
277 ## below an example how to create a wiki pattern
277 ## below an example how to create a wiki pattern
278 # wiki-some-id -> https://wiki.example.com/some-id
278 # wiki-some-id -> https://wiki.example.com/some-id
279
279
280 #issue_pat_wiki = (?:wiki-)(.+)
280 #issue_pat_wiki = (?:wiki-)(.+)
281 #issue_server_link_wiki = https://wiki.example.com/{id}
281 #issue_server_link_wiki = https://wiki.example.com/{id}
282 #issue_prefix_wiki = WIKI-
282 #issue_prefix_wiki = WIKI-
283
283
284 ## alternative return HTTP header for failed authentication. Default HTTP
284 ## alternative return HTTP header for failed authentication. Default HTTP
285 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
285 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
286 ## handling that. Set this variable to 403 to return HTTPForbidden
286 ## handling that. Set this variable to 403 to return HTTPForbidden
287 auth_ret_code =
287 auth_ret_code =
288
288
289 ## locking return code. When repository is locked return this HTTP code. 2XX
289 ## locking return code. When repository is locked return this HTTP code. 2XX
290 ## codes don't break the transactions while 4XX codes do
290 ## codes don't break the transactions while 4XX codes do
291 lock_ret_code = 423
291 lock_ret_code = 423
292
292
293 ## allows to change the repository location in settings page
293 ## allows to change the repository location in settings page
294 allow_repo_location_change = True
294 allow_repo_location_change = True
295
295
296 ## allows to setup custom hooks in settings page
296 ## allows to setup custom hooks in settings page
297 allow_custom_hooks_settings = True
297 allow_custom_hooks_settings = True
298
298
299 ## extra extensions for indexing, space separated and without the leading '.'.
300 # index.extensions =
301 # gemfile
302 # lock
303
304 ## extra filenames for indexing, space separated
305 # index.filenames =
306 # .dockerignore
307 # .editorconfig
308 # INSTALL
309 # CHANGELOG
310
299 ####################################
311 ####################################
300 ### CELERY CONFIG ####
312 ### CELERY CONFIG ####
301 ####################################
313 ####################################
302
314
303 use_celery = false
315 use_celery = false
304 broker.host = localhost
316 broker.host = localhost
305 broker.vhost = rabbitmqhost
317 broker.vhost = rabbitmqhost
306 broker.port = 5672
318 broker.port = 5672
307 broker.user = rabbitmq
319 broker.user = rabbitmq
308 broker.password = qweqwe
320 broker.password = qweqwe
309
321
310 celery.imports = kallithea.lib.celerylib.tasks
322 celery.imports = kallithea.lib.celerylib.tasks
311
323
312 celery.result.backend = amqp
324 celery.result.backend = amqp
313 celery.result.dburi = amqp://
325 celery.result.dburi = amqp://
314 celery.result.serialier = json
326 celery.result.serialier = json
315
327
316 #celery.send.task.error.emails = true
328 #celery.send.task.error.emails = true
317 #celery.amqp.task.result.expires = 18000
329 #celery.amqp.task.result.expires = 18000
318
330
319 celeryd.concurrency = 2
331 celeryd.concurrency = 2
320 #celeryd.log.file = celeryd.log
332 #celeryd.log.file = celeryd.log
321 celeryd.log.level = DEBUG
333 celeryd.log.level = DEBUG
322 celeryd.max.tasks.per.child = 1
334 celeryd.max.tasks.per.child = 1
323
335
324 ## tasks will never be sent to the queue, but executed locally instead.
336 ## tasks will never be sent to the queue, but executed locally instead.
325 celery.always.eager = false
337 celery.always.eager = false
326
338
327 ####################################
339 ####################################
328 ### BEAKER CACHE ####
340 ### BEAKER CACHE ####
329 ####################################
341 ####################################
330
342
331 beaker.cache.data_dir = %(here)s/data/cache/data
343 beaker.cache.data_dir = %(here)s/data/cache/data
332 beaker.cache.lock_dir = %(here)s/data/cache/lock
344 beaker.cache.lock_dir = %(here)s/data/cache/lock
333
345
334 beaker.cache.regions = short_term,long_term,sql_cache_short
346 beaker.cache.regions = short_term,long_term,sql_cache_short
335
347
336 beaker.cache.short_term.type = memory
348 beaker.cache.short_term.type = memory
337 beaker.cache.short_term.expire = 60
349 beaker.cache.short_term.expire = 60
338 beaker.cache.short_term.key_length = 256
350 beaker.cache.short_term.key_length = 256
339
351
340 beaker.cache.long_term.type = memory
352 beaker.cache.long_term.type = memory
341 beaker.cache.long_term.expire = 36000
353 beaker.cache.long_term.expire = 36000
342 beaker.cache.long_term.key_length = 256
354 beaker.cache.long_term.key_length = 256
343
355
344 beaker.cache.sql_cache_short.type = memory
356 beaker.cache.sql_cache_short.type = memory
345 beaker.cache.sql_cache_short.expire = 10
357 beaker.cache.sql_cache_short.expire = 10
346 beaker.cache.sql_cache_short.key_length = 256
358 beaker.cache.sql_cache_short.key_length = 256
347
359
348 ####################################
360 ####################################
349 ### BEAKER SESSION ####
361 ### BEAKER SESSION ####
350 ####################################
362 ####################################
351
363
352 ## Name of session cookie. Should be unique for a given host and path, even when running
364 ## Name of session cookie. Should be unique for a given host and path, even when running
353 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
365 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
354 beaker.session.key = kallithea
366 beaker.session.key = kallithea
355 ## Sessions should always only be accessible by the browser, not directly by JavaScript.
367 ## Sessions should always only be accessible by the browser, not directly by JavaScript.
356 beaker.session.httponly = true
368 beaker.session.httponly = true
357 ## Session lifetime. 2592000 seconds is 30 days.
369 ## Session lifetime. 2592000 seconds is 30 days.
358 beaker.session.timeout = 2592000
370 beaker.session.timeout = 2592000
359
371
360 ## Server secret used with HMAC to ensure integrity of cookies.
372 ## Server secret used with HMAC to ensure integrity of cookies.
361 beaker.session.secret = development-not-secret
373 beaker.session.secret = development-not-secret
362 ## Further, encrypt the data with AES.
374 ## Further, encrypt the data with AES.
363 #beaker.session.encrypt_key = <key_for_encryption>
375 #beaker.session.encrypt_key = <key_for_encryption>
364 #beaker.session.validate_key = <validation_key>
376 #beaker.session.validate_key = <validation_key>
365
377
366 ## Type of storage used for the session, current types are
378 ## Type of storage used for the session, current types are
367 ## dbm, file, memcached, database, and memory.
379 ## dbm, file, memcached, database, and memory.
368
380
369 ## File system storage of session data. (default)
381 ## File system storage of session data. (default)
370 #beaker.session.type = file
382 #beaker.session.type = file
371
383
372 ## Cookie only, store all session data inside the cookie. Requires secure secrets.
384 ## Cookie only, store all session data inside the cookie. Requires secure secrets.
373 #beaker.session.type = cookie
385 #beaker.session.type = cookie
374
386
375 ## Database storage of session data.
387 ## Database storage of session data.
376 #beaker.session.type = ext:database
388 #beaker.session.type = ext:database
377 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
389 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
378 #beaker.session.table_name = db_session
390 #beaker.session.table_name = db_session
379
391
380 ############################
392 ############################
381 ## ERROR HANDLING SYSTEMS ##
393 ## ERROR HANDLING SYSTEMS ##
382 ############################
394 ############################
383
395
384 ####################
396 ####################
385 ### [errormator] ###
397 ### [errormator] ###
386 ####################
398 ####################
387
399
388 ## Errormator is tailored to work with Kallithea, see
400 ## Errormator is tailored to work with Kallithea, see
389 ## http://errormator.com for details how to obtain an account
401 ## http://errormator.com for details how to obtain an account
390 ## you must install python package `errormator_client` to make it work
402 ## you must install python package `errormator_client` to make it work
391
403
392 ## errormator enabled
404 ## errormator enabled
393 errormator = false
405 errormator = false
394
406
395 errormator.server_url = https://api.errormator.com
407 errormator.server_url = https://api.errormator.com
396 errormator.api_key = YOUR_API_KEY
408 errormator.api_key = YOUR_API_KEY
397
409
398 ## TWEAK AMOUNT OF INFO SENT HERE
410 ## TWEAK AMOUNT OF INFO SENT HERE
399
411
400 ## enables 404 error logging (default False)
412 ## enables 404 error logging (default False)
401 errormator.report_404 = false
413 errormator.report_404 = false
402
414
403 ## time in seconds after request is considered being slow (default 1)
415 ## time in seconds after request is considered being slow (default 1)
404 errormator.slow_request_time = 1
416 errormator.slow_request_time = 1
405
417
406 ## record slow requests in application
418 ## record slow requests in application
407 ## (needs to be enabled for slow datastore recording and time tracking)
419 ## (needs to be enabled for slow datastore recording and time tracking)
408 errormator.slow_requests = true
420 errormator.slow_requests = true
409
421
410 ## enable hooking to application loggers
422 ## enable hooking to application loggers
411 #errormator.logging = true
423 #errormator.logging = true
412
424
413 ## minimum log level for log capture
425 ## minimum log level for log capture
414 #errormator.logging.level = WARNING
426 #errormator.logging.level = WARNING
415
427
416 ## send logs only from erroneous/slow requests
428 ## send logs only from erroneous/slow requests
417 ## (saves API quota for intensive logging)
429 ## (saves API quota for intensive logging)
418 errormator.logging_on_error = false
430 errormator.logging_on_error = false
419
431
420 ## list of additonal keywords that should be grabbed from environ object
432 ## list of additonal keywords that should be grabbed from environ object
421 ## can be string with comma separated list of words in lowercase
433 ## can be string with comma separated list of words in lowercase
422 ## (by default client will always send following info:
434 ## (by default client will always send following info:
423 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
435 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
424 ## start with HTTP* this list be extended with additional keywords here
436 ## start with HTTP* this list be extended with additional keywords here
425 errormator.environ_keys_whitelist =
437 errormator.environ_keys_whitelist =
426
438
427 ## list of keywords that should be blanked from request object
439 ## list of keywords that should be blanked from request object
428 ## can be string with comma separated list of words in lowercase
440 ## can be string with comma separated list of words in lowercase
429 ## (by default client will always blank keys that contain following words
441 ## (by default client will always blank keys that contain following words
430 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
442 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
431 ## this list be extended with additional keywords set here
443 ## this list be extended with additional keywords set here
432 errormator.request_keys_blacklist =
444 errormator.request_keys_blacklist =
433
445
434 ## list of namespaces that should be ignores when gathering log entries
446 ## list of namespaces that should be ignores when gathering log entries
435 ## can be string with comma separated list of namespaces
447 ## can be string with comma separated list of namespaces
436 ## (by default the client ignores own entries: errormator_client.client)
448 ## (by default the client ignores own entries: errormator_client.client)
437 errormator.log_namespace_blacklist =
449 errormator.log_namespace_blacklist =
438
450
439 ################
451 ################
440 ### [sentry] ###
452 ### [sentry] ###
441 ################
453 ################
442
454
443 ## sentry is a alternative open source error aggregator
455 ## sentry is a alternative open source error aggregator
444 ## you must install python packages `sentry` and `raven` to enable
456 ## you must install python packages `sentry` and `raven` to enable
445
457
446 sentry.dsn = YOUR_DNS
458 sentry.dsn = YOUR_DNS
447 sentry.servers =
459 sentry.servers =
448 sentry.name =
460 sentry.name =
449 sentry.key =
461 sentry.key =
450 sentry.public_key =
462 sentry.public_key =
451 sentry.secret_key =
463 sentry.secret_key =
452 sentry.project =
464 sentry.project =
453 sentry.site =
465 sentry.site =
454 sentry.include_paths =
466 sentry.include_paths =
455 sentry.exclude_paths =
467 sentry.exclude_paths =
456
468
457 ################################################################################
469 ################################################################################
458 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
470 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
459 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
471 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
460 ## execute malicious code after an exception is raised. ##
472 ## execute malicious code after an exception is raised. ##
461 ################################################################################
473 ################################################################################
462 #set debug = false
474 #set debug = false
463 set debug = true
475 set debug = true
464
476
465 ##################################
477 ##################################
466 ### LOGVIEW CONFIG ###
478 ### LOGVIEW CONFIG ###
467 ##################################
479 ##################################
468
480
469 logview.sqlalchemy = #faa
481 logview.sqlalchemy = #faa
470 logview.pylons.templating = #bfb
482 logview.pylons.templating = #bfb
471 logview.pylons.util = #eee
483 logview.pylons.util = #eee
472
484
473 #########################################################
485 #########################################################
474 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
486 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
475 #########################################################
487 #########################################################
476
488
477 # SQLITE [default]
489 # SQLITE [default]
478 sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60
490 sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60
479
491
480 # POSTGRESQL
492 # POSTGRESQL
481 #sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
493 #sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
482
494
483 # MySQL
495 # MySQL
484 #sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
496 #sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
485
497
486 # see sqlalchemy docs for others
498 # see sqlalchemy docs for others
487
499
488 sqlalchemy.db1.echo = false
500 sqlalchemy.db1.echo = false
489 sqlalchemy.db1.pool_recycle = 3600
501 sqlalchemy.db1.pool_recycle = 3600
490 sqlalchemy.db1.convert_unicode = true
502 sqlalchemy.db1.convert_unicode = true
491
503
492 ################################
504 ################################
493 ### LOGGING CONFIGURATION ####
505 ### LOGGING CONFIGURATION ####
494 ################################
506 ################################
495
507
496 [loggers]
508 [loggers]
497 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
509 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
498
510
499 [handlers]
511 [handlers]
500 keys = console, console_sql
512 keys = console, console_sql
501
513
502 [formatters]
514 [formatters]
503 keys = generic, color_formatter, color_formatter_sql
515 keys = generic, color_formatter, color_formatter_sql
504
516
505 #############
517 #############
506 ## LOGGERS ##
518 ## LOGGERS ##
507 #############
519 #############
508
520
509 [logger_root]
521 [logger_root]
510 level = NOTSET
522 level = NOTSET
511 handlers = console
523 handlers = console
512
524
513 [logger_routes]
525 [logger_routes]
514 level = DEBUG
526 level = DEBUG
515 handlers =
527 handlers =
516 qualname = routes.middleware
528 qualname = routes.middleware
517 ## "level = DEBUG" logs the route matched and routing variables.
529 ## "level = DEBUG" logs the route matched and routing variables.
518 propagate = 1
530 propagate = 1
519
531
520 [logger_beaker]
532 [logger_beaker]
521 level = DEBUG
533 level = DEBUG
522 handlers =
534 handlers =
523 qualname = beaker.container
535 qualname = beaker.container
524 propagate = 1
536 propagate = 1
525
537
526 [logger_templates]
538 [logger_templates]
527 level = INFO
539 level = INFO
528 handlers =
540 handlers =
529 qualname = pylons.templating
541 qualname = pylons.templating
530 propagate = 1
542 propagate = 1
531
543
532 [logger_kallithea]
544 [logger_kallithea]
533 level = DEBUG
545 level = DEBUG
534 handlers =
546 handlers =
535 qualname = kallithea
547 qualname = kallithea
536 propagate = 1
548 propagate = 1
537
549
538 [logger_sqlalchemy]
550 [logger_sqlalchemy]
539 level = INFO
551 level = INFO
540 handlers = console_sql
552 handlers = console_sql
541 qualname = sqlalchemy.engine
553 qualname = sqlalchemy.engine
542 propagate = 0
554 propagate = 0
543
555
544 [logger_whoosh_indexer]
556 [logger_whoosh_indexer]
545 level = DEBUG
557 level = DEBUG
546 handlers =
558 handlers =
547 qualname = whoosh_indexer
559 qualname = whoosh_indexer
548 propagate = 1
560 propagate = 1
549
561
550 ##############
562 ##############
551 ## HANDLERS ##
563 ## HANDLERS ##
552 ##############
564 ##############
553
565
554 [handler_console]
566 [handler_console]
555 class = StreamHandler
567 class = StreamHandler
556 args = (sys.stderr,)
568 args = (sys.stderr,)
557 #level = INFO
569 #level = INFO
558 level = DEBUG
570 level = DEBUG
559 #formatter = generic
571 #formatter = generic
560 formatter = color_formatter
572 formatter = color_formatter
561
573
562 [handler_console_sql]
574 [handler_console_sql]
563 class = StreamHandler
575 class = StreamHandler
564 args = (sys.stderr,)
576 args = (sys.stderr,)
565 #level = WARN
577 #level = WARN
566 level = DEBUG
578 level = DEBUG
567 #formatter = generic
579 #formatter = generic
568 formatter = color_formatter_sql
580 formatter = color_formatter_sql
569
581
570 ################
582 ################
571 ## FORMATTERS ##
583 ## FORMATTERS ##
572 ################
584 ################
573
585
574 [formatter_generic]
586 [formatter_generic]
575 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
587 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
576 datefmt = %Y-%m-%d %H:%M:%S
588 datefmt = %Y-%m-%d %H:%M:%S
577
589
578 [formatter_color_formatter]
590 [formatter_color_formatter]
579 class = kallithea.lib.colored_formatter.ColorFormatter
591 class = kallithea.lib.colored_formatter.ColorFormatter
580 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
592 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
581 datefmt = %Y-%m-%d %H:%M:%S
593 datefmt = %Y-%m-%d %H:%M:%S
582
594
583 [formatter_color_formatter_sql]
595 [formatter_color_formatter_sql]
584 class = kallithea.lib.colored_formatter.ColorFormatterSql
596 class = kallithea.lib.colored_formatter.ColorFormatterSql
585 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
597 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
586 datefmt = %Y-%m-%d %H:%M:%S
598 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,585 +1,597 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%text>################################################################################</%text>
2 <%text>################################################################################</%text>
3 <%text>################################################################################</%text>
3 <%text>################################################################################</%text>
4 # Kallithea - config file generated with kallithea-config #
4 # Kallithea - config file generated with kallithea-config #
5 <%text>################################################################################</%text>
5 <%text>################################################################################</%text>
6 <%text>################################################################################</%text>
6 <%text>################################################################################</%text>
7
7
8 [DEFAULT]
8 [DEFAULT]
9 debug = true
9 debug = true
10 pdebug = false
10 pdebug = false
11
11
12 <%text>################################################################################</%text>
12 <%text>################################################################################</%text>
13 <%text>## Email settings ##</%text>
13 <%text>## Email settings ##</%text>
14 <%text>## ##</%text>
14 <%text>## ##</%text>
15 <%text>## Refer to the documentation ("Email settings") for more details. ##</%text>
15 <%text>## Refer to the documentation ("Email settings") for more details. ##</%text>
16 <%text>## ##</%text>
16 <%text>## ##</%text>
17 <%text>## It is recommended to use a valid sender address that passes access ##</%text>
17 <%text>## It is recommended to use a valid sender address that passes access ##</%text>
18 <%text>## validation and spam filtering in mail servers. ##</%text>
18 <%text>## validation and spam filtering in mail servers. ##</%text>
19 <%text>################################################################################</%text>
19 <%text>################################################################################</%text>
20
20
21 <%text>## 'From' header for application emails. You can optionally add a name.</%text>
21 <%text>## 'From' header for application emails. You can optionally add a name.</%text>
22 <%text>## Default:</%text>
22 <%text>## Default:</%text>
23 #app_email_from = Kallithea
23 #app_email_from = Kallithea
24 <%text>## Examples:</%text>
24 <%text>## Examples:</%text>
25 #app_email_from = Kallithea <kallithea-noreply@example.com>
25 #app_email_from = Kallithea <kallithea-noreply@example.com>
26 #app_email_from = kallithea-noreply@example.com
26 #app_email_from = kallithea-noreply@example.com
27
27
28 <%text>## Subject prefix for application emails.</%text>
28 <%text>## Subject prefix for application emails.</%text>
29 <%text>## A space between this prefix and the real subject is automatically added.</%text>
29 <%text>## A space between this prefix and the real subject is automatically added.</%text>
30 <%text>## Default:</%text>
30 <%text>## Default:</%text>
31 #email_prefix =
31 #email_prefix =
32 <%text>## Example:</%text>
32 <%text>## Example:</%text>
33 #email_prefix = [Kallithea]
33 #email_prefix = [Kallithea]
34
34
35 <%text>## Recipients for error emails and fallback recipients of application mails.</%text>
35 <%text>## Recipients for error emails and fallback recipients of application mails.</%text>
36 <%text>## Multiple addresses can be specified, space-separated.</%text>
36 <%text>## Multiple addresses can be specified, space-separated.</%text>
37 <%text>## Only addresses are allowed, do not add any name part.</%text>
37 <%text>## Only addresses are allowed, do not add any name part.</%text>
38 <%text>## Default:</%text>
38 <%text>## Default:</%text>
39 #email_to =
39 #email_to =
40 <%text>## Examples:</%text>
40 <%text>## Examples:</%text>
41 #email_to = admin@example.com
41 #email_to = admin@example.com
42 #email_to = admin@example.com another_admin@example.com
42 #email_to = admin@example.com another_admin@example.com
43
43
44 <%text>## 'From' header for error emails. You can optionally add a name.</%text>
44 <%text>## 'From' header for error emails. You can optionally add a name.</%text>
45 <%text>## Default:</%text>
45 <%text>## Default:</%text>
46 #error_email_from = pylons@yourapp.com
46 #error_email_from = pylons@yourapp.com
47 <%text>## Examples:</%text>
47 <%text>## Examples:</%text>
48 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
48 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
49 #error_email_from = paste_error@example.com
49 #error_email_from = paste_error@example.com
50
50
51 <%text>## SMTP server settings</%text>
51 <%text>## SMTP server settings</%text>
52 <%text>## Only smtp_server is mandatory. All other settings take the specified default</%text>
52 <%text>## Only smtp_server is mandatory. All other settings take the specified default</%text>
53 <%text>## values.</%text>
53 <%text>## values.</%text>
54 #smtp_server = smtp.example.com
54 #smtp_server = smtp.example.com
55 #smtp_username =
55 #smtp_username =
56 #smtp_password =
56 #smtp_password =
57 #smtp_port = 25
57 #smtp_port = 25
58 #smtp_use_tls = false
58 #smtp_use_tls = false
59 #smtp_use_ssl = false
59 #smtp_use_ssl = false
60 <%text>## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).</%text>
60 <%text>## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).</%text>
61 <%text>## If empty, use any of the authentication parameters supported by the server.</%text>
61 <%text>## If empty, use any of the authentication parameters supported by the server.</%text>
62 #smtp_auth =
62 #smtp_auth =
63
63
64 [server:main]
64 [server:main]
65 %if http_server == 'paste':
65 %if http_server == 'paste':
66 <%text>## PASTE ##</%text>
66 <%text>## PASTE ##</%text>
67 use = egg:Paste#http
67 use = egg:Paste#http
68 <%text>## nr of worker threads to spawn</%text>
68 <%text>## nr of worker threads to spawn</%text>
69 threadpool_workers = 5
69 threadpool_workers = 5
70 <%text>## max request before thread respawn</%text>
70 <%text>## max request before thread respawn</%text>
71 threadpool_max_requests = 10
71 threadpool_max_requests = 10
72 <%text>## option to use threads of process</%text>
72 <%text>## option to use threads of process</%text>
73 use_threadpool = true
73 use_threadpool = true
74
74
75 %elif http_server == 'waitress':
75 %elif http_server == 'waitress':
76 <%text>## WAITRESS ##</%text>
76 <%text>## WAITRESS ##</%text>
77 use = egg:waitress#main
77 use = egg:waitress#main
78 <%text>## number of worker threads</%text>
78 <%text>## number of worker threads</%text>
79 threads = 5
79 threads = 5
80 <%text>## MAX BODY SIZE 100GB</%text>
80 <%text>## MAX BODY SIZE 100GB</%text>
81 max_request_body_size = 107374182400
81 max_request_body_size = 107374182400
82 <%text>## use poll instead of select, fixes fd limits, may not work on old</%text>
82 <%text>## use poll instead of select, fixes fd limits, may not work on old</%text>
83 <%text>## windows systems.</%text>
83 <%text>## windows systems.</%text>
84 #asyncore_use_poll = True
84 #asyncore_use_poll = True
85
85
86 %elif http_server == 'gunicorn':
86 %elif http_server == 'gunicorn':
87 <%text>## GUNICORN ##</%text>
87 <%text>## GUNICORN ##</%text>
88 use = egg:gunicorn#main
88 use = egg:gunicorn#main
89 <%text>## number of process workers. You must set `instance_id = *` when this option</%text>
89 <%text>## number of process workers. You must set `instance_id = *` when this option</%text>
90 <%text>## is set to more than one worker</%text>
90 <%text>## is set to more than one worker</%text>
91 workers = 1
91 workers = 1
92 <%text>## process name</%text>
92 <%text>## process name</%text>
93 proc_name = kallithea
93 proc_name = kallithea
94 <%text>## type of worker class, one of sync, eventlet, gevent, tornado</%text>
94 <%text>## type of worker class, one of sync, eventlet, gevent, tornado</%text>
95 <%text>## recommended for bigger setup is using of of other than sync one</%text>
95 <%text>## recommended for bigger setup is using of of other than sync one</%text>
96 worker_class = sync
96 worker_class = sync
97 max_requests = 1000
97 max_requests = 1000
98 <%text>## ammount of time a worker can handle request before it gets killed and</%text>
98 <%text>## ammount of time a worker can handle request before it gets killed and</%text>
99 <%text>## restarted</%text>
99 <%text>## restarted</%text>
100 timeout = 3600
100 timeout = 3600
101
101
102 %elif http_server == 'uwsgi':
102 %elif http_server == 'uwsgi':
103 <%text>## UWSGI ##</%text>
103 <%text>## UWSGI ##</%text>
104 <%text>## run with uwsgi --ini-paste-logged <inifile.ini></%text>
104 <%text>## run with uwsgi --ini-paste-logged <inifile.ini></%text>
105 [uwsgi]
105 [uwsgi]
106 socket = /tmp/uwsgi.sock
106 socket = /tmp/uwsgi.sock
107 master = true
107 master = true
108 http = 127.0.0.1:5000
108 http = 127.0.0.1:5000
109
109
110 <%text>## set as deamon and redirect all output to file</%text>
110 <%text>## set as deamon and redirect all output to file</%text>
111 #daemonize = ./uwsgi_kallithea.log
111 #daemonize = ./uwsgi_kallithea.log
112
112
113 <%text>## master process PID</%text>
113 <%text>## master process PID</%text>
114 pidfile = ./uwsgi_kallithea.pid
114 pidfile = ./uwsgi_kallithea.pid
115
115
116 <%text>## stats server with workers statistics, use uwsgitop</%text>
116 <%text>## stats server with workers statistics, use uwsgitop</%text>
117 <%text>## for monitoring, `uwsgitop 127.0.0.1:1717`</%text>
117 <%text>## for monitoring, `uwsgitop 127.0.0.1:1717`</%text>
118 stats = 127.0.0.1:1717
118 stats = 127.0.0.1:1717
119 memory-report = true
119 memory-report = true
120
120
121 <%text>## log 5XX errors</%text>
121 <%text>## log 5XX errors</%text>
122 log-5xx = true
122 log-5xx = true
123
123
124 <%text>## Set the socket listen queue size.</%text>
124 <%text>## Set the socket listen queue size.</%text>
125 listen = 256
125 listen = 256
126
126
127 <%text>## Gracefully Reload workers after the specified amount of managed requests</%text>
127 <%text>## Gracefully Reload workers after the specified amount of managed requests</%text>
128 <%text>## (avoid memory leaks).</%text>
128 <%text>## (avoid memory leaks).</%text>
129 max-requests = 1000
129 max-requests = 1000
130
130
131 <%text>## enable large buffers</%text>
131 <%text>## enable large buffers</%text>
132 buffer-size = 65535
132 buffer-size = 65535
133
133
134 <%text>## socket and http timeouts ##</%text>
134 <%text>## socket and http timeouts ##</%text>
135 http-timeout = 3600
135 http-timeout = 3600
136 socket-timeout = 3600
136 socket-timeout = 3600
137
137
138 <%text>## Log requests slower than the specified number of milliseconds.</%text>
138 <%text>## Log requests slower than the specified number of milliseconds.</%text>
139 log-slow = 10
139 log-slow = 10
140
140
141 <%text>## Exit if no app can be loaded.</%text>
141 <%text>## Exit if no app can be loaded.</%text>
142 need-app = true
142 need-app = true
143
143
144 <%text>## Set lazy mode (load apps in workers instead of master).</%text>
144 <%text>## Set lazy mode (load apps in workers instead of master).</%text>
145 lazy = true
145 lazy = true
146
146
147 <%text>## scaling ##</%text>
147 <%text>## scaling ##</%text>
148 <%text>## set cheaper algorithm to use, if not set default will be used</%text>
148 <%text>## set cheaper algorithm to use, if not set default will be used</%text>
149 cheaper-algo = spare
149 cheaper-algo = spare
150
150
151 <%text>## minimum number of workers to keep at all times</%text>
151 <%text>## minimum number of workers to keep at all times</%text>
152 cheaper = 1
152 cheaper = 1
153
153
154 <%text>## number of workers to spawn at startup</%text>
154 <%text>## number of workers to spawn at startup</%text>
155 cheaper-initial = 1
155 cheaper-initial = 1
156
156
157 <%text>## maximum number of workers that can be spawned</%text>
157 <%text>## maximum number of workers that can be spawned</%text>
158 workers = 4
158 workers = 4
159
159
160 <%text>## how many workers should be spawned at a time</%text>
160 <%text>## how many workers should be spawned at a time</%text>
161 cheaper-step = 1
161 cheaper-step = 1
162
162
163 %endif
163 %endif
164 <%text>## COMMON ##</%text>
164 <%text>## COMMON ##</%text>
165 host = ${host}
165 host = ${host}
166 port = ${port}
166 port = ${port}
167
167
168 <%text>## middleware for hosting the WSGI application under a URL prefix</%text>
168 <%text>## middleware for hosting the WSGI application under a URL prefix</%text>
169 #[filter:proxy-prefix]
169 #[filter:proxy-prefix]
170 #use = egg:PasteDeploy#prefix
170 #use = egg:PasteDeploy#prefix
171 #prefix = /<your-prefix>
171 #prefix = /<your-prefix>
172
172
173 [app:main]
173 [app:main]
174 use = egg:kallithea
174 use = egg:kallithea
175 <%text>## enable proxy prefix middleware</%text>
175 <%text>## enable proxy prefix middleware</%text>
176 #filter-with = proxy-prefix
176 #filter-with = proxy-prefix
177
177
178 full_stack = true
178 full_stack = true
179 static_files = true
179 static_files = true
180 <%text>## Available Languages:</%text>
180 <%text>## Available Languages:</%text>
181 <%text>## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW</%text>
181 <%text>## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW</%text>
182 lang =
182 lang =
183 cache_dir = ${here}/data
183 cache_dir = ${here}/data
184 index_dir = ${here}/data/index
184 index_dir = ${here}/data/index
185
185
186 <%text>## perform a full repository scan on each server start, this should be</%text>
186 <%text>## perform a full repository scan on each server start, this should be</%text>
187 <%text>## set to false after first startup, to allow faster server restarts.</%text>
187 <%text>## set to false after first startup, to allow faster server restarts.</%text>
188 initial_repo_scan = false
188 initial_repo_scan = false
189
189
190 <%text>## uncomment and set this path to use archive download cache</%text>
190 <%text>## uncomment and set this path to use archive download cache</%text>
191 archive_cache_dir = ${here}/tarballcache
191 archive_cache_dir = ${here}/tarballcache
192
192
193 <%text>## change this to unique ID for security</%text>
193 <%text>## change this to unique ID for security</%text>
194 app_instance_uuid = ${uuid()}
194 app_instance_uuid = ${uuid()}
195
195
196 <%text>## cut off limit for large diffs (size in bytes)</%text>
196 <%text>## cut off limit for large diffs (size in bytes)</%text>
197 cut_off_limit = 256000
197 cut_off_limit = 256000
198
198
199 <%text>## use cache version of scm repo everywhere</%text>
199 <%text>## use cache version of scm repo everywhere</%text>
200 vcs_full_cache = true
200 vcs_full_cache = true
201
201
202 <%text>## force https in Kallithea, fixes https redirects, assumes it's always https</%text>
202 <%text>## force https in Kallithea, fixes https redirects, assumes it's always https</%text>
203 force_https = false
203 force_https = false
204
204
205 <%text>## use Strict-Transport-Security headers</%text>
205 <%text>## use Strict-Transport-Security headers</%text>
206 use_htsts = false
206 use_htsts = false
207
207
208 <%text>## number of commits stats will parse on each iteration</%text>
208 <%text>## number of commits stats will parse on each iteration</%text>
209 commit_parse_limit = 25
209 commit_parse_limit = 25
210
210
211 <%text>## path to git executable</%text>
211 <%text>## path to git executable</%text>
212 git_path = git
212 git_path = git
213
213
214 <%text>## git rev filter option, --all is the default filter, if you need to</%text>
214 <%text>## git rev filter option, --all is the default filter, if you need to</%text>
215 <%text>## hide all refs in changelog switch this to --branches --tags</%text>
215 <%text>## hide all refs in changelog switch this to --branches --tags</%text>
216 #git_rev_filter = --branches --tags
216 #git_rev_filter = --branches --tags
217
217
218 <%text>## RSS feed options</%text>
218 <%text>## RSS feed options</%text>
219 rss_cut_off_limit = 256000
219 rss_cut_off_limit = 256000
220 rss_items_per_page = 10
220 rss_items_per_page = 10
221 rss_include_diff = false
221 rss_include_diff = false
222
222
223 <%text>## options for showing and identifying changesets</%text>
223 <%text>## options for showing and identifying changesets</%text>
224 show_sha_length = 12
224 show_sha_length = 12
225 show_revision_number = false
225 show_revision_number = false
226
226
227 <%text>## gist URL alias, used to create nicer urls for gist. This should be an</%text>
227 <%text>## gist URL alias, used to create nicer urls for gist. This should be an</%text>
228 <%text>## url that does rewrites to _admin/gists/<gistid>.</%text>
228 <%text>## url that does rewrites to _admin/gists/<gistid>.</%text>
229 <%text>## example: http://gist.example.com/{gistid}. Empty means use the internal</%text>
229 <%text>## example: http://gist.example.com/{gistid}. Empty means use the internal</%text>
230 <%text>## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid></%text>
230 <%text>## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid></%text>
231 gist_alias_url =
231 gist_alias_url =
232
232
233 <%text>## white list of API enabled controllers. This allows to add list of</%text>
233 <%text>## white list of API enabled controllers. This allows to add list of</%text>
234 <%text>## controllers to which access will be enabled by api_key. eg: to enable</%text>
234 <%text>## controllers to which access will be enabled by api_key. eg: to enable</%text>
235 <%text>## api access to raw_files put `FilesController:raw`, to enable access to patches</%text>
235 <%text>## api access to raw_files put `FilesController:raw`, to enable access to patches</%text>
236 <%text>## add `ChangesetController:changeset_patch`. This list should be "," separated</%text>
236 <%text>## add `ChangesetController:changeset_patch`. This list should be "," separated</%text>
237 <%text>## Syntax is <ControllerClass>:<function>. Check debug logs for generated names</%text>
237 <%text>## Syntax is <ControllerClass>:<function>. Check debug logs for generated names</%text>
238 <%text>## Recommended settings below are commented out:</%text>
238 <%text>## Recommended settings below are commented out:</%text>
239 api_access_controllers_whitelist =
239 api_access_controllers_whitelist =
240 # ChangesetController:changeset_patch,
240 # ChangesetController:changeset_patch,
241 # ChangesetController:changeset_raw,
241 # ChangesetController:changeset_raw,
242 # FilesController:raw,
242 # FilesController:raw,
243 # FilesController:archivefile
243 # FilesController:archivefile
244
244
245 <%text>## default encoding used to convert from and to unicode</%text>
245 <%text>## default encoding used to convert from and to unicode</%text>
246 <%text>## can be also a comma seperated list of encoding in case of mixed encodings</%text>
246 <%text>## can be also a comma seperated list of encoding in case of mixed encodings</%text>
247 default_encoding = utf8
247 default_encoding = utf8
248
248
249 <%text>## issue tracker for Kallithea (leave blank to disable, absent for default)</%text>
249 <%text>## issue tracker for Kallithea (leave blank to disable, absent for default)</%text>
250 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
250 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
251
251
252 <%text>## issue tracking mapping for commits messages</%text>
252 <%text>## issue tracking mapping for commits messages</%text>
253 <%text>## comment out issue_pat, issue_server, issue_prefix to enable</%text>
253 <%text>## comment out issue_pat, issue_server, issue_prefix to enable</%text>
254
254
255 <%text>## pattern to get the issues from commit messages</%text>
255 <%text>## pattern to get the issues from commit messages</%text>
256 <%text>## default one used here is #<numbers> with a regex passive group for `#`</%text>
256 <%text>## default one used here is #<numbers> with a regex passive group for `#`</%text>
257 <%text>## {id} will be all groups matched from this pattern</%text>
257 <%text>## {id} will be all groups matched from this pattern</%text>
258
258
259 issue_pat = (?:\s*#)(\d+)
259 issue_pat = (?:\s*#)(\d+)
260
260
261 <%text>## server url to the issue, each {id} will be replaced with match</%text>
261 <%text>## server url to the issue, each {id} will be replaced with match</%text>
262 <%text>## fetched from the regex and {repo} is replaced with full repository name</%text>
262 <%text>## fetched from the regex and {repo} is replaced with full repository name</%text>
263 <%text>## including groups {repo_name} is replaced with just name of repo</%text>
263 <%text>## including groups {repo_name} is replaced with just name of repo</%text>
264
264
265 issue_server_link = https://issues.example.com/{repo}/issue/{id}
265 issue_server_link = https://issues.example.com/{repo}/issue/{id}
266
266
267 <%text>## prefix to add to link to indicate it's an url</%text>
267 <%text>## prefix to add to link to indicate it's an url</%text>
268 <%text>## #314 will be replaced by <issue_prefix><id></%text>
268 <%text>## #314 will be replaced by <issue_prefix><id></%text>
269
269
270 issue_prefix = #
270 issue_prefix = #
271
271
272 <%text>## issue_pat, issue_server_link, issue_prefix can have suffixes to specify</%text>
272 <%text>## issue_pat, issue_server_link, issue_prefix can have suffixes to specify</%text>
273 <%text>## multiple patterns, to other issues server, wiki or others</%text>
273 <%text>## multiple patterns, to other issues server, wiki or others</%text>
274 <%text>## below an example how to create a wiki pattern</%text>
274 <%text>## below an example how to create a wiki pattern</%text>
275 # wiki-some-id -> https://wiki.example.com/some-id
275 # wiki-some-id -> https://wiki.example.com/some-id
276
276
277 #issue_pat_wiki = (?:wiki-)(.+)
277 #issue_pat_wiki = (?:wiki-)(.+)
278 #issue_server_link_wiki = https://wiki.example.com/{id}
278 #issue_server_link_wiki = https://wiki.example.com/{id}
279 #issue_prefix_wiki = WIKI-
279 #issue_prefix_wiki = WIKI-
280
280
281 <%text>## alternative return HTTP header for failed authentication. Default HTTP</%text>
281 <%text>## alternative return HTTP header for failed authentication. Default HTTP</%text>
282 <%text>## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with</%text>
282 <%text>## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with</%text>
283 <%text>## handling that. Set this variable to 403 to return HTTPForbidden</%text>
283 <%text>## handling that. Set this variable to 403 to return HTTPForbidden</%text>
284 auth_ret_code =
284 auth_ret_code =
285
285
286 <%text>## locking return code. When repository is locked return this HTTP code. 2XX</%text>
286 <%text>## locking return code. When repository is locked return this HTTP code. 2XX</%text>
287 <%text>## codes don't break the transactions while 4XX codes do</%text>
287 <%text>## codes don't break the transactions while 4XX codes do</%text>
288 lock_ret_code = 423
288 lock_ret_code = 423
289
289
290 <%text>## allows to change the repository location in settings page</%text>
290 <%text>## allows to change the repository location in settings page</%text>
291 allow_repo_location_change = True
291 allow_repo_location_change = True
292
292
293 <%text>## allows to setup custom hooks in settings page</%text>
293 <%text>## allows to setup custom hooks in settings page</%text>
294 allow_custom_hooks_settings = True
294 allow_custom_hooks_settings = True
295
295
296 <%text>## extra extensions for indexing, space separated and without the leading '.'.</%text>
297 # index.extensions =
298 # gemfile
299 # lock
300
301 <%text>## extra filenames for indexing, space separated</%text>
302 # index.filenames =
303 # .dockerignore
304 # .editorconfig
305 # INSTALL
306 # CHANGELOG
307
296 <%text>####################################</%text>
308 <%text>####################################</%text>
297 <%text>### CELERY CONFIG ####</%text>
309 <%text>### CELERY CONFIG ####</%text>
298 <%text>####################################</%text>
310 <%text>####################################</%text>
299
311
300 use_celery = false
312 use_celery = false
301 broker.host = localhost
313 broker.host = localhost
302 broker.vhost = rabbitmqhost
314 broker.vhost = rabbitmqhost
303 broker.port = 5672
315 broker.port = 5672
304 broker.user = rabbitmq
316 broker.user = rabbitmq
305 broker.password = qweqwe
317 broker.password = qweqwe
306
318
307 celery.imports = kallithea.lib.celerylib.tasks
319 celery.imports = kallithea.lib.celerylib.tasks
308
320
309 celery.result.backend = amqp
321 celery.result.backend = amqp
310 celery.result.dburi = amqp://
322 celery.result.dburi = amqp://
311 celery.result.serialier = json
323 celery.result.serialier = json
312
324
313 #celery.send.task.error.emails = true
325 #celery.send.task.error.emails = true
314 #celery.amqp.task.result.expires = 18000
326 #celery.amqp.task.result.expires = 18000
315
327
316 celeryd.concurrency = 2
328 celeryd.concurrency = 2
317 #celeryd.log.file = celeryd.log
329 #celeryd.log.file = celeryd.log
318 celeryd.log.level = DEBUG
330 celeryd.log.level = DEBUG
319 celeryd.max.tasks.per.child = 1
331 celeryd.max.tasks.per.child = 1
320
332
321 <%text>## tasks will never be sent to the queue, but executed locally instead.</%text>
333 <%text>## tasks will never be sent to the queue, but executed locally instead.</%text>
322 celery.always.eager = false
334 celery.always.eager = false
323
335
324 <%text>####################################</%text>
336 <%text>####################################</%text>
325 <%text>### BEAKER CACHE ####</%text>
337 <%text>### BEAKER CACHE ####</%text>
326 <%text>####################################</%text>
338 <%text>####################################</%text>
327
339
328 beaker.cache.data_dir = ${here}/data/cache/data
340 beaker.cache.data_dir = ${here}/data/cache/data
329 beaker.cache.lock_dir = ${here}/data/cache/lock
341 beaker.cache.lock_dir = ${here}/data/cache/lock
330
342
331 beaker.cache.regions = short_term,long_term,sql_cache_short
343 beaker.cache.regions = short_term,long_term,sql_cache_short
332
344
333 beaker.cache.short_term.type = memory
345 beaker.cache.short_term.type = memory
334 beaker.cache.short_term.expire = 60
346 beaker.cache.short_term.expire = 60
335 beaker.cache.short_term.key_length = 256
347 beaker.cache.short_term.key_length = 256
336
348
337 beaker.cache.long_term.type = memory
349 beaker.cache.long_term.type = memory
338 beaker.cache.long_term.expire = 36000
350 beaker.cache.long_term.expire = 36000
339 beaker.cache.long_term.key_length = 256
351 beaker.cache.long_term.key_length = 256
340
352
341 beaker.cache.sql_cache_short.type = memory
353 beaker.cache.sql_cache_short.type = memory
342 beaker.cache.sql_cache_short.expire = 10
354 beaker.cache.sql_cache_short.expire = 10
343 beaker.cache.sql_cache_short.key_length = 256
355 beaker.cache.sql_cache_short.key_length = 256
344
356
345 <%text>####################################</%text>
357 <%text>####################################</%text>
346 <%text>### BEAKER SESSION ####</%text>
358 <%text>### BEAKER SESSION ####</%text>
347 <%text>####################################</%text>
359 <%text>####################################</%text>
348
360
349 <%text>## Name of session cookie. Should be unique for a given host and path, even when running</%text>
361 <%text>## Name of session cookie. Should be unique for a given host and path, even when running</%text>
350 <%text>## on different ports. Otherwise, cookie sessions will be shared and messed up.</%text>
362 <%text>## on different ports. Otherwise, cookie sessions will be shared and messed up.</%text>
351 beaker.session.key = kallithea
363 beaker.session.key = kallithea
352 <%text>## Sessions should always only be accessible by the browser, not directly by JavaScript.</%text>
364 <%text>## Sessions should always only be accessible by the browser, not directly by JavaScript.</%text>
353 beaker.session.httponly = true
365 beaker.session.httponly = true
354 <%text>## Session lifetime. 2592000 seconds is 30 days.</%text>
366 <%text>## Session lifetime. 2592000 seconds is 30 days.</%text>
355 beaker.session.timeout = 2592000
367 beaker.session.timeout = 2592000
356
368
357 <%text>## Server secret used with HMAC to ensure integrity of cookies.</%text>
369 <%text>## Server secret used with HMAC to ensure integrity of cookies.</%text>
358 beaker.session.secret = ${uuid()}
370 beaker.session.secret = ${uuid()}
359 <%text>## Further, encrypt the data with AES.</%text>
371 <%text>## Further, encrypt the data with AES.</%text>
360 #beaker.session.encrypt_key = <key_for_encryption>
372 #beaker.session.encrypt_key = <key_for_encryption>
361 #beaker.session.validate_key = <validation_key>
373 #beaker.session.validate_key = <validation_key>
362
374
363 <%text>## Type of storage used for the session, current types are</%text>
375 <%text>## Type of storage used for the session, current types are</%text>
364 <%text>## dbm, file, memcached, database, and memory.</%text>
376 <%text>## dbm, file, memcached, database, and memory.</%text>
365
377
366 <%text>## File system storage of session data. (default)</%text>
378 <%text>## File system storage of session data. (default)</%text>
367 #beaker.session.type = file
379 #beaker.session.type = file
368
380
369 <%text>## Cookie only, store all session data inside the cookie. Requires secure secrets.</%text>
381 <%text>## Cookie only, store all session data inside the cookie. Requires secure secrets.</%text>
370 #beaker.session.type = cookie
382 #beaker.session.type = cookie
371
383
372 <%text>## Database storage of session data.</%text>
384 <%text>## Database storage of session data.</%text>
373 #beaker.session.type = ext:database
385 #beaker.session.type = ext:database
374 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
386 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
375 #beaker.session.table_name = db_session
387 #beaker.session.table_name = db_session
376
388
377 %if error_aggregation_service == 'errormator':
389 %if error_aggregation_service == 'errormator':
378 <%text>############################</%text>
390 <%text>############################</%text>
379 <%text>## ERROR HANDLING SYSTEMS ##</%text>
391 <%text>## ERROR HANDLING SYSTEMS ##</%text>
380 <%text>############################</%text>
392 <%text>############################</%text>
381
393
382 <%text>####################</%text>
394 <%text>####################</%text>
383 <%text>### [errormator] ###</%text>
395 <%text>### [errormator] ###</%text>
384 <%text>####################</%text>
396 <%text>####################</%text>
385
397
386 <%text>## Errormator is tailored to work with Kallithea, see</%text>
398 <%text>## Errormator is tailored to work with Kallithea, see</%text>
387 <%text>## http://errormator.com for details how to obtain an account</%text>
399 <%text>## http://errormator.com for details how to obtain an account</%text>
388 <%text>## you must install python package `errormator_client` to make it work</%text>
400 <%text>## you must install python package `errormator_client` to make it work</%text>
389
401
390 <%text>## errormator enabled</%text>
402 <%text>## errormator enabled</%text>
391 errormator = false
403 errormator = false
392
404
393 errormator.server_url = https://api.errormator.com
405 errormator.server_url = https://api.errormator.com
394 errormator.api_key = YOUR_API_KEY
406 errormator.api_key = YOUR_API_KEY
395
407
396 <%text>## TWEAK AMOUNT OF INFO SENT HERE</%text>
408 <%text>## TWEAK AMOUNT OF INFO SENT HERE</%text>
397
409
398 <%text>## enables 404 error logging (default False)</%text>
410 <%text>## enables 404 error logging (default False)</%text>
399 errormator.report_404 = false
411 errormator.report_404 = false
400
412
401 <%text>## time in seconds after request is considered being slow (default 1)</%text>
413 <%text>## time in seconds after request is considered being slow (default 1)</%text>
402 errormator.slow_request_time = 1
414 errormator.slow_request_time = 1
403
415
404 <%text>## record slow requests in application</%text>
416 <%text>## record slow requests in application</%text>
405 <%text>## (needs to be enabled for slow datastore recording and time tracking)</%text>
417 <%text>## (needs to be enabled for slow datastore recording and time tracking)</%text>
406 errormator.slow_requests = true
418 errormator.slow_requests = true
407
419
408 <%text>## enable hooking to application loggers</%text>
420 <%text>## enable hooking to application loggers</%text>
409 #errormator.logging = true
421 #errormator.logging = true
410
422
411 <%text>## minimum log level for log capture</%text>
423 <%text>## minimum log level for log capture</%text>
412 #errormator.logging.level = WARNING
424 #errormator.logging.level = WARNING
413
425
414 <%text>## send logs only from erroneous/slow requests</%text>
426 <%text>## send logs only from erroneous/slow requests</%text>
415 <%text>## (saves API quota for intensive logging)</%text>
427 <%text>## (saves API quota for intensive logging)</%text>
416 errormator.logging_on_error = false
428 errormator.logging_on_error = false
417
429
418 <%text>## list of additonal keywords that should be grabbed from environ object</%text>
430 <%text>## list of additonal keywords that should be grabbed from environ object</%text>
419 <%text>## can be string with comma separated list of words in lowercase</%text>
431 <%text>## can be string with comma separated list of words in lowercase</%text>
420 <%text>## (by default client will always send following info:</%text>
432 <%text>## (by default client will always send following info:</%text>
421 <%text>## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that</%text>
433 <%text>## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that</%text>
422 <%text>## start with HTTP* this list be extended with additional keywords here</%text>
434 <%text>## start with HTTP* this list be extended with additional keywords here</%text>
423 errormator.environ_keys_whitelist =
435 errormator.environ_keys_whitelist =
424
436
425 <%text>## list of keywords that should be blanked from request object</%text>
437 <%text>## list of keywords that should be blanked from request object</%text>
426 <%text>## can be string with comma separated list of words in lowercase</%text>
438 <%text>## can be string with comma separated list of words in lowercase</%text>
427 <%text>## (by default client will always blank keys that contain following words</%text>
439 <%text>## (by default client will always blank keys that contain following words</%text>
428 <%text>## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'</%text>
440 <%text>## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'</%text>
429 <%text>## this list be extended with additional keywords set here</%text>
441 <%text>## this list be extended with additional keywords set here</%text>
430 errormator.request_keys_blacklist =
442 errormator.request_keys_blacklist =
431
443
432 <%text>## list of namespaces that should be ignores when gathering log entries</%text>
444 <%text>## list of namespaces that should be ignores when gathering log entries</%text>
433 <%text>## can be string with comma separated list of namespaces</%text>
445 <%text>## can be string with comma separated list of namespaces</%text>
434 <%text>## (by default the client ignores own entries: errormator_client.client)</%text>
446 <%text>## (by default the client ignores own entries: errormator_client.client)</%text>
435 errormator.log_namespace_blacklist =
447 errormator.log_namespace_blacklist =
436
448
437 %elif error_aggregation_service == 'sentry':
449 %elif error_aggregation_service == 'sentry':
438 <%text>################</%text>
450 <%text>################</%text>
439 <%text>### [sentry] ###</%text>
451 <%text>### [sentry] ###</%text>
440 <%text>################</%text>
452 <%text>################</%text>
441
453
442 <%text>## sentry is a alternative open source error aggregator</%text>
454 <%text>## sentry is a alternative open source error aggregator</%text>
443 <%text>## you must install python packages `sentry` and `raven` to enable</%text>
455 <%text>## you must install python packages `sentry` and `raven` to enable</%text>
444
456
445 sentry.dsn = YOUR_DNS
457 sentry.dsn = YOUR_DNS
446 sentry.servers =
458 sentry.servers =
447 sentry.name =
459 sentry.name =
448 sentry.key =
460 sentry.key =
449 sentry.public_key =
461 sentry.public_key =
450 sentry.secret_key =
462 sentry.secret_key =
451 sentry.project =
463 sentry.project =
452 sentry.site =
464 sentry.site =
453 sentry.include_paths =
465 sentry.include_paths =
454 sentry.exclude_paths =
466 sentry.exclude_paths =
455
467
456 %endif
468 %endif
457 <%text>################################################################################</%text>
469 <%text>################################################################################</%text>
458 <%text>## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##</%text>
470 <%text>## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##</%text>
459 <%text>## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##</%text>
471 <%text>## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##</%text>
460 <%text>## execute malicious code after an exception is raised. ##</%text>
472 <%text>## execute malicious code after an exception is raised. ##</%text>
461 <%text>################################################################################</%text>
473 <%text>################################################################################</%text>
462 set debug = false
474 set debug = false
463
475
464 <%text>##################################</%text>
476 <%text>##################################</%text>
465 <%text>### LOGVIEW CONFIG ###</%text>
477 <%text>### LOGVIEW CONFIG ###</%text>
466 <%text>##################################</%text>
478 <%text>##################################</%text>
467
479
468 logview.sqlalchemy = #faa
480 logview.sqlalchemy = #faa
469 logview.pylons.templating = #bfb
481 logview.pylons.templating = #bfb
470 logview.pylons.util = #eee
482 logview.pylons.util = #eee
471
483
472 <%text>#########################################################</%text>
484 <%text>#########################################################</%text>
473 <%text>### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###</%text>
485 <%text>### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###</%text>
474 <%text>#########################################################</%text>
486 <%text>#########################################################</%text>
475
487
476 %if database_engine == 'sqlite':
488 %if database_engine == 'sqlite':
477 # SQLITE [default]
489 # SQLITE [default]
478 sqlalchemy.db1.url = sqlite:///${here}/kallithea.db?timeout=60
490 sqlalchemy.db1.url = sqlite:///${here}/kallithea.db?timeout=60
479
491
480 %elif database_engine == 'postgres':
492 %elif database_engine == 'postgres':
481 # POSTGRESQL
493 # POSTGRESQL
482 sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
494 sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
483
495
484 %elif database_engine == 'mysql':
496 %elif database_engine == 'mysql':
485 # MySQL
497 # MySQL
486 sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
498 sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
487
499
488 %endif
500 %endif
489 # see sqlalchemy docs for others
501 # see sqlalchemy docs for others
490
502
491 sqlalchemy.db1.echo = false
503 sqlalchemy.db1.echo = false
492 sqlalchemy.db1.pool_recycle = 3600
504 sqlalchemy.db1.pool_recycle = 3600
493 sqlalchemy.db1.convert_unicode = true
505 sqlalchemy.db1.convert_unicode = true
494
506
495 <%text>################################</%text>
507 <%text>################################</%text>
496 <%text>### LOGGING CONFIGURATION ####</%text>
508 <%text>### LOGGING CONFIGURATION ####</%text>
497 <%text>################################</%text>
509 <%text>################################</%text>
498
510
499 [loggers]
511 [loggers]
500 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
512 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
501
513
502 [handlers]
514 [handlers]
503 keys = console, console_sql
515 keys = console, console_sql
504
516
505 [formatters]
517 [formatters]
506 keys = generic, color_formatter, color_formatter_sql
518 keys = generic, color_formatter, color_formatter_sql
507
519
508 <%text>#############</%text>
520 <%text>#############</%text>
509 <%text>## LOGGERS ##</%text>
521 <%text>## LOGGERS ##</%text>
510 <%text>#############</%text>
522 <%text>#############</%text>
511
523
512 [logger_root]
524 [logger_root]
513 level = NOTSET
525 level = NOTSET
514 handlers = console
526 handlers = console
515
527
516 [logger_routes]
528 [logger_routes]
517 level = DEBUG
529 level = DEBUG
518 handlers =
530 handlers =
519 qualname = routes.middleware
531 qualname = routes.middleware
520 <%text>## "level = DEBUG" logs the route matched and routing variables.</%text>
532 <%text>## "level = DEBUG" logs the route matched and routing variables.</%text>
521 propagate = 1
533 propagate = 1
522
534
523 [logger_beaker]
535 [logger_beaker]
524 level = DEBUG
536 level = DEBUG
525 handlers =
537 handlers =
526 qualname = beaker.container
538 qualname = beaker.container
527 propagate = 1
539 propagate = 1
528
540
529 [logger_templates]
541 [logger_templates]
530 level = INFO
542 level = INFO
531 handlers =
543 handlers =
532 qualname = pylons.templating
544 qualname = pylons.templating
533 propagate = 1
545 propagate = 1
534
546
535 [logger_kallithea]
547 [logger_kallithea]
536 level = DEBUG
548 level = DEBUG
537 handlers =
549 handlers =
538 qualname = kallithea
550 qualname = kallithea
539 propagate = 1
551 propagate = 1
540
552
541 [logger_sqlalchemy]
553 [logger_sqlalchemy]
542 level = INFO
554 level = INFO
543 handlers = console_sql
555 handlers = console_sql
544 qualname = sqlalchemy.engine
556 qualname = sqlalchemy.engine
545 propagate = 0
557 propagate = 0
546
558
547 [logger_whoosh_indexer]
559 [logger_whoosh_indexer]
548 level = DEBUG
560 level = DEBUG
549 handlers =
561 handlers =
550 qualname = whoosh_indexer
562 qualname = whoosh_indexer
551 propagate = 1
563 propagate = 1
552
564
553 <%text>##############</%text>
565 <%text>##############</%text>
554 <%text>## HANDLERS ##</%text>
566 <%text>## HANDLERS ##</%text>
555 <%text>##############</%text>
567 <%text>##############</%text>
556
568
557 [handler_console]
569 [handler_console]
558 class = StreamHandler
570 class = StreamHandler
559 args = (sys.stderr,)
571 args = (sys.stderr,)
560 level = INFO
572 level = INFO
561 formatter = generic
573 formatter = generic
562
574
563 [handler_console_sql]
575 [handler_console_sql]
564 class = StreamHandler
576 class = StreamHandler
565 args = (sys.stderr,)
577 args = (sys.stderr,)
566 level = WARN
578 level = WARN
567 formatter = generic
579 formatter = generic
568
580
569 <%text>################</%text>
581 <%text>################</%text>
570 <%text>## FORMATTERS ##</%text>
582 <%text>## FORMATTERS ##</%text>
571 <%text>################</%text>
583 <%text>################</%text>
572
584
573 [formatter_generic]
585 [formatter_generic]
574 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
586 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
575 datefmt = %Y-%m-%d %H:%M:%S
587 datefmt = %Y-%m-%d %H:%M:%S
576
588
577 [formatter_color_formatter]
589 [formatter_color_formatter]
578 class = kallithea.lib.colored_formatter.ColorFormatter
590 class = kallithea.lib.colored_formatter.ColorFormatter
579 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
591 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
580 datefmt = %Y-%m-%d %H:%M:%S
592 datefmt = %Y-%m-%d %H:%M:%S
581
593
582 [formatter_color_formatter_sql]
594 [formatter_color_formatter_sql]
583 class = kallithea.lib.colored_formatter.ColorFormatterSql
595 class = kallithea.lib.colored_formatter.ColorFormatterSql
584 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
596 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
585 datefmt = %Y-%m-%d %H:%M:%S
597 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,574 +1,586 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # Kallithea - Example config #
3 # Kallithea - Example config #
4 # #
4 # #
5 # The %(here)s variable will be replaced with the parent directory of this file#
5 # The %(here)s variable will be replaced with the parent directory of this file#
6 ################################################################################
6 ################################################################################
7 ################################################################################
7 ################################################################################
8
8
9 [DEFAULT]
9 [DEFAULT]
10 debug = true
10 debug = true
11 pdebug = false
11 pdebug = false
12
12
13 ################################################################################
13 ################################################################################
14 ## Email settings ##
14 ## Email settings ##
15 ## ##
15 ## ##
16 ## Refer to the documentation ("Email settings") for more details. ##
16 ## Refer to the documentation ("Email settings") for more details. ##
17 ## ##
17 ## ##
18 ## It is recommended to use a valid sender address that passes access ##
18 ## It is recommended to use a valid sender address that passes access ##
19 ## validation and spam filtering in mail servers. ##
19 ## validation and spam filtering in mail servers. ##
20 ################################################################################
20 ################################################################################
21
21
22 ## 'From' header for application emails. You can optionally add a name.
22 ## 'From' header for application emails. You can optionally add a name.
23 ## Default:
23 ## Default:
24 #app_email_from = Kallithea
24 #app_email_from = Kallithea
25 ## Examples:
25 ## Examples:
26 #app_email_from = Kallithea <kallithea-noreply@example.com>
26 #app_email_from = Kallithea <kallithea-noreply@example.com>
27 #app_email_from = kallithea-noreply@example.com
27 #app_email_from = kallithea-noreply@example.com
28
28
29 ## Subject prefix for application emails.
29 ## Subject prefix for application emails.
30 ## A space between this prefix and the real subject is automatically added.
30 ## A space between this prefix and the real subject is automatically added.
31 ## Default:
31 ## Default:
32 #email_prefix =
32 #email_prefix =
33 ## Example:
33 ## Example:
34 #email_prefix = [Kallithea]
34 #email_prefix = [Kallithea]
35
35
36 ## Recipients for error emails and fallback recipients of application mails.
36 ## Recipients for error emails and fallback recipients of application mails.
37 ## Multiple addresses can be specified, space-separated.
37 ## Multiple addresses can be specified, space-separated.
38 ## Only addresses are allowed, do not add any name part.
38 ## Only addresses are allowed, do not add any name part.
39 ## Default:
39 ## Default:
40 #email_to =
40 #email_to =
41 ## Examples:
41 ## Examples:
42 #email_to = admin@example.com
42 #email_to = admin@example.com
43 #email_to = admin@example.com another_admin@example.com
43 #email_to = admin@example.com another_admin@example.com
44
44
45 ## 'From' header for error emails. You can optionally add a name.
45 ## 'From' header for error emails. You can optionally add a name.
46 ## Default:
46 ## Default:
47 #error_email_from = pylons@yourapp.com
47 #error_email_from = pylons@yourapp.com
48 ## Examples:
48 ## Examples:
49 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
49 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
50 #error_email_from = paste_error@example.com
50 #error_email_from = paste_error@example.com
51
51
52 ## SMTP server settings
52 ## SMTP server settings
53 ## Only smtp_server is mandatory. All other settings take the specified default
53 ## Only smtp_server is mandatory. All other settings take the specified default
54 ## values.
54 ## values.
55 #smtp_server = smtp.example.com
55 #smtp_server = smtp.example.com
56 #smtp_username =
56 #smtp_username =
57 #smtp_password =
57 #smtp_password =
58 #smtp_port = 25
58 #smtp_port = 25
59 #smtp_use_tls = false
59 #smtp_use_tls = false
60 #smtp_use_ssl = false
60 #smtp_use_ssl = false
61 ## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).
61 ## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).
62 ## If empty, use any of the authentication parameters supported by the server.
62 ## If empty, use any of the authentication parameters supported by the server.
63 #smtp_auth =
63 #smtp_auth =
64
64
65 [server:main]
65 [server:main]
66 ## PASTE ##
66 ## PASTE ##
67 #use = egg:Paste#http
67 #use = egg:Paste#http
68 ## nr of worker threads to spawn
68 ## nr of worker threads to spawn
69 #threadpool_workers = 5
69 #threadpool_workers = 5
70 ## max request before thread respawn
70 ## max request before thread respawn
71 #threadpool_max_requests = 10
71 #threadpool_max_requests = 10
72 ## option to use threads of process
72 ## option to use threads of process
73 #use_threadpool = true
73 #use_threadpool = true
74
74
75 ## WAITRESS ##
75 ## WAITRESS ##
76 use = egg:waitress#main
76 use = egg:waitress#main
77 ## number of worker threads
77 ## number of worker threads
78 threads = 5
78 threads = 5
79 ## MAX BODY SIZE 100GB
79 ## MAX BODY SIZE 100GB
80 max_request_body_size = 107374182400
80 max_request_body_size = 107374182400
81 ## use poll instead of select, fixes fd limits, may not work on old
81 ## use poll instead of select, fixes fd limits, may not work on old
82 ## windows systems.
82 ## windows systems.
83 #asyncore_use_poll = True
83 #asyncore_use_poll = True
84
84
85 ## GUNICORN ##
85 ## GUNICORN ##
86 #use = egg:gunicorn#main
86 #use = egg:gunicorn#main
87 ## number of process workers. You must set `instance_id = *` when this option
87 ## number of process workers. You must set `instance_id = *` when this option
88 ## is set to more than one worker
88 ## is set to more than one worker
89 #workers = 1
89 #workers = 1
90 ## process name
90 ## process name
91 #proc_name = kallithea
91 #proc_name = kallithea
92 ## type of worker class, one of sync, eventlet, gevent, tornado
92 ## type of worker class, one of sync, eventlet, gevent, tornado
93 ## recommended for bigger setup is using of of other than sync one
93 ## recommended for bigger setup is using of of other than sync one
94 #worker_class = sync
94 #worker_class = sync
95 #max_requests = 1000
95 #max_requests = 1000
96 ## ammount of time a worker can handle request before it gets killed and
96 ## ammount of time a worker can handle request before it gets killed and
97 ## restarted
97 ## restarted
98 #timeout = 3600
98 #timeout = 3600
99
99
100 ## UWSGI ##
100 ## UWSGI ##
101 ## run with uwsgi --ini-paste-logged <inifile.ini>
101 ## run with uwsgi --ini-paste-logged <inifile.ini>
102 #[uwsgi]
102 #[uwsgi]
103 #socket = /tmp/uwsgi.sock
103 #socket = /tmp/uwsgi.sock
104 #master = true
104 #master = true
105 #http = 127.0.0.1:5000
105 #http = 127.0.0.1:5000
106
106
107 ## set as deamon and redirect all output to file
107 ## set as deamon and redirect all output to file
108 #daemonize = ./uwsgi_kallithea.log
108 #daemonize = ./uwsgi_kallithea.log
109
109
110 ## master process PID
110 ## master process PID
111 #pidfile = ./uwsgi_kallithea.pid
111 #pidfile = ./uwsgi_kallithea.pid
112
112
113 ## stats server with workers statistics, use uwsgitop
113 ## stats server with workers statistics, use uwsgitop
114 ## for monitoring, `uwsgitop 127.0.0.1:1717`
114 ## for monitoring, `uwsgitop 127.0.0.1:1717`
115 #stats = 127.0.0.1:1717
115 #stats = 127.0.0.1:1717
116 #memory-report = true
116 #memory-report = true
117
117
118 ## log 5XX errors
118 ## log 5XX errors
119 #log-5xx = true
119 #log-5xx = true
120
120
121 ## Set the socket listen queue size.
121 ## Set the socket listen queue size.
122 #listen = 256
122 #listen = 256
123
123
124 ## Gracefully Reload workers after the specified amount of managed requests
124 ## Gracefully Reload workers after the specified amount of managed requests
125 ## (avoid memory leaks).
125 ## (avoid memory leaks).
126 #max-requests = 1000
126 #max-requests = 1000
127
127
128 ## enable large buffers
128 ## enable large buffers
129 #buffer-size = 65535
129 #buffer-size = 65535
130
130
131 ## socket and http timeouts ##
131 ## socket and http timeouts ##
132 #http-timeout = 3600
132 #http-timeout = 3600
133 #socket-timeout = 3600
133 #socket-timeout = 3600
134
134
135 ## Log requests slower than the specified number of milliseconds.
135 ## Log requests slower than the specified number of milliseconds.
136 #log-slow = 10
136 #log-slow = 10
137
137
138 ## Exit if no app can be loaded.
138 ## Exit if no app can be loaded.
139 #need-app = true
139 #need-app = true
140
140
141 ## Set lazy mode (load apps in workers instead of master).
141 ## Set lazy mode (load apps in workers instead of master).
142 #lazy = true
142 #lazy = true
143
143
144 ## scaling ##
144 ## scaling ##
145 ## set cheaper algorithm to use, if not set default will be used
145 ## set cheaper algorithm to use, if not set default will be used
146 #cheaper-algo = spare
146 #cheaper-algo = spare
147
147
148 ## minimum number of workers to keep at all times
148 ## minimum number of workers to keep at all times
149 #cheaper = 1
149 #cheaper = 1
150
150
151 ## number of workers to spawn at startup
151 ## number of workers to spawn at startup
152 #cheaper-initial = 1
152 #cheaper-initial = 1
153
153
154 ## maximum number of workers that can be spawned
154 ## maximum number of workers that can be spawned
155 #workers = 4
155 #workers = 4
156
156
157 ## how many workers should be spawned at a time
157 ## how many workers should be spawned at a time
158 #cheaper-step = 1
158 #cheaper-step = 1
159
159
160 ## COMMON ##
160 ## COMMON ##
161 host = 127.0.0.1
161 host = 127.0.0.1
162 port = 5000
162 port = 5000
163
163
164 ## middleware for hosting the WSGI application under a URL prefix
164 ## middleware for hosting the WSGI application under a URL prefix
165 #[filter:proxy-prefix]
165 #[filter:proxy-prefix]
166 #use = egg:PasteDeploy#prefix
166 #use = egg:PasteDeploy#prefix
167 #prefix = /<your-prefix>
167 #prefix = /<your-prefix>
168
168
169 [app:main]
169 [app:main]
170 use = egg:kallithea
170 use = egg:kallithea
171 ## enable proxy prefix middleware
171 ## enable proxy prefix middleware
172 #filter-with = proxy-prefix
172 #filter-with = proxy-prefix
173
173
174 full_stack = true
174 full_stack = true
175 static_files = true
175 static_files = true
176 ## Available Languages:
176 ## Available Languages:
177 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
177 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
178 lang =
178 lang =
179 cache_dir = %(here)s/data
179 cache_dir = %(here)s/data
180 index_dir = %(here)s/data/index
180 index_dir = %(here)s/data/index
181
181
182 ## perform a full repository scan on each server start, this should be
182 ## perform a full repository scan on each server start, this should be
183 ## set to false after first startup, to allow faster server restarts.
183 ## set to false after first startup, to allow faster server restarts.
184 initial_repo_scan = false
184 initial_repo_scan = false
185
185
186 ## uncomment and set this path to use archive download cache
186 ## uncomment and set this path to use archive download cache
187 archive_cache_dir = %(here)s/tarballcache
187 archive_cache_dir = %(here)s/tarballcache
188
188
189 ## change this to unique ID for security
189 ## change this to unique ID for security
190 app_instance_uuid = ${app_instance_uuid}
190 app_instance_uuid = ${app_instance_uuid}
191
191
192 ## cut off limit for large diffs (size in bytes)
192 ## cut off limit for large diffs (size in bytes)
193 cut_off_limit = 256000
193 cut_off_limit = 256000
194
194
195 ## use cache version of scm repo everywhere
195 ## use cache version of scm repo everywhere
196 vcs_full_cache = true
196 vcs_full_cache = true
197
197
198 ## force https in Kallithea, fixes https redirects, assumes it's always https
198 ## force https in Kallithea, fixes https redirects, assumes it's always https
199 force_https = false
199 force_https = false
200
200
201 ## use Strict-Transport-Security headers
201 ## use Strict-Transport-Security headers
202 use_htsts = false
202 use_htsts = false
203
203
204 ## number of commits stats will parse on each iteration
204 ## number of commits stats will parse on each iteration
205 commit_parse_limit = 25
205 commit_parse_limit = 25
206
206
207 ## path to git executable
207 ## path to git executable
208 git_path = git
208 git_path = git
209
209
210 ## git rev filter option, --all is the default filter, if you need to
210 ## git rev filter option, --all is the default filter, if you need to
211 ## hide all refs in changelog switch this to --branches --tags
211 ## hide all refs in changelog switch this to --branches --tags
212 #git_rev_filter = --branches --tags
212 #git_rev_filter = --branches --tags
213
213
214 ## RSS feed options
214 ## RSS feed options
215 rss_cut_off_limit = 256000
215 rss_cut_off_limit = 256000
216 rss_items_per_page = 10
216 rss_items_per_page = 10
217 rss_include_diff = false
217 rss_include_diff = false
218
218
219 ## options for showing and identifying changesets
219 ## options for showing and identifying changesets
220 show_sha_length = 12
220 show_sha_length = 12
221 show_revision_number = false
221 show_revision_number = false
222
222
223 ## gist URL alias, used to create nicer urls for gist. This should be an
223 ## gist URL alias, used to create nicer urls for gist. This should be an
224 ## url that does rewrites to _admin/gists/<gistid>.
224 ## url that does rewrites to _admin/gists/<gistid>.
225 ## example: http://gist.example.com/{gistid}. Empty means use the internal
225 ## example: http://gist.example.com/{gistid}. Empty means use the internal
226 ## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid>
226 ## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid>
227 gist_alias_url =
227 gist_alias_url =
228
228
229 ## white list of API enabled controllers. This allows to add list of
229 ## white list of API enabled controllers. This allows to add list of
230 ## controllers to which access will be enabled by api_key. eg: to enable
230 ## controllers to which access will be enabled by api_key. eg: to enable
231 ## api access to raw_files put `FilesController:raw`, to enable access to patches
231 ## api access to raw_files put `FilesController:raw`, to enable access to patches
232 ## add `ChangesetController:changeset_patch`. This list should be "," separated
232 ## add `ChangesetController:changeset_patch`. This list should be "," separated
233 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
233 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
234 ## Recommended settings below are commented out:
234 ## Recommended settings below are commented out:
235 api_access_controllers_whitelist =
235 api_access_controllers_whitelist =
236 # ChangesetController:changeset_patch,
236 # ChangesetController:changeset_patch,
237 # ChangesetController:changeset_raw,
237 # ChangesetController:changeset_raw,
238 # FilesController:raw,
238 # FilesController:raw,
239 # FilesController:archivefile
239 # FilesController:archivefile
240
240
241 ## default encoding used to convert from and to unicode
241 ## default encoding used to convert from and to unicode
242 ## can be also a comma seperated list of encoding in case of mixed encodings
242 ## can be also a comma seperated list of encoding in case of mixed encodings
243 default_encoding = utf8
243 default_encoding = utf8
244
244
245 ## issue tracker for Kallithea (leave blank to disable, absent for default)
245 ## issue tracker for Kallithea (leave blank to disable, absent for default)
246 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
246 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
247
247
248 ## issue tracking mapping for commits messages
248 ## issue tracking mapping for commits messages
249 ## comment out issue_pat, issue_server, issue_prefix to enable
249 ## comment out issue_pat, issue_server, issue_prefix to enable
250
250
251 ## pattern to get the issues from commit messages
251 ## pattern to get the issues from commit messages
252 ## default one used here is #<numbers> with a regex passive group for `#`
252 ## default one used here is #<numbers> with a regex passive group for `#`
253 ## {id} will be all groups matched from this pattern
253 ## {id} will be all groups matched from this pattern
254
254
255 issue_pat = (?:\s*#)(\d+)
255 issue_pat = (?:\s*#)(\d+)
256
256
257 ## server url to the issue, each {id} will be replaced with match
257 ## server url to the issue, each {id} will be replaced with match
258 ## fetched from the regex and {repo} is replaced with full repository name
258 ## fetched from the regex and {repo} is replaced with full repository name
259 ## including groups {repo_name} is replaced with just name of repo
259 ## including groups {repo_name} is replaced with just name of repo
260
260
261 issue_server_link = https://issues.example.com/{repo}/issue/{id}
261 issue_server_link = https://issues.example.com/{repo}/issue/{id}
262
262
263 ## prefix to add to link to indicate it's an url
263 ## prefix to add to link to indicate it's an url
264 ## #314 will be replaced by <issue_prefix><id>
264 ## #314 will be replaced by <issue_prefix><id>
265
265
266 issue_prefix = #
266 issue_prefix = #
267
267
268 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
268 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
269 ## multiple patterns, to other issues server, wiki or others
269 ## multiple patterns, to other issues server, wiki or others
270 ## below an example how to create a wiki pattern
270 ## below an example how to create a wiki pattern
271 # wiki-some-id -> https://wiki.example.com/some-id
271 # wiki-some-id -> https://wiki.example.com/some-id
272
272
273 #issue_pat_wiki = (?:wiki-)(.+)
273 #issue_pat_wiki = (?:wiki-)(.+)
274 #issue_server_link_wiki = https://wiki.example.com/{id}
274 #issue_server_link_wiki = https://wiki.example.com/{id}
275 #issue_prefix_wiki = WIKI-
275 #issue_prefix_wiki = WIKI-
276
276
277 ## alternative return HTTP header for failed authentication. Default HTTP
277 ## alternative return HTTP header for failed authentication. Default HTTP
278 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
278 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
279 ## handling that. Set this variable to 403 to return HTTPForbidden
279 ## handling that. Set this variable to 403 to return HTTPForbidden
280 auth_ret_code =
280 auth_ret_code =
281
281
282 ## locking return code. When repository is locked return this HTTP code. 2XX
282 ## locking return code. When repository is locked return this HTTP code. 2XX
283 ## codes don't break the transactions while 4XX codes do
283 ## codes don't break the transactions while 4XX codes do
284 lock_ret_code = 423
284 lock_ret_code = 423
285
285
286 ## allows to change the repository location in settings page
286 ## allows to change the repository location in settings page
287 allow_repo_location_change = True
287 allow_repo_location_change = True
288
288
289 ## allows to setup custom hooks in settings page
289 ## allows to setup custom hooks in settings page
290 allow_custom_hooks_settings = True
290 allow_custom_hooks_settings = True
291
291
292 ## extra extensions for indexing, space separated and without the leading '.'.
293 # index.extensions =
294 # gemfile
295 # lock
296
297 ## extra filenames for indexing, space separated
298 # index.filenames =
299 # .dockerignore
300 # .editorconfig
301 # INSTALL
302 # CHANGELOG
303
292 ####################################
304 ####################################
293 ### CELERY CONFIG ####
305 ### CELERY CONFIG ####
294 ####################################
306 ####################################
295
307
296 use_celery = false
308 use_celery = false
297 broker.host = localhost
309 broker.host = localhost
298 broker.vhost = rabbitmqhost
310 broker.vhost = rabbitmqhost
299 broker.port = 5672
311 broker.port = 5672
300 broker.user = rabbitmq
312 broker.user = rabbitmq
301 broker.password = qweqwe
313 broker.password = qweqwe
302
314
303 celery.imports = kallithea.lib.celerylib.tasks
315 celery.imports = kallithea.lib.celerylib.tasks
304
316
305 celery.result.backend = amqp
317 celery.result.backend = amqp
306 celery.result.dburi = amqp://
318 celery.result.dburi = amqp://
307 celery.result.serialier = json
319 celery.result.serialier = json
308
320
309 #celery.send.task.error.emails = true
321 #celery.send.task.error.emails = true
310 #celery.amqp.task.result.expires = 18000
322 #celery.amqp.task.result.expires = 18000
311
323
312 celeryd.concurrency = 2
324 celeryd.concurrency = 2
313 #celeryd.log.file = celeryd.log
325 #celeryd.log.file = celeryd.log
314 celeryd.log.level = DEBUG
326 celeryd.log.level = DEBUG
315 celeryd.max.tasks.per.child = 1
327 celeryd.max.tasks.per.child = 1
316
328
317 ## tasks will never be sent to the queue, but executed locally instead.
329 ## tasks will never be sent to the queue, but executed locally instead.
318 celery.always.eager = false
330 celery.always.eager = false
319
331
320 ####################################
332 ####################################
321 ### BEAKER CACHE ####
333 ### BEAKER CACHE ####
322 ####################################
334 ####################################
323
335
324 beaker.cache.data_dir = %(here)s/data/cache/data
336 beaker.cache.data_dir = %(here)s/data/cache/data
325 beaker.cache.lock_dir = %(here)s/data/cache/lock
337 beaker.cache.lock_dir = %(here)s/data/cache/lock
326
338
327 beaker.cache.regions = short_term,long_term,sql_cache_short
339 beaker.cache.regions = short_term,long_term,sql_cache_short
328
340
329 beaker.cache.short_term.type = memory
341 beaker.cache.short_term.type = memory
330 beaker.cache.short_term.expire = 60
342 beaker.cache.short_term.expire = 60
331 beaker.cache.short_term.key_length = 256
343 beaker.cache.short_term.key_length = 256
332
344
333 beaker.cache.long_term.type = memory
345 beaker.cache.long_term.type = memory
334 beaker.cache.long_term.expire = 36000
346 beaker.cache.long_term.expire = 36000
335 beaker.cache.long_term.key_length = 256
347 beaker.cache.long_term.key_length = 256
336
348
337 beaker.cache.sql_cache_short.type = memory
349 beaker.cache.sql_cache_short.type = memory
338 beaker.cache.sql_cache_short.expire = 10
350 beaker.cache.sql_cache_short.expire = 10
339 beaker.cache.sql_cache_short.key_length = 256
351 beaker.cache.sql_cache_short.key_length = 256
340
352
341 ####################################
353 ####################################
342 ### BEAKER SESSION ####
354 ### BEAKER SESSION ####
343 ####################################
355 ####################################
344
356
345 ## Name of session cookie. Should be unique for a given host and path, even when running
357 ## Name of session cookie. Should be unique for a given host and path, even when running
346 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
358 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
347 beaker.session.key = kallithea
359 beaker.session.key = kallithea
348 ## Sessions should always only be accessible by the browser, not directly by JavaScript.
360 ## Sessions should always only be accessible by the browser, not directly by JavaScript.
349 beaker.session.httponly = true
361 beaker.session.httponly = true
350 ## Session lifetime. 2592000 seconds is 30 days.
362 ## Session lifetime. 2592000 seconds is 30 days.
351 beaker.session.timeout = 2592000
363 beaker.session.timeout = 2592000
352
364
353 ## Server secret used with HMAC to ensure integrity of cookies.
365 ## Server secret used with HMAC to ensure integrity of cookies.
354 beaker.session.secret = ${app_instance_uuid}
366 beaker.session.secret = ${app_instance_uuid}
355 ## Further, encrypt the data with AES.
367 ## Further, encrypt the data with AES.
356 #beaker.session.encrypt_key = <key_for_encryption>
368 #beaker.session.encrypt_key = <key_for_encryption>
357 #beaker.session.validate_key = <validation_key>
369 #beaker.session.validate_key = <validation_key>
358
370
359 ## Type of storage used for the session, current types are
371 ## Type of storage used for the session, current types are
360 ## dbm, file, memcached, database, and memory.
372 ## dbm, file, memcached, database, and memory.
361
373
362 ## File system storage of session data. (default)
374 ## File system storage of session data. (default)
363 #beaker.session.type = file
375 #beaker.session.type = file
364
376
365 ## Cookie only, store all session data inside the cookie. Requires secure secrets.
377 ## Cookie only, store all session data inside the cookie. Requires secure secrets.
366 #beaker.session.type = cookie
378 #beaker.session.type = cookie
367
379
368 ## Database storage of session data.
380 ## Database storage of session data.
369 #beaker.session.type = ext:database
381 #beaker.session.type = ext:database
370 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
382 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
371 #beaker.session.table_name = db_session
383 #beaker.session.table_name = db_session
372
384
373 ############################
385 ############################
374 ## ERROR HANDLING SYSTEMS ##
386 ## ERROR HANDLING SYSTEMS ##
375 ############################
387 ############################
376
388
377 ####################
389 ####################
378 ### [errormator] ###
390 ### [errormator] ###
379 ####################
391 ####################
380
392
381 ## Errormator is tailored to work with Kallithea, see
393 ## Errormator is tailored to work with Kallithea, see
382 ## http://errormator.com for details how to obtain an account
394 ## http://errormator.com for details how to obtain an account
383 ## you must install python package `errormator_client` to make it work
395 ## you must install python package `errormator_client` to make it work
384
396
385 ## errormator enabled
397 ## errormator enabled
386 errormator = false
398 errormator = false
387
399
388 errormator.server_url = https://api.errormator.com
400 errormator.server_url = https://api.errormator.com
389 errormator.api_key = YOUR_API_KEY
401 errormator.api_key = YOUR_API_KEY
390
402
391 ## TWEAK AMOUNT OF INFO SENT HERE
403 ## TWEAK AMOUNT OF INFO SENT HERE
392
404
393 ## enables 404 error logging (default False)
405 ## enables 404 error logging (default False)
394 errormator.report_404 = false
406 errormator.report_404 = false
395
407
396 ## time in seconds after request is considered being slow (default 1)
408 ## time in seconds after request is considered being slow (default 1)
397 errormator.slow_request_time = 1
409 errormator.slow_request_time = 1
398
410
399 ## record slow requests in application
411 ## record slow requests in application
400 ## (needs to be enabled for slow datastore recording and time tracking)
412 ## (needs to be enabled for slow datastore recording and time tracking)
401 errormator.slow_requests = true
413 errormator.slow_requests = true
402
414
403 ## enable hooking to application loggers
415 ## enable hooking to application loggers
404 #errormator.logging = true
416 #errormator.logging = true
405
417
406 ## minimum log level for log capture
418 ## minimum log level for log capture
407 #errormator.logging.level = WARNING
419 #errormator.logging.level = WARNING
408
420
409 ## send logs only from erroneous/slow requests
421 ## send logs only from erroneous/slow requests
410 ## (saves API quota for intensive logging)
422 ## (saves API quota for intensive logging)
411 errormator.logging_on_error = false
423 errormator.logging_on_error = false
412
424
413 ## list of additonal keywords that should be grabbed from environ object
425 ## list of additonal keywords that should be grabbed from environ object
414 ## can be string with comma separated list of words in lowercase
426 ## can be string with comma separated list of words in lowercase
415 ## (by default client will always send following info:
427 ## (by default client will always send following info:
416 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
428 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
417 ## start with HTTP* this list be extended with additional keywords here
429 ## start with HTTP* this list be extended with additional keywords here
418 errormator.environ_keys_whitelist =
430 errormator.environ_keys_whitelist =
419
431
420 ## list of keywords that should be blanked from request object
432 ## list of keywords that should be blanked from request object
421 ## can be string with comma separated list of words in lowercase
433 ## can be string with comma separated list of words in lowercase
422 ## (by default client will always blank keys that contain following words
434 ## (by default client will always blank keys that contain following words
423 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
435 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
424 ## this list be extended with additional keywords set here
436 ## this list be extended with additional keywords set here
425 errormator.request_keys_blacklist =
437 errormator.request_keys_blacklist =
426
438
427 ## list of namespaces that should be ignores when gathering log entries
439 ## list of namespaces that should be ignores when gathering log entries
428 ## can be string with comma separated list of namespaces
440 ## can be string with comma separated list of namespaces
429 ## (by default the client ignores own entries: errormator_client.client)
441 ## (by default the client ignores own entries: errormator_client.client)
430 errormator.log_namespace_blacklist =
442 errormator.log_namespace_blacklist =
431
443
432 ################
444 ################
433 ### [sentry] ###
445 ### [sentry] ###
434 ################
446 ################
435
447
436 ## sentry is a alternative open source error aggregator
448 ## sentry is a alternative open source error aggregator
437 ## you must install python packages `sentry` and `raven` to enable
449 ## you must install python packages `sentry` and `raven` to enable
438
450
439 sentry.dsn = YOUR_DNS
451 sentry.dsn = YOUR_DNS
440 sentry.servers =
452 sentry.servers =
441 sentry.name =
453 sentry.name =
442 sentry.key =
454 sentry.key =
443 sentry.public_key =
455 sentry.public_key =
444 sentry.secret_key =
456 sentry.secret_key =
445 sentry.project =
457 sentry.project =
446 sentry.site =
458 sentry.site =
447 sentry.include_paths =
459 sentry.include_paths =
448 sentry.exclude_paths =
460 sentry.exclude_paths =
449
461
450 ################################################################################
462 ################################################################################
451 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
463 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
452 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
464 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
453 ## execute malicious code after an exception is raised. ##
465 ## execute malicious code after an exception is raised. ##
454 ################################################################################
466 ################################################################################
455 set debug = false
467 set debug = false
456
468
457 ##################################
469 ##################################
458 ### LOGVIEW CONFIG ###
470 ### LOGVIEW CONFIG ###
459 ##################################
471 ##################################
460
472
461 logview.sqlalchemy = #faa
473 logview.sqlalchemy = #faa
462 logview.pylons.templating = #bfb
474 logview.pylons.templating = #bfb
463 logview.pylons.util = #eee
475 logview.pylons.util = #eee
464
476
465 #########################################################
477 #########################################################
466 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
478 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
467 #########################################################
479 #########################################################
468
480
469 # SQLITE [default]
481 # SQLITE [default]
470 sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60
482 sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60
471
483
472 # POSTGRESQL
484 # POSTGRESQL
473 #sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
485 #sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
474
486
475 # MySQL
487 # MySQL
476 #sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
488 #sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
477
489
478 # see sqlalchemy docs for others
490 # see sqlalchemy docs for others
479
491
480 sqlalchemy.db1.echo = false
492 sqlalchemy.db1.echo = false
481 sqlalchemy.db1.pool_recycle = 3600
493 sqlalchemy.db1.pool_recycle = 3600
482 sqlalchemy.db1.convert_unicode = true
494 sqlalchemy.db1.convert_unicode = true
483
495
484 ################################
496 ################################
485 ### LOGGING CONFIGURATION ####
497 ### LOGGING CONFIGURATION ####
486 ################################
498 ################################
487
499
488 [loggers]
500 [loggers]
489 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
501 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
490
502
491 [handlers]
503 [handlers]
492 keys = console, console_sql
504 keys = console, console_sql
493
505
494 [formatters]
506 [formatters]
495 keys = generic, color_formatter, color_formatter_sql
507 keys = generic, color_formatter, color_formatter_sql
496
508
497 #############
509 #############
498 ## LOGGERS ##
510 ## LOGGERS ##
499 #############
511 #############
500
512
501 [logger_root]
513 [logger_root]
502 level = NOTSET
514 level = NOTSET
503 handlers = console
515 handlers = console
504
516
505 [logger_routes]
517 [logger_routes]
506 level = DEBUG
518 level = DEBUG
507 handlers =
519 handlers =
508 qualname = routes.middleware
520 qualname = routes.middleware
509 ## "level = DEBUG" logs the route matched and routing variables.
521 ## "level = DEBUG" logs the route matched and routing variables.
510 propagate = 1
522 propagate = 1
511
523
512 [logger_beaker]
524 [logger_beaker]
513 level = DEBUG
525 level = DEBUG
514 handlers =
526 handlers =
515 qualname = beaker.container
527 qualname = beaker.container
516 propagate = 1
528 propagate = 1
517
529
518 [logger_templates]
530 [logger_templates]
519 level = INFO
531 level = INFO
520 handlers =
532 handlers =
521 qualname = pylons.templating
533 qualname = pylons.templating
522 propagate = 1
534 propagate = 1
523
535
524 [logger_kallithea]
536 [logger_kallithea]
525 level = DEBUG
537 level = DEBUG
526 handlers =
538 handlers =
527 qualname = kallithea
539 qualname = kallithea
528 propagate = 1
540 propagate = 1
529
541
530 [logger_sqlalchemy]
542 [logger_sqlalchemy]
531 level = INFO
543 level = INFO
532 handlers = console_sql
544 handlers = console_sql
533 qualname = sqlalchemy.engine
545 qualname = sqlalchemy.engine
534 propagate = 0
546 propagate = 0
535
547
536 [logger_whoosh_indexer]
548 [logger_whoosh_indexer]
537 level = DEBUG
549 level = DEBUG
538 handlers =
550 handlers =
539 qualname = whoosh_indexer
551 qualname = whoosh_indexer
540 propagate = 1
552 propagate = 1
541
553
542 ##############
554 ##############
543 ## HANDLERS ##
555 ## HANDLERS ##
544 ##############
556 ##############
545
557
546 [handler_console]
558 [handler_console]
547 class = StreamHandler
559 class = StreamHandler
548 args = (sys.stderr,)
560 args = (sys.stderr,)
549 level = INFO
561 level = INFO
550 formatter = generic
562 formatter = generic
551
563
552 [handler_console_sql]
564 [handler_console_sql]
553 class = StreamHandler
565 class = StreamHandler
554 args = (sys.stderr,)
566 args = (sys.stderr,)
555 level = WARN
567 level = WARN
556 formatter = generic
568 formatter = generic
557
569
558 ################
570 ################
559 ## FORMATTERS ##
571 ## FORMATTERS ##
560 ################
572 ################
561
573
562 [formatter_generic]
574 [formatter_generic]
563 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
575 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
564 datefmt = %Y-%m-%d %H:%M:%S
576 datefmt = %Y-%m-%d %H:%M:%S
565
577
566 [formatter_color_formatter]
578 [formatter_color_formatter]
567 class = kallithea.lib.colored_formatter.ColorFormatter
579 class = kallithea.lib.colored_formatter.ColorFormatter
568 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
580 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
569 datefmt = %Y-%m-%d %H:%M:%S
581 datefmt = %Y-%m-%d %H:%M:%S
570
582
571 [formatter_color_formatter_sql]
583 [formatter_color_formatter_sql]
572 class = kallithea.lib.colored_formatter.ColorFormatterSql
584 class = kallithea.lib.colored_formatter.ColorFormatterSql
573 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
585 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
574 datefmt = %Y-%m-%d %H:%M:%S
586 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,140 +1,141 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 # This program is free software: you can redistribute it and/or modify
2 # This program is free software: you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License as published by
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation, either version 3 of the License, or
4 # the Free Software Foundation, either version 3 of the License, or
5 # (at your option) any later version.
5 # (at your option) any later version.
6 #
6 #
7 # This program is distributed in the hope that it will be useful,
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
10 # GNU General Public License for more details.
11 #
11 #
12 # You should have received a copy of the GNU General Public License
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """
14 """
15 Pylons environment configuration
15 Pylons environment configuration
16 """
16 """
17
17
18 import os
18 import os
19 import logging
19 import logging
20 import kallithea
20 import kallithea
21 import platform
21 import platform
22
22
23 import pylons
23 import pylons
24 import mako.lookup
24 import mako.lookup
25 import beaker
25 import beaker
26
26
27 # don't remove this import it does magic for celery
27 # don't remove this import it does magic for celery
28 from kallithea.lib import celerypylons
28 from kallithea.lib import celerypylons
29
29
30 import kallithea.lib.app_globals as app_globals
30 import kallithea.lib.app_globals as app_globals
31
31
32 from kallithea.config.routing import make_map
32 from kallithea.config.routing import make_map
33
33
34 from kallithea.lib import helpers
34 from kallithea.lib import helpers
35 from kallithea.lib.auth import set_available_permissions
35 from kallithea.lib.auth import set_available_permissions
36 from kallithea.lib.utils import repo2db_mapper, make_ui, set_app_settings,\
36 from kallithea.lib.utils import repo2db_mapper, make_ui, set_app_settings,\
37 load_rcextensions, check_git_version, set_vcs_config
37 load_rcextensions, check_git_version, set_vcs_config, set_indexer_config
38 from kallithea.lib.utils2 import engine_from_config, str2bool
38 from kallithea.lib.utils2 import engine_from_config, str2bool
39 from kallithea.lib.db_manage import DbManage
39 from kallithea.lib.db_manage import DbManage
40 from kallithea.model import init_model
40 from kallithea.model import init_model
41 from kallithea.model.scm import ScmModel
41 from kallithea.model.scm import ScmModel
42
42
43 log = logging.getLogger(__name__)
43 log = logging.getLogger(__name__)
44
44
45
45
46 def load_environment(global_conf, app_conf, initial=False,
46 def load_environment(global_conf, app_conf, initial=False,
47 test_env=None, test_index=None):
47 test_env=None, test_index=None):
48 """
48 """
49 Configure the Pylons environment via the ``pylons.config``
49 Configure the Pylons environment via the ``pylons.config``
50 object
50 object
51 """
51 """
52 config = pylons.configuration.PylonsConfig()
52 config = pylons.configuration.PylonsConfig()
53
53
54 # Pylons paths
54 # Pylons paths
55 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
55 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
56 paths = dict(
56 paths = dict(
57 root=root,
57 root=root,
58 controllers=os.path.join(root, 'controllers'),
58 controllers=os.path.join(root, 'controllers'),
59 static_files=os.path.join(root, 'public'),
59 static_files=os.path.join(root, 'public'),
60 templates=[os.path.join(root, 'templates')]
60 templates=[os.path.join(root, 'templates')]
61 )
61 )
62
62
63 # Initialize config with the basic options
63 # Initialize config with the basic options
64 config.init_app(global_conf, app_conf, package='kallithea', paths=paths)
64 config.init_app(global_conf, app_conf, package='kallithea', paths=paths)
65
65
66 # store some globals into kallithea
66 # store some globals into kallithea
67 kallithea.CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
67 kallithea.CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
68 kallithea.CELERY_EAGER = str2bool(config['app_conf'].get('celery.always.eager'))
68 kallithea.CELERY_EAGER = str2bool(config['app_conf'].get('celery.always.eager'))
69
69
70 config['routes.map'] = make_map(config)
70 config['routes.map'] = make_map(config)
71 config['pylons.app_globals'] = app_globals.Globals(config)
71 config['pylons.app_globals'] = app_globals.Globals(config)
72 config['pylons.h'] = helpers
72 config['pylons.h'] = helpers
73 kallithea.CONFIG = config
73 kallithea.CONFIG = config
74
74
75 load_rcextensions(root_path=config['here'])
75 load_rcextensions(root_path=config['here'])
76
76
77 # Setup cache object as early as possible
77 # Setup cache object as early as possible
78 pylons.cache._push_object(config['pylons.app_globals'].cache)
78 pylons.cache._push_object(config['pylons.app_globals'].cache)
79
79
80 # Create the Mako TemplateLookup, with the default auto-escaping
80 # Create the Mako TemplateLookup, with the default auto-escaping
81 config['pylons.app_globals'].mako_lookup = mako.lookup.TemplateLookup(
81 config['pylons.app_globals'].mako_lookup = mako.lookup.TemplateLookup(
82 directories=paths['templates'],
82 directories=paths['templates'],
83 error_handler=pylons.error.handle_mako_error,
83 error_handler=pylons.error.handle_mako_error,
84 module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
84 module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
85 input_encoding='utf-8', default_filters=['escape'],
85 input_encoding='utf-8', default_filters=['escape'],
86 imports=['from webhelpers.html import escape'])
86 imports=['from webhelpers.html import escape'])
87
87
88 # sets the c attribute access when don't existing attribute are accessed
88 # sets the c attribute access when don't existing attribute are accessed
89 config['pylons.strict_tmpl_context'] = True
89 config['pylons.strict_tmpl_context'] = True
90 test = os.path.split(config['__file__'])[-1] == 'test.ini'
90 test = os.path.split(config['__file__'])[-1] == 'test.ini'
91 if test:
91 if test:
92 if test_env is None:
92 if test_env is None:
93 test_env = not int(os.environ.get('KALLITHEA_NO_TMP_PATH', 0))
93 test_env = not int(os.environ.get('KALLITHEA_NO_TMP_PATH', 0))
94 if test_index is None:
94 if test_index is None:
95 test_index = not int(os.environ.get('KALLITHEA_WHOOSH_TEST_DISABLE', 0))
95 test_index = not int(os.environ.get('KALLITHEA_WHOOSH_TEST_DISABLE', 0))
96 if os.environ.get('TEST_DB'):
96 if os.environ.get('TEST_DB'):
97 # swap config if we pass enviroment variable
97 # swap config if we pass enviroment variable
98 config['sqlalchemy.db1.url'] = os.environ.get('TEST_DB')
98 config['sqlalchemy.db1.url'] = os.environ.get('TEST_DB')
99
99
100 from kallithea.lib.utils import create_test_env, create_test_index
100 from kallithea.lib.utils import create_test_env, create_test_index
101 from kallithea.tests import TESTS_TMP_PATH
101 from kallithea.tests import TESTS_TMP_PATH
102 #set KALLITHEA_NO_TMP_PATH=1 to disable re-creating the database and
102 #set KALLITHEA_NO_TMP_PATH=1 to disable re-creating the database and
103 #test repos
103 #test repos
104 if test_env:
104 if test_env:
105 create_test_env(TESTS_TMP_PATH, config)
105 create_test_env(TESTS_TMP_PATH, config)
106 #set KALLITHEA_WHOOSH_TEST_DISABLE=1 to disable whoosh index during tests
106 #set KALLITHEA_WHOOSH_TEST_DISABLE=1 to disable whoosh index during tests
107 if test_index:
107 if test_index:
108 create_test_index(TESTS_TMP_PATH, config, True)
108 create_test_index(TESTS_TMP_PATH, config, True)
109
109
110 DbManage.check_waitress()
110 DbManage.check_waitress()
111 # MULTIPLE DB configs
111 # MULTIPLE DB configs
112 # Setup the SQLAlchemy database engine
112 # Setup the SQLAlchemy database engine
113 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')
113 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')
114 init_model(sa_engine_db1)
114 init_model(sa_engine_db1)
115
115
116 set_available_permissions(config)
116 set_available_permissions(config)
117 repos_path = make_ui('db').configitems('paths')[0][1]
117 repos_path = make_ui('db').configitems('paths')[0][1]
118 config['base_path'] = repos_path
118 config['base_path'] = repos_path
119 set_app_settings(config)
119 set_app_settings(config)
120
120
121 instance_id = kallithea.CONFIG.get('instance_id', '*')
121 instance_id = kallithea.CONFIG.get('instance_id', '*')
122 if instance_id == '*':
122 if instance_id == '*':
123 instance_id = '%s-%s' % (platform.uname()[1], os.getpid())
123 instance_id = '%s-%s' % (platform.uname()[1], os.getpid())
124 kallithea.CONFIG['instance_id'] = instance_id
124 kallithea.CONFIG['instance_id'] = instance_id
125
125
126 # CONFIGURATION OPTIONS HERE (note: all config options will override
126 # CONFIGURATION OPTIONS HERE (note: all config options will override
127 # any Pylons config options)
127 # any Pylons config options)
128
128
129 # store config reference into our module to skip import magic of
129 # store config reference into our module to skip import magic of
130 # pylons
130 # pylons
131 kallithea.CONFIG.update(config)
131 kallithea.CONFIG.update(config)
132 set_vcs_config(kallithea.CONFIG)
132 set_vcs_config(kallithea.CONFIG)
133 set_indexer_config(kallithea.CONFIG)
133
134
134 #check git version
135 #check git version
135 check_git_version()
136 check_git_version()
136
137
137 if str2bool(config.get('initial_repo_scan', True)):
138 if str2bool(config.get('initial_repo_scan', True)):
138 repo2db_mapper(ScmModel().repo_scan(repos_path),
139 repo2db_mapper(ScmModel().repo_scan(repos_path),
139 remove_obsolete=False, install_git_hooks=False)
140 remove_obsolete=False, install_git_hooks=False)
140 return config
141 return config
@@ -1,871 +1,886 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 # This program is free software: you can redistribute it and/or modify
2 # This program is free software: you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License as published by
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation, either version 3 of the License, or
4 # the Free Software Foundation, either version 3 of the License, or
5 # (at your option) any later version.
5 # (at your option) any later version.
6 #
6 #
7 # This program is distributed in the hope that it will be useful,
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
10 # GNU General Public License for more details.
11 #
11 #
12 # You should have received a copy of the GNU General Public License
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 """
14 """
15 kallithea.lib.utils
15 kallithea.lib.utils
16 ~~~~~~~~~~~~~~~~~~~
16 ~~~~~~~~~~~~~~~~~~~
17
17
18 Utilities library for Kallithea
18 Utilities library for Kallithea
19
19
20 This file was forked by the Kallithea project in July 2014.
20 This file was forked by the Kallithea project in July 2014.
21 Original author and date, and relevant copyright and licensing information is below:
21 Original author and date, and relevant copyright and licensing information is below:
22 :created_on: Apr 18, 2010
22 :created_on: Apr 18, 2010
23 :author: marcink
23 :author: marcink
24 :copyright: (c) 2013 RhodeCode GmbH, and others.
24 :copyright: (c) 2013 RhodeCode GmbH, and others.
25 :license: GPLv3, see LICENSE.md for more details.
25 :license: GPLv3, see LICENSE.md for more details.
26 """
26 """
27
27
28 import os
28 import os
29 import re
29 import re
30 import logging
30 import logging
31 import datetime
31 import datetime
32 import traceback
32 import traceback
33 import paste
33 import paste
34 import beaker
34 import beaker
35 import tarfile
35 import tarfile
36 import shutil
36 import shutil
37 import decorator
37 import decorator
38 import warnings
38 import warnings
39 from os.path import abspath
39 from os.path import abspath
40 from os.path import dirname as dn, join as jn
40 from os.path import dirname as dn, join as jn
41
41
42 from paste.script.command import Command, BadCommand
42 from paste.script.command import Command, BadCommand
43
43
44 from webhelpers.text import collapse, remove_formatting, strip_tags
44 from webhelpers.text import collapse, remove_formatting, strip_tags
45 from beaker.cache import _cache_decorate
45 from beaker.cache import _cache_decorate
46
46
47 from kallithea import BRAND
47 from kallithea import BRAND
48
48
49 from kallithea.lib.vcs.utils.hgcompat import ui, config
49 from kallithea.lib.vcs.utils.hgcompat import ui, config
50 from kallithea.lib.vcs.utils.helpers import get_scm
50 from kallithea.lib.vcs.utils.helpers import get_scm
51 from kallithea.lib.vcs.exceptions import VCSError
51 from kallithea.lib.vcs.exceptions import VCSError
52
52
53 from kallithea.model import meta
53 from kallithea.model import meta
54 from kallithea.model.db import Repository, User, Ui, \
54 from kallithea.model.db import Repository, User, Ui, \
55 UserLog, RepoGroup, Setting, UserGroup
55 UserLog, RepoGroup, Setting, UserGroup
56 from kallithea.model.meta import Session
56 from kallithea.model.meta import Session
57 from kallithea.model.repo_group import RepoGroupModel
57 from kallithea.model.repo_group import RepoGroupModel
58 from kallithea.lib.utils2 import safe_str, safe_unicode, get_current_authuser
58 from kallithea.lib.utils2 import safe_str, safe_unicode, get_current_authuser
59 from kallithea.lib.vcs.utils.fakemod import create_module
59 from kallithea.lib.vcs.utils.fakemod import create_module
60
60
61 log = logging.getLogger(__name__)
61 log = logging.getLogger(__name__)
62
62
63 REMOVED_REPO_PAT = re.compile(r'rm__\d{8}_\d{6}_\d{6}_.*')
63 REMOVED_REPO_PAT = re.compile(r'rm__\d{8}_\d{6}_\d{6}_.*')
64
64
65
65
66 def recursive_replace(str_, replace=' '):
66 def recursive_replace(str_, replace=' '):
67 """
67 """
68 Recursive replace of given sign to just one instance
68 Recursive replace of given sign to just one instance
69
69
70 :param str_: given string
70 :param str_: given string
71 :param replace: char to find and replace multiple instances
71 :param replace: char to find and replace multiple instances
72
72
73 Examples::
73 Examples::
74 >>> recursive_replace("Mighty---Mighty-Bo--sstones",'-')
74 >>> recursive_replace("Mighty---Mighty-Bo--sstones",'-')
75 'Mighty-Mighty-Bo-sstones'
75 'Mighty-Mighty-Bo-sstones'
76 """
76 """
77
77
78 if str_.find(replace * 2) == -1:
78 if str_.find(replace * 2) == -1:
79 return str_
79 return str_
80 else:
80 else:
81 str_ = str_.replace(replace * 2, replace)
81 str_ = str_.replace(replace * 2, replace)
82 return recursive_replace(str_, replace)
82 return recursive_replace(str_, replace)
83
83
84
84
85 def repo_name_slug(value):
85 def repo_name_slug(value):
86 """
86 """
87 Return slug of name of repository
87 Return slug of name of repository
88 This function is called on each creation/modification
88 This function is called on each creation/modification
89 of repository to prevent bad names in repo
89 of repository to prevent bad names in repo
90 """
90 """
91
91
92 slug = remove_formatting(value)
92 slug = remove_formatting(value)
93 slug = strip_tags(slug)
93 slug = strip_tags(slug)
94
94
95 for c in """`?=[]\;'"<>,/~!@#$%^&*()+{}|: """:
95 for c in """`?=[]\;'"<>,/~!@#$%^&*()+{}|: """:
96 slug = slug.replace(c, '-')
96 slug = slug.replace(c, '-')
97 slug = recursive_replace(slug, '-')
97 slug = recursive_replace(slug, '-')
98 slug = collapse(slug, '-')
98 slug = collapse(slug, '-')
99 return slug
99 return slug
100
100
101
101
102 #==============================================================================
102 #==============================================================================
103 # PERM DECORATOR HELPERS FOR EXTRACTING NAMES FOR PERM CHECKS
103 # PERM DECORATOR HELPERS FOR EXTRACTING NAMES FOR PERM CHECKS
104 #==============================================================================
104 #==============================================================================
105 def get_repo_slug(request):
105 def get_repo_slug(request):
106 _repo = request.environ['pylons.routes_dict'].get('repo_name')
106 _repo = request.environ['pylons.routes_dict'].get('repo_name')
107 if _repo:
107 if _repo:
108 _repo = _repo.rstrip('/')
108 _repo = _repo.rstrip('/')
109 return _repo
109 return _repo
110
110
111
111
112 def get_repo_group_slug(request):
112 def get_repo_group_slug(request):
113 _group = request.environ['pylons.routes_dict'].get('group_name')
113 _group = request.environ['pylons.routes_dict'].get('group_name')
114 if _group:
114 if _group:
115 _group = _group.rstrip('/')
115 _group = _group.rstrip('/')
116 return _group
116 return _group
117
117
118
118
119 def get_user_group_slug(request):
119 def get_user_group_slug(request):
120 _group = request.environ['pylons.routes_dict'].get('id')
120 _group = request.environ['pylons.routes_dict'].get('id')
121 _group = UserGroup.get(_group)
121 _group = UserGroup.get(_group)
122 if _group:
122 if _group:
123 return _group.users_group_name
123 return _group.users_group_name
124 return None
124 return None
125
125
126
126
127 def _extract_id_from_repo_name(repo_name):
127 def _extract_id_from_repo_name(repo_name):
128 if repo_name.startswith('/'):
128 if repo_name.startswith('/'):
129 repo_name = repo_name.lstrip('/')
129 repo_name = repo_name.lstrip('/')
130 by_id_match = re.match(r'^_(\d{1,})', repo_name)
130 by_id_match = re.match(r'^_(\d{1,})', repo_name)
131 if by_id_match:
131 if by_id_match:
132 return by_id_match.groups()[0]
132 return by_id_match.groups()[0]
133
133
134
134
135 def get_repo_by_id(repo_name):
135 def get_repo_by_id(repo_name):
136 """
136 """
137 Extracts repo_name by id from special urls. Example url is _11/repo_name
137 Extracts repo_name by id from special urls. Example url is _11/repo_name
138
138
139 :param repo_name:
139 :param repo_name:
140 :return: repo_name if matched else None
140 :return: repo_name if matched else None
141 """
141 """
142 _repo_id = _extract_id_from_repo_name(repo_name)
142 _repo_id = _extract_id_from_repo_name(repo_name)
143 if _repo_id:
143 if _repo_id:
144 from kallithea.model.db import Repository
144 from kallithea.model.db import Repository
145 repo = Repository.get(_repo_id)
145 repo = Repository.get(_repo_id)
146 if repo:
146 if repo:
147 # TODO: return repo instead of reponame? or would that be a layering violation?
147 # TODO: return repo instead of reponame? or would that be a layering violation?
148 return repo.repo_name
148 return repo.repo_name
149 return None
149 return None
150
150
151
151
152 def action_logger(user, action, repo, ipaddr='', sa=None, commit=False):
152 def action_logger(user, action, repo, ipaddr='', sa=None, commit=False):
153 """
153 """
154 Action logger for various actions made by users
154 Action logger for various actions made by users
155
155
156 :param user: user that made this action, can be a unique username string or
156 :param user: user that made this action, can be a unique username string or
157 object containing user_id attribute
157 object containing user_id attribute
158 :param action: action to log, should be on of predefined unique actions for
158 :param action: action to log, should be on of predefined unique actions for
159 easy translations
159 easy translations
160 :param repo: string name of repository or object containing repo_id,
160 :param repo: string name of repository or object containing repo_id,
161 that action was made on
161 that action was made on
162 :param ipaddr: optional IP address from what the action was made
162 :param ipaddr: optional IP address from what the action was made
163 :param sa: optional sqlalchemy session
163 :param sa: optional sqlalchemy session
164
164
165 """
165 """
166
166
167 if not sa:
167 if not sa:
168 sa = meta.Session()
168 sa = meta.Session()
169 # if we don't get explicit IP address try to get one from registered user
169 # if we don't get explicit IP address try to get one from registered user
170 # in tmpl context var
170 # in tmpl context var
171 if not ipaddr:
171 if not ipaddr:
172 ipaddr = getattr(get_current_authuser(), 'ip_addr', '')
172 ipaddr = getattr(get_current_authuser(), 'ip_addr', '')
173
173
174 if getattr(user, 'user_id', None):
174 if getattr(user, 'user_id', None):
175 user_obj = User.get(user.user_id)
175 user_obj = User.get(user.user_id)
176 elif isinstance(user, basestring):
176 elif isinstance(user, basestring):
177 user_obj = User.get_by_username(user)
177 user_obj = User.get_by_username(user)
178 else:
178 else:
179 raise Exception('You have to provide a user object or a username')
179 raise Exception('You have to provide a user object or a username')
180
180
181 if getattr(repo, 'repo_id', None):
181 if getattr(repo, 'repo_id', None):
182 repo_obj = Repository.get(repo.repo_id)
182 repo_obj = Repository.get(repo.repo_id)
183 repo_name = repo_obj.repo_name
183 repo_name = repo_obj.repo_name
184 elif isinstance(repo, basestring):
184 elif isinstance(repo, basestring):
185 repo_name = repo.lstrip('/')
185 repo_name = repo.lstrip('/')
186 repo_obj = Repository.get_by_repo_name(repo_name)
186 repo_obj = Repository.get_by_repo_name(repo_name)
187 else:
187 else:
188 repo_obj = None
188 repo_obj = None
189 repo_name = ''
189 repo_name = ''
190
190
191 user_log = UserLog()
191 user_log = UserLog()
192 user_log.user_id = user_obj.user_id
192 user_log.user_id = user_obj.user_id
193 user_log.username = user_obj.username
193 user_log.username = user_obj.username
194 user_log.action = safe_unicode(action)
194 user_log.action = safe_unicode(action)
195
195
196 user_log.repository = repo_obj
196 user_log.repository = repo_obj
197 user_log.repository_name = repo_name
197 user_log.repository_name = repo_name
198
198
199 user_log.action_date = datetime.datetime.now()
199 user_log.action_date = datetime.datetime.now()
200 user_log.user_ip = ipaddr
200 user_log.user_ip = ipaddr
201 sa.add(user_log)
201 sa.add(user_log)
202
202
203 log.info('Logging action:%s on %s by user:%s ip:%s',
203 log.info('Logging action:%s on %s by user:%s ip:%s',
204 action, safe_unicode(repo), user_obj, ipaddr)
204 action, safe_unicode(repo), user_obj, ipaddr)
205 if commit:
205 if commit:
206 sa.commit()
206 sa.commit()
207
207
208
208
209 def get_filesystem_repos(path, recursive=False, skip_removed_repos=True):
209 def get_filesystem_repos(path, recursive=False, skip_removed_repos=True):
210 """
210 """
211 Scans given path for repos and return (name,(type,path)) tuple
211 Scans given path for repos and return (name,(type,path)) tuple
212
212
213 :param path: path to scan for repositories
213 :param path: path to scan for repositories
214 :param recursive: recursive search and return names with subdirs in front
214 :param recursive: recursive search and return names with subdirs in front
215 """
215 """
216
216
217 # remove ending slash for better results
217 # remove ending slash for better results
218 path = path.rstrip(os.sep)
218 path = path.rstrip(os.sep)
219 log.debug('now scanning in %s location recursive:%s...', path, recursive)
219 log.debug('now scanning in %s location recursive:%s...', path, recursive)
220
220
221 def _get_repos(p):
221 def _get_repos(p):
222 if not os.access(p, os.R_OK) or not os.access(p, os.X_OK):
222 if not os.access(p, os.R_OK) or not os.access(p, os.X_OK):
223 log.warning('ignoring repo path without access: %s', p)
223 log.warning('ignoring repo path without access: %s', p)
224 return
224 return
225 if not os.access(p, os.W_OK):
225 if not os.access(p, os.W_OK):
226 log.warning('repo path without write access: %s', p)
226 log.warning('repo path without write access: %s', p)
227 for dirpath in os.listdir(p):
227 for dirpath in os.listdir(p):
228 if os.path.isfile(os.path.join(p, dirpath)):
228 if os.path.isfile(os.path.join(p, dirpath)):
229 continue
229 continue
230 cur_path = os.path.join(p, dirpath)
230 cur_path = os.path.join(p, dirpath)
231
231
232 # skip removed repos
232 # skip removed repos
233 if skip_removed_repos and REMOVED_REPO_PAT.match(dirpath):
233 if skip_removed_repos and REMOVED_REPO_PAT.match(dirpath):
234 continue
234 continue
235
235
236 #skip .<somethin> dirs
236 #skip .<somethin> dirs
237 if dirpath.startswith('.'):
237 if dirpath.startswith('.'):
238 continue
238 continue
239
239
240 try:
240 try:
241 scm_info = get_scm(cur_path)
241 scm_info = get_scm(cur_path)
242 yield scm_info[1].split(path, 1)[-1].lstrip(os.sep), scm_info
242 yield scm_info[1].split(path, 1)[-1].lstrip(os.sep), scm_info
243 except VCSError:
243 except VCSError:
244 if not recursive:
244 if not recursive:
245 continue
245 continue
246 #check if this dir containts other repos for recursive scan
246 #check if this dir containts other repos for recursive scan
247 rec_path = os.path.join(p, dirpath)
247 rec_path = os.path.join(p, dirpath)
248 if not os.path.islink(rec_path) and os.path.isdir(rec_path):
248 if not os.path.islink(rec_path) and os.path.isdir(rec_path):
249 for inner_scm in _get_repos(rec_path):
249 for inner_scm in _get_repos(rec_path):
250 yield inner_scm
250 yield inner_scm
251
251
252 return _get_repos(path)
252 return _get_repos(path)
253
253
254
254
255 def is_valid_repo(repo_name, base_path, scm=None):
255 def is_valid_repo(repo_name, base_path, scm=None):
256 """
256 """
257 Returns True if given path is a valid repository False otherwise.
257 Returns True if given path is a valid repository False otherwise.
258 If scm param is given also compare if given scm is the same as expected
258 If scm param is given also compare if given scm is the same as expected
259 from scm parameter
259 from scm parameter
260
260
261 :param repo_name:
261 :param repo_name:
262 :param base_path:
262 :param base_path:
263 :param scm:
263 :param scm:
264
264
265 :return True: if given path is a valid repository
265 :return True: if given path is a valid repository
266 """
266 """
267 full_path = os.path.join(safe_str(base_path), safe_str(repo_name))
267 full_path = os.path.join(safe_str(base_path), safe_str(repo_name))
268
268
269 try:
269 try:
270 scm_ = get_scm(full_path)
270 scm_ = get_scm(full_path)
271 if scm:
271 if scm:
272 return scm_[0] == scm
272 return scm_[0] == scm
273 return True
273 return True
274 except VCSError:
274 except VCSError:
275 return False
275 return False
276
276
277
277
278 def is_valid_repo_group(repo_group_name, base_path, skip_path_check=False):
278 def is_valid_repo_group(repo_group_name, base_path, skip_path_check=False):
279 """
279 """
280 Returns True if given path is a repository group False otherwise
280 Returns True if given path is a repository group False otherwise
281
281
282 :param repo_name:
282 :param repo_name:
283 :param base_path:
283 :param base_path:
284 """
284 """
285 full_path = os.path.join(safe_str(base_path), safe_str(repo_group_name))
285 full_path = os.path.join(safe_str(base_path), safe_str(repo_group_name))
286
286
287 # check if it's not a repo
287 # check if it's not a repo
288 if is_valid_repo(repo_group_name, base_path):
288 if is_valid_repo(repo_group_name, base_path):
289 return False
289 return False
290
290
291 try:
291 try:
292 # we need to check bare git repos at higher level
292 # we need to check bare git repos at higher level
293 # since we might match branches/hooks/info/objects or possible
293 # since we might match branches/hooks/info/objects or possible
294 # other things inside bare git repo
294 # other things inside bare git repo
295 get_scm(os.path.dirname(full_path))
295 get_scm(os.path.dirname(full_path))
296 return False
296 return False
297 except VCSError:
297 except VCSError:
298 pass
298 pass
299
299
300 # check if it's a valid path
300 # check if it's a valid path
301 if skip_path_check or os.path.isdir(full_path):
301 if skip_path_check or os.path.isdir(full_path):
302 return True
302 return True
303
303
304 return False
304 return False
305
305
306
306
307 def ask_ok(prompt, retries=4, complaint='Yes or no please!'):
307 def ask_ok(prompt, retries=4, complaint='Yes or no please!'):
308 while True:
308 while True:
309 ok = raw_input(prompt)
309 ok = raw_input(prompt)
310 if ok in ('y', 'ye', 'yes'):
310 if ok in ('y', 'ye', 'yes'):
311 return True
311 return True
312 if ok in ('n', 'no', 'nop', 'nope'):
312 if ok in ('n', 'no', 'nop', 'nope'):
313 return False
313 return False
314 retries = retries - 1
314 retries = retries - 1
315 if retries < 0:
315 if retries < 0:
316 raise IOError
316 raise IOError
317 print complaint
317 print complaint
318
318
319 #propagated from mercurial documentation
319 #propagated from mercurial documentation
320 ui_sections = ['alias', 'auth',
320 ui_sections = ['alias', 'auth',
321 'decode/encode', 'defaults',
321 'decode/encode', 'defaults',
322 'diff', 'email',
322 'diff', 'email',
323 'extensions', 'format',
323 'extensions', 'format',
324 'merge-patterns', 'merge-tools',
324 'merge-patterns', 'merge-tools',
325 'hooks', 'http_proxy',
325 'hooks', 'http_proxy',
326 'smtp', 'patch',
326 'smtp', 'patch',
327 'paths', 'profiling',
327 'paths', 'profiling',
328 'server', 'trusted',
328 'server', 'trusted',
329 'ui', 'web', ]
329 'ui', 'web', ]
330
330
331
331
332 def make_ui(read_from='file', path=None, checkpaths=True, clear_session=True):
332 def make_ui(read_from='file', path=None, checkpaths=True, clear_session=True):
333 """
333 """
334 A function that will read python rc files or database
334 A function that will read python rc files or database
335 and make an mercurial ui object from read options
335 and make an mercurial ui object from read options
336
336
337 :param path: path to mercurial config file
337 :param path: path to mercurial config file
338 :param checkpaths: check the path
338 :param checkpaths: check the path
339 :param read_from: read from 'file' or 'db'
339 :param read_from: read from 'file' or 'db'
340 """
340 """
341
341
342 baseui = ui.ui()
342 baseui = ui.ui()
343
343
344 # clean the baseui object
344 # clean the baseui object
345 baseui._ocfg = config.config()
345 baseui._ocfg = config.config()
346 baseui._ucfg = config.config()
346 baseui._ucfg = config.config()
347 baseui._tcfg = config.config()
347 baseui._tcfg = config.config()
348
348
349 if read_from == 'file':
349 if read_from == 'file':
350 if not os.path.isfile(path):
350 if not os.path.isfile(path):
351 log.debug('hgrc file is not present at %s, skipping...', path)
351 log.debug('hgrc file is not present at %s, skipping...', path)
352 return False
352 return False
353 log.debug('reading hgrc from %s', path)
353 log.debug('reading hgrc from %s', path)
354 cfg = config.config()
354 cfg = config.config()
355 cfg.read(path)
355 cfg.read(path)
356 for section in ui_sections:
356 for section in ui_sections:
357 for k, v in cfg.items(section):
357 for k, v in cfg.items(section):
358 log.debug('settings ui from file: [%s] %s=%s', section, k, v)
358 log.debug('settings ui from file: [%s] %s=%s', section, k, v)
359 baseui.setconfig(safe_str(section), safe_str(k), safe_str(v))
359 baseui.setconfig(safe_str(section), safe_str(k), safe_str(v))
360
360
361 elif read_from == 'db':
361 elif read_from == 'db':
362 sa = meta.Session()
362 sa = meta.Session()
363 ret = sa.query(Ui).all()
363 ret = sa.query(Ui).all()
364
364
365 hg_ui = ret
365 hg_ui = ret
366 for ui_ in hg_ui:
366 for ui_ in hg_ui:
367 if ui_.ui_active:
367 if ui_.ui_active:
368 ui_val = safe_str(ui_.ui_value)
368 ui_val = safe_str(ui_.ui_value)
369 if ui_.ui_section == 'hooks' and BRAND != 'kallithea' and ui_val.startswith('python:' + BRAND + '.lib.hooks.'):
369 if ui_.ui_section == 'hooks' and BRAND != 'kallithea' and ui_val.startswith('python:' + BRAND + '.lib.hooks.'):
370 ui_val = ui_val.replace('python:' + BRAND + '.lib.hooks.', 'python:kallithea.lib.hooks.')
370 ui_val = ui_val.replace('python:' + BRAND + '.lib.hooks.', 'python:kallithea.lib.hooks.')
371 log.debug('settings ui from db: [%s] %s=%s', ui_.ui_section,
371 log.debug('settings ui from db: [%s] %s=%s', ui_.ui_section,
372 ui_.ui_key, ui_val)
372 ui_.ui_key, ui_val)
373 baseui.setconfig(safe_str(ui_.ui_section), safe_str(ui_.ui_key),
373 baseui.setconfig(safe_str(ui_.ui_section), safe_str(ui_.ui_key),
374 ui_val)
374 ui_val)
375 if ui_.ui_key == 'push_ssl':
375 if ui_.ui_key == 'push_ssl':
376 # force set push_ssl requirement to False, kallithea
376 # force set push_ssl requirement to False, kallithea
377 # handles that
377 # handles that
378 baseui.setconfig(safe_str(ui_.ui_section), safe_str(ui_.ui_key),
378 baseui.setconfig(safe_str(ui_.ui_section), safe_str(ui_.ui_key),
379 False)
379 False)
380 if clear_session:
380 if clear_session:
381 meta.Session.remove()
381 meta.Session.remove()
382
382
383 # prevent interactive questions for ssh password / passphrase
383 # prevent interactive questions for ssh password / passphrase
384 ssh = baseui.config('ui', 'ssh', default='ssh')
384 ssh = baseui.config('ui', 'ssh', default='ssh')
385 baseui.setconfig('ui', 'ssh', '%s -oBatchMode=yes -oIdentitiesOnly=yes' % ssh)
385 baseui.setconfig('ui', 'ssh', '%s -oBatchMode=yes -oIdentitiesOnly=yes' % ssh)
386
386
387 return baseui
387 return baseui
388
388
389
389
390 def set_app_settings(config):
390 def set_app_settings(config):
391 """
391 """
392 Updates pylons config with new settings from database
392 Updates pylons config with new settings from database
393
393
394 :param config:
394 :param config:
395 """
395 """
396 hgsettings = Setting.get_app_settings()
396 hgsettings = Setting.get_app_settings()
397
397
398 for k, v in hgsettings.items():
398 for k, v in hgsettings.items():
399 config[k] = v
399 config[k] = v
400
400
401
401
402 def set_vcs_config(config):
402 def set_vcs_config(config):
403 """
403 """
404 Patch VCS config with some Kallithea specific stuff
404 Patch VCS config with some Kallithea specific stuff
405
405
406 :param config: kallithea.CONFIG
406 :param config: kallithea.CONFIG
407 """
407 """
408 from kallithea.lib.vcs import conf
408 from kallithea.lib.vcs import conf
409 from kallithea.lib.utils2 import aslist
409 from kallithea.lib.utils2 import aslist
410 conf.settings.BACKENDS = {
410 conf.settings.BACKENDS = {
411 'hg': 'kallithea.lib.vcs.backends.hg.MercurialRepository',
411 'hg': 'kallithea.lib.vcs.backends.hg.MercurialRepository',
412 'git': 'kallithea.lib.vcs.backends.git.GitRepository',
412 'git': 'kallithea.lib.vcs.backends.git.GitRepository',
413 }
413 }
414
414
415 conf.settings.GIT_EXECUTABLE_PATH = config.get('git_path', 'git')
415 conf.settings.GIT_EXECUTABLE_PATH = config.get('git_path', 'git')
416 conf.settings.GIT_REV_FILTER = config.get('git_rev_filter', '--all').strip()
416 conf.settings.GIT_REV_FILTER = config.get('git_rev_filter', '--all').strip()
417 conf.settings.DEFAULT_ENCODINGS = aslist(config.get('default_encoding',
417 conf.settings.DEFAULT_ENCODINGS = aslist(config.get('default_encoding',
418 'utf8'), sep=',')
418 'utf8'), sep=',')
419
419
420
420
421 def set_indexer_config(config):
422 """
423 Update Whoosh index mapping
424
425 :param config: kallithea.CONFIG
426 """
427 from kallithea.config import conf
428
429 log.debug('adding extra into INDEX_EXTENSIONS')
430 conf.INDEX_EXTENSIONS.extend(re.split('\s+', config.get('index.extensions', '')))
431
432 log.debug('adding extra into INDEX_FILENAMES')
433 conf.INDEX_FILENAMES.extend(re.split('\s+', config.get('index.filenames', '')))
434
435
421 def map_groups(path):
436 def map_groups(path):
422 """
437 """
423 Given a full path to a repository, create all nested groups that this
438 Given a full path to a repository, create all nested groups that this
424 repo is inside. This function creates parent-child relationships between
439 repo is inside. This function creates parent-child relationships between
425 groups and creates default perms for all new groups.
440 groups and creates default perms for all new groups.
426
441
427 :param paths: full path to repository
442 :param paths: full path to repository
428 """
443 """
429 sa = meta.Session()
444 sa = meta.Session()
430 groups = path.split(Repository.url_sep())
445 groups = path.split(Repository.url_sep())
431 parent = None
446 parent = None
432 group = None
447 group = None
433
448
434 # last element is repo in nested groups structure
449 # last element is repo in nested groups structure
435 groups = groups[:-1]
450 groups = groups[:-1]
436 rgm = RepoGroupModel(sa)
451 rgm = RepoGroupModel(sa)
437 owner = User.get_first_admin()
452 owner = User.get_first_admin()
438 for lvl, group_name in enumerate(groups):
453 for lvl, group_name in enumerate(groups):
439 group_name = '/'.join(groups[:lvl] + [group_name])
454 group_name = '/'.join(groups[:lvl] + [group_name])
440 group = RepoGroup.get_by_group_name(group_name)
455 group = RepoGroup.get_by_group_name(group_name)
441 desc = '%s group' % group_name
456 desc = '%s group' % group_name
442
457
443 # skip folders that are now removed repos
458 # skip folders that are now removed repos
444 if REMOVED_REPO_PAT.match(group_name):
459 if REMOVED_REPO_PAT.match(group_name):
445 break
460 break
446
461
447 if group is None:
462 if group is None:
448 log.debug('creating group level: %s group_name: %s',
463 log.debug('creating group level: %s group_name: %s',
449 lvl, group_name)
464 lvl, group_name)
450 group = RepoGroup(group_name, parent)
465 group = RepoGroup(group_name, parent)
451 group.group_description = desc
466 group.group_description = desc
452 group.user = owner
467 group.user = owner
453 sa.add(group)
468 sa.add(group)
454 perm_obj = rgm._create_default_perms(group)
469 perm_obj = rgm._create_default_perms(group)
455 sa.add(perm_obj)
470 sa.add(perm_obj)
456 sa.flush()
471 sa.flush()
457
472
458 parent = group
473 parent = group
459 return group
474 return group
460
475
461
476
462 def repo2db_mapper(initial_repo_list, remove_obsolete=False,
477 def repo2db_mapper(initial_repo_list, remove_obsolete=False,
463 install_git_hooks=False, user=None, overwrite_git_hooks=False):
478 install_git_hooks=False, user=None, overwrite_git_hooks=False):
464 """
479 """
465 maps all repos given in initial_repo_list, non existing repositories
480 maps all repos given in initial_repo_list, non existing repositories
466 are created, if remove_obsolete is True it also check for db entries
481 are created, if remove_obsolete is True it also check for db entries
467 that are not in initial_repo_list and removes them.
482 that are not in initial_repo_list and removes them.
468
483
469 :param initial_repo_list: list of repositories found by scanning methods
484 :param initial_repo_list: list of repositories found by scanning methods
470 :param remove_obsolete: check for obsolete entries in database
485 :param remove_obsolete: check for obsolete entries in database
471 :param install_git_hooks: if this is True, also check and install git hook
486 :param install_git_hooks: if this is True, also check and install git hook
472 for a repo if missing
487 for a repo if missing
473 :param overwrite_git_hooks: if this is True, overwrite any existing git hooks
488 :param overwrite_git_hooks: if this is True, overwrite any existing git hooks
474 that may be encountered (even if user-deployed)
489 that may be encountered (even if user-deployed)
475 """
490 """
476 from kallithea.model.repo import RepoModel
491 from kallithea.model.repo import RepoModel
477 from kallithea.model.scm import ScmModel
492 from kallithea.model.scm import ScmModel
478 sa = meta.Session()
493 sa = meta.Session()
479 repo_model = RepoModel()
494 repo_model = RepoModel()
480 if user is None:
495 if user is None:
481 user = User.get_first_admin()
496 user = User.get_first_admin()
482 added = []
497 added = []
483
498
484 ##creation defaults
499 ##creation defaults
485 defs = Setting.get_default_repo_settings(strip_prefix=True)
500 defs = Setting.get_default_repo_settings(strip_prefix=True)
486 enable_statistics = defs.get('repo_enable_statistics')
501 enable_statistics = defs.get('repo_enable_statistics')
487 enable_locking = defs.get('repo_enable_locking')
502 enable_locking = defs.get('repo_enable_locking')
488 enable_downloads = defs.get('repo_enable_downloads')
503 enable_downloads = defs.get('repo_enable_downloads')
489 private = defs.get('repo_private')
504 private = defs.get('repo_private')
490
505
491 for name, repo in initial_repo_list.items():
506 for name, repo in initial_repo_list.items():
492 group = map_groups(name)
507 group = map_groups(name)
493 unicode_name = safe_unicode(name)
508 unicode_name = safe_unicode(name)
494 db_repo = repo_model.get_by_repo_name(unicode_name)
509 db_repo = repo_model.get_by_repo_name(unicode_name)
495 # found repo that is on filesystem not in Kallithea database
510 # found repo that is on filesystem not in Kallithea database
496 if not db_repo:
511 if not db_repo:
497 log.info('repository %s not found, creating now', name)
512 log.info('repository %s not found, creating now', name)
498 added.append(name)
513 added.append(name)
499 desc = (repo.description
514 desc = (repo.description
500 if repo.description != 'unknown'
515 if repo.description != 'unknown'
501 else '%s repository' % name)
516 else '%s repository' % name)
502
517
503 new_repo = repo_model._create_repo(
518 new_repo = repo_model._create_repo(
504 repo_name=name,
519 repo_name=name,
505 repo_type=repo.alias,
520 repo_type=repo.alias,
506 description=desc,
521 description=desc,
507 repo_group=getattr(group, 'group_id', None),
522 repo_group=getattr(group, 'group_id', None),
508 owner=user,
523 owner=user,
509 enable_locking=enable_locking,
524 enable_locking=enable_locking,
510 enable_downloads=enable_downloads,
525 enable_downloads=enable_downloads,
511 enable_statistics=enable_statistics,
526 enable_statistics=enable_statistics,
512 private=private,
527 private=private,
513 state=Repository.STATE_CREATED
528 state=Repository.STATE_CREATED
514 )
529 )
515 sa.commit()
530 sa.commit()
516 # we added that repo just now, and make sure it has githook
531 # we added that repo just now, and make sure it has githook
517 # installed, and updated server info
532 # installed, and updated server info
518 if new_repo.repo_type == 'git':
533 if new_repo.repo_type == 'git':
519 git_repo = new_repo.scm_instance
534 git_repo = new_repo.scm_instance
520 ScmModel().install_git_hooks(git_repo)
535 ScmModel().install_git_hooks(git_repo)
521 # update repository server-info
536 # update repository server-info
522 log.debug('Running update server info')
537 log.debug('Running update server info')
523 git_repo._update_server_info()
538 git_repo._update_server_info()
524 new_repo.update_changeset_cache()
539 new_repo.update_changeset_cache()
525 elif install_git_hooks:
540 elif install_git_hooks:
526 if db_repo.repo_type == 'git':
541 if db_repo.repo_type == 'git':
527 ScmModel().install_git_hooks(db_repo.scm_instance, force_create=overwrite_git_hooks)
542 ScmModel().install_git_hooks(db_repo.scm_instance, force_create=overwrite_git_hooks)
528
543
529 removed = []
544 removed = []
530 # remove from database those repositories that are not in the filesystem
545 # remove from database those repositories that are not in the filesystem
531 for repo in sa.query(Repository).all():
546 for repo in sa.query(Repository).all():
532 if repo.repo_name not in initial_repo_list.keys():
547 if repo.repo_name not in initial_repo_list.keys():
533 if remove_obsolete:
548 if remove_obsolete:
534 log.debug("Removing non-existing repository found in db `%s`",
549 log.debug("Removing non-existing repository found in db `%s`",
535 repo.repo_name)
550 repo.repo_name)
536 try:
551 try:
537 RepoModel(sa).delete(repo, forks='detach', fs_remove=False)
552 RepoModel(sa).delete(repo, forks='detach', fs_remove=False)
538 sa.commit()
553 sa.commit()
539 except Exception:
554 except Exception:
540 #don't hold further removals on error
555 #don't hold further removals on error
541 log.error(traceback.format_exc())
556 log.error(traceback.format_exc())
542 sa.rollback()
557 sa.rollback()
543 removed.append(repo.repo_name)
558 removed.append(repo.repo_name)
544 return added, removed
559 return added, removed
545
560
546
561
547 # set cache regions for beaker so celery can utilise it
562 # set cache regions for beaker so celery can utilise it
548 def add_cache(settings):
563 def add_cache(settings):
549 cache_settings = {'regions': None}
564 cache_settings = {'regions': None}
550 for key in settings.keys():
565 for key in settings.keys():
551 for prefix in ['beaker.cache.', 'cache.']:
566 for prefix in ['beaker.cache.', 'cache.']:
552 if key.startswith(prefix):
567 if key.startswith(prefix):
553 name = key.split(prefix)[1].strip()
568 name = key.split(prefix)[1].strip()
554 cache_settings[name] = settings[key].strip()
569 cache_settings[name] = settings[key].strip()
555 if cache_settings['regions']:
570 if cache_settings['regions']:
556 for region in cache_settings['regions'].split(','):
571 for region in cache_settings['regions'].split(','):
557 region = region.strip()
572 region = region.strip()
558 region_settings = {}
573 region_settings = {}
559 for key, value in cache_settings.items():
574 for key, value in cache_settings.items():
560 if key.startswith(region):
575 if key.startswith(region):
561 region_settings[key.split('.')[1]] = value
576 region_settings[key.split('.')[1]] = value
562 region_settings['expire'] = int(region_settings.get('expire',
577 region_settings['expire'] = int(region_settings.get('expire',
563 60))
578 60))
564 region_settings.setdefault('lock_dir',
579 region_settings.setdefault('lock_dir',
565 cache_settings.get('lock_dir'))
580 cache_settings.get('lock_dir'))
566 region_settings.setdefault('data_dir',
581 region_settings.setdefault('data_dir',
567 cache_settings.get('data_dir'))
582 cache_settings.get('data_dir'))
568
583
569 if 'type' not in region_settings:
584 if 'type' not in region_settings:
570 region_settings['type'] = cache_settings.get('type',
585 region_settings['type'] = cache_settings.get('type',
571 'memory')
586 'memory')
572 beaker.cache.cache_regions[region] = region_settings
587 beaker.cache.cache_regions[region] = region_settings
573
588
574
589
575 def load_rcextensions(root_path):
590 def load_rcextensions(root_path):
576 import kallithea
591 import kallithea
577 from kallithea.config import conf
592 from kallithea.config import conf
578
593
579 path = os.path.join(root_path, 'rcextensions', '__init__.py')
594 path = os.path.join(root_path, 'rcextensions', '__init__.py')
580 if os.path.isfile(path):
595 if os.path.isfile(path):
581 rcext = create_module('rc', path)
596 rcext = create_module('rc', path)
582 EXT = kallithea.EXTENSIONS = rcext
597 EXT = kallithea.EXTENSIONS = rcext
583 log.debug('Found rcextensions now loading %s...', rcext)
598 log.debug('Found rcextensions now loading %s...', rcext)
584
599
585 # Additional mappings that are not present in the pygments lexers
600 # Additional mappings that are not present in the pygments lexers
586 conf.LANGUAGES_EXTENSIONS_MAP.update(getattr(EXT, 'EXTRA_MAPPINGS', {}))
601 conf.LANGUAGES_EXTENSIONS_MAP.update(getattr(EXT, 'EXTRA_MAPPINGS', {}))
587
602
588 #OVERRIDE OUR EXTENSIONS FROM RC-EXTENSIONS (if present)
603 #OVERRIDE OUR EXTENSIONS FROM RC-EXTENSIONS (if present)
589
604
590 if getattr(EXT, 'INDEX_EXTENSIONS', []):
605 if getattr(EXT, 'INDEX_EXTENSIONS', []):
591 log.debug('settings custom INDEX_EXTENSIONS')
606 log.debug('settings custom INDEX_EXTENSIONS')
592 conf.INDEX_EXTENSIONS = getattr(EXT, 'INDEX_EXTENSIONS', [])
607 conf.INDEX_EXTENSIONS = getattr(EXT, 'INDEX_EXTENSIONS', [])
593
608
594 #ADDITIONAL MAPPINGS
609 #ADDITIONAL MAPPINGS
595 log.debug('adding extra into INDEX_EXTENSIONS')
610 log.debug('adding extra into INDEX_EXTENSIONS')
596 conf.INDEX_EXTENSIONS.extend(getattr(EXT, 'EXTRA_INDEX_EXTENSIONS', []))
611 conf.INDEX_EXTENSIONS.extend(getattr(EXT, 'EXTRA_INDEX_EXTENSIONS', []))
597
612
598 # auto check if the module is not missing any data, set to default if is
613 # auto check if the module is not missing any data, set to default if is
599 # this will help autoupdate new feature of rcext module
614 # this will help autoupdate new feature of rcext module
600 #from kallithea.config import rcextensions
615 #from kallithea.config import rcextensions
601 #for k in dir(rcextensions):
616 #for k in dir(rcextensions):
602 # if not k.startswith('_') and not hasattr(EXT, k):
617 # if not k.startswith('_') and not hasattr(EXT, k):
603 # setattr(EXT, k, getattr(rcextensions, k))
618 # setattr(EXT, k, getattr(rcextensions, k))
604
619
605
620
606 def get_custom_lexer(extension):
621 def get_custom_lexer(extension):
607 """
622 """
608 returns a custom lexer if it's defined in rcextensions module, or None
623 returns a custom lexer if it's defined in rcextensions module, or None
609 if there's no custom lexer defined
624 if there's no custom lexer defined
610 """
625 """
611 import kallithea
626 import kallithea
612 from pygments import lexers
627 from pygments import lexers
613 #check if we didn't define this extension as other lexer
628 #check if we didn't define this extension as other lexer
614 if kallithea.EXTENSIONS and extension in kallithea.EXTENSIONS.EXTRA_LEXERS:
629 if kallithea.EXTENSIONS and extension in kallithea.EXTENSIONS.EXTRA_LEXERS:
615 _lexer_name = kallithea.EXTENSIONS.EXTRA_LEXERS[extension]
630 _lexer_name = kallithea.EXTENSIONS.EXTRA_LEXERS[extension]
616 return lexers.get_lexer_by_name(_lexer_name)
631 return lexers.get_lexer_by_name(_lexer_name)
617
632
618
633
619 #==============================================================================
634 #==============================================================================
620 # TEST FUNCTIONS AND CREATORS
635 # TEST FUNCTIONS AND CREATORS
621 #==============================================================================
636 #==============================================================================
622 def create_test_index(repo_location, config, full_index):
637 def create_test_index(repo_location, config, full_index):
623 """
638 """
624 Makes default test index
639 Makes default test index
625
640
626 :param config: test config
641 :param config: test config
627 :param full_index:
642 :param full_index:
628 """
643 """
629
644
630 from kallithea.lib.indexers.daemon import WhooshIndexingDaemon
645 from kallithea.lib.indexers.daemon import WhooshIndexingDaemon
631 from kallithea.lib.pidlock import DaemonLock, LockHeld
646 from kallithea.lib.pidlock import DaemonLock, LockHeld
632
647
633 repo_location = repo_location
648 repo_location = repo_location
634
649
635 index_location = os.path.join(config['app_conf']['index_dir'])
650 index_location = os.path.join(config['app_conf']['index_dir'])
636 if not os.path.exists(index_location):
651 if not os.path.exists(index_location):
637 os.makedirs(index_location)
652 os.makedirs(index_location)
638
653
639 try:
654 try:
640 l = DaemonLock(file_=jn(dn(index_location), 'make_index.lock'))
655 l = DaemonLock(file_=jn(dn(index_location), 'make_index.lock'))
641 WhooshIndexingDaemon(index_location=index_location,
656 WhooshIndexingDaemon(index_location=index_location,
642 repo_location=repo_location)\
657 repo_location=repo_location)\
643 .run(full_index=full_index)
658 .run(full_index=full_index)
644 l.release()
659 l.release()
645 except LockHeld:
660 except LockHeld:
646 pass
661 pass
647
662
648
663
649 def create_test_env(repos_test_path, config):
664 def create_test_env(repos_test_path, config):
650 """
665 """
651 Makes a fresh database and
666 Makes a fresh database and
652 install test repository into tmp dir
667 install test repository into tmp dir
653 """
668 """
654 from kallithea.lib.db_manage import DbManage
669 from kallithea.lib.db_manage import DbManage
655 from kallithea.tests import HG_REPO, GIT_REPO, TESTS_TMP_PATH
670 from kallithea.tests import HG_REPO, GIT_REPO, TESTS_TMP_PATH
656
671
657 # PART ONE create db
672 # PART ONE create db
658 dbconf = config['sqlalchemy.db1.url']
673 dbconf = config['sqlalchemy.db1.url']
659 log.debug('making test db %s', dbconf)
674 log.debug('making test db %s', dbconf)
660
675
661 # create test dir if it doesn't exist
676 # create test dir if it doesn't exist
662 if not os.path.isdir(repos_test_path):
677 if not os.path.isdir(repos_test_path):
663 log.debug('Creating testdir %s', repos_test_path)
678 log.debug('Creating testdir %s', repos_test_path)
664 os.makedirs(repos_test_path)
679 os.makedirs(repos_test_path)
665
680
666 dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=config['here'],
681 dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=config['here'],
667 tests=True)
682 tests=True)
668 dbmanage.create_tables(override=True)
683 dbmanage.create_tables(override=True)
669 # for tests dynamically set new root paths based on generated content
684 # for tests dynamically set new root paths based on generated content
670 dbmanage.create_settings(dbmanage.config_prompt(repos_test_path))
685 dbmanage.create_settings(dbmanage.config_prompt(repos_test_path))
671 dbmanage.create_default_user()
686 dbmanage.create_default_user()
672 dbmanage.admin_prompt()
687 dbmanage.admin_prompt()
673 dbmanage.create_permissions()
688 dbmanage.create_permissions()
674 dbmanage.populate_default_permissions()
689 dbmanage.populate_default_permissions()
675 Session().commit()
690 Session().commit()
676 # PART TWO make test repo
691 # PART TWO make test repo
677 log.debug('making test vcs repositories')
692 log.debug('making test vcs repositories')
678
693
679 idx_path = config['app_conf']['index_dir']
694 idx_path = config['app_conf']['index_dir']
680 data_path = config['app_conf']['cache_dir']
695 data_path = config['app_conf']['cache_dir']
681
696
682 #clean index and data
697 #clean index and data
683 if idx_path and os.path.exists(idx_path):
698 if idx_path and os.path.exists(idx_path):
684 log.debug('remove %s', idx_path)
699 log.debug('remove %s', idx_path)
685 shutil.rmtree(idx_path)
700 shutil.rmtree(idx_path)
686
701
687 if data_path and os.path.exists(data_path):
702 if data_path and os.path.exists(data_path):
688 log.debug('remove %s', data_path)
703 log.debug('remove %s', data_path)
689 shutil.rmtree(data_path)
704 shutil.rmtree(data_path)
690
705
691 #CREATE DEFAULT TEST REPOS
706 #CREATE DEFAULT TEST REPOS
692 cur_dir = dn(dn(abspath(__file__)))
707 cur_dir = dn(dn(abspath(__file__)))
693 tar = tarfile.open(jn(cur_dir, 'tests', 'fixtures', "vcs_test_hg.tar.gz"))
708 tar = tarfile.open(jn(cur_dir, 'tests', 'fixtures', "vcs_test_hg.tar.gz"))
694 tar.extractall(jn(TESTS_TMP_PATH, HG_REPO))
709 tar.extractall(jn(TESTS_TMP_PATH, HG_REPO))
695 tar.close()
710 tar.close()
696
711
697 cur_dir = dn(dn(abspath(__file__)))
712 cur_dir = dn(dn(abspath(__file__)))
698 tar = tarfile.open(jn(cur_dir, 'tests', 'fixtures', "vcs_test_git.tar.gz"))
713 tar = tarfile.open(jn(cur_dir, 'tests', 'fixtures', "vcs_test_git.tar.gz"))
699 tar.extractall(jn(TESTS_TMP_PATH, GIT_REPO))
714 tar.extractall(jn(TESTS_TMP_PATH, GIT_REPO))
700 tar.close()
715 tar.close()
701
716
702 #LOAD VCS test stuff
717 #LOAD VCS test stuff
703 from kallithea.tests.vcs import setup_package
718 from kallithea.tests.vcs import setup_package
704 setup_package()
719 setup_package()
705
720
706
721
707 #==============================================================================
722 #==============================================================================
708 # PASTER COMMANDS
723 # PASTER COMMANDS
709 #==============================================================================
724 #==============================================================================
710 class BasePasterCommand(Command):
725 class BasePasterCommand(Command):
711 """
726 """
712 Abstract Base Class for paster commands.
727 Abstract Base Class for paster commands.
713
728
714 The celery commands are somewhat aggressive about loading
729 The celery commands are somewhat aggressive about loading
715 celery.conf, and since our module sets the `CELERY_LOADER`
730 celery.conf, and since our module sets the `CELERY_LOADER`
716 environment variable to our loader, we have to bootstrap a bit and
731 environment variable to our loader, we have to bootstrap a bit and
717 make sure we've had a chance to load the pylons config off of the
732 make sure we've had a chance to load the pylons config off of the
718 command line, otherwise everything fails.
733 command line, otherwise everything fails.
719 """
734 """
720 min_args = 1
735 min_args = 1
721 min_args_error = "Please provide a paster config file as an argument."
736 min_args_error = "Please provide a paster config file as an argument."
722 takes_config_file = 1
737 takes_config_file = 1
723 requires_config_file = True
738 requires_config_file = True
724
739
725 def notify_msg(self, msg, log=False):
740 def notify_msg(self, msg, log=False):
726 """Make a notification to user, additionally if logger is passed
741 """Make a notification to user, additionally if logger is passed
727 it logs this action using given logger
742 it logs this action using given logger
728
743
729 :param msg: message that will be printed to user
744 :param msg: message that will be printed to user
730 :param log: logging instance, to use to additionally log this message
745 :param log: logging instance, to use to additionally log this message
731
746
732 """
747 """
733 if log and isinstance(log, logging):
748 if log and isinstance(log, logging):
734 log(msg)
749 log(msg)
735
750
736 def run(self, args):
751 def run(self, args):
737 """
752 """
738 Overrides Command.run
753 Overrides Command.run
739
754
740 Checks for a config file argument and loads it.
755 Checks for a config file argument and loads it.
741 """
756 """
742 if len(args) < self.min_args:
757 if len(args) < self.min_args:
743 raise BadCommand(
758 raise BadCommand(
744 self.min_args_error % {'min_args': self.min_args,
759 self.min_args_error % {'min_args': self.min_args,
745 'actual_args': len(args)})
760 'actual_args': len(args)})
746
761
747 # Decrement because we're going to lob off the first argument.
762 # Decrement because we're going to lob off the first argument.
748 # @@ This is hacky
763 # @@ This is hacky
749 self.min_args -= 1
764 self.min_args -= 1
750 self.bootstrap_config(args[0])
765 self.bootstrap_config(args[0])
751 self.update_parser()
766 self.update_parser()
752 return super(BasePasterCommand, self).run(args[1:])
767 return super(BasePasterCommand, self).run(args[1:])
753
768
754 def update_parser(self):
769 def update_parser(self):
755 """
770 """
756 Abstract method. Allows for the class's parser to be updated
771 Abstract method. Allows for the class's parser to be updated
757 before the superclass's `run` method is called. Necessary to
772 before the superclass's `run` method is called. Necessary to
758 allow options/arguments to be passed through to the underlying
773 allow options/arguments to be passed through to the underlying
759 celery command.
774 celery command.
760 """
775 """
761 raise NotImplementedError("Abstract Method.")
776 raise NotImplementedError("Abstract Method.")
762
777
763 def bootstrap_config(self, conf):
778 def bootstrap_config(self, conf):
764 """
779 """
765 Loads the pylons configuration.
780 Loads the pylons configuration.
766 """
781 """
767 from pylons import config as pylonsconfig
782 from pylons import config as pylonsconfig
768
783
769 self.path_to_ini_file = os.path.realpath(conf)
784 self.path_to_ini_file = os.path.realpath(conf)
770 conf = paste.deploy.appconfig('config:' + self.path_to_ini_file)
785 conf = paste.deploy.appconfig('config:' + self.path_to_ini_file)
771 pylonsconfig.init_app(conf.global_conf, conf.local_conf)
786 pylonsconfig.init_app(conf.global_conf, conf.local_conf)
772
787
773 def _init_session(self):
788 def _init_session(self):
774 """
789 """
775 Inits SqlAlchemy Session
790 Inits SqlAlchemy Session
776 """
791 """
777 logging.config.fileConfig(self.path_to_ini_file)
792 logging.config.fileConfig(self.path_to_ini_file)
778 from pylons import config
793 from pylons import config
779 from kallithea.model import init_model
794 from kallithea.model import init_model
780 from kallithea.lib.utils2 import engine_from_config
795 from kallithea.lib.utils2 import engine_from_config
781
796
782 #get to remove repos !!
797 #get to remove repos !!
783 add_cache(config)
798 add_cache(config)
784 engine = engine_from_config(config, 'sqlalchemy.db1.')
799 engine = engine_from_config(config, 'sqlalchemy.db1.')
785 init_model(engine)
800 init_model(engine)
786
801
787
802
788 def check_git_version():
803 def check_git_version():
789 """
804 """
790 Checks what version of git is installed in system, and issues a warning
805 Checks what version of git is installed in system, and issues a warning
791 if it's too old for Kallithea to work properly.
806 if it's too old for Kallithea to work properly.
792 """
807 """
793 from kallithea import BACKENDS
808 from kallithea import BACKENDS
794 from kallithea.lib.vcs.backends.git.repository import GitRepository
809 from kallithea.lib.vcs.backends.git.repository import GitRepository
795 from kallithea.lib.vcs.conf import settings
810 from kallithea.lib.vcs.conf import settings
796 from distutils.version import StrictVersion
811 from distutils.version import StrictVersion
797
812
798 if 'git' not in BACKENDS:
813 if 'git' not in BACKENDS:
799 return None
814 return None
800
815
801 stdout, stderr = GitRepository._run_git_command(['--version'], _bare=True,
816 stdout, stderr = GitRepository._run_git_command(['--version'], _bare=True,
802 _safe=True)
817 _safe=True)
803
818
804 m = re.search("\d+.\d+.\d+", stdout)
819 m = re.search("\d+.\d+.\d+", stdout)
805 if m:
820 if m:
806 ver = StrictVersion(m.group(0))
821 ver = StrictVersion(m.group(0))
807 else:
822 else:
808 ver = StrictVersion('0.0.0')
823 ver = StrictVersion('0.0.0')
809
824
810 req_ver = StrictVersion('1.7.4')
825 req_ver = StrictVersion('1.7.4')
811
826
812 log.debug('Git executable: "%s" version %s detected: %s',
827 log.debug('Git executable: "%s" version %s detected: %s',
813 settings.GIT_EXECUTABLE_PATH, ver, stdout)
828 settings.GIT_EXECUTABLE_PATH, ver, stdout)
814 if stderr:
829 if stderr:
815 log.warning('Error detecting git version: %r', stderr)
830 log.warning('Error detecting git version: %r', stderr)
816 elif ver < req_ver:
831 elif ver < req_ver:
817 log.warning('Kallithea detected git version %s, which is too old '
832 log.warning('Kallithea detected git version %s, which is too old '
818 'for the system to function properly. '
833 'for the system to function properly. '
819 'Please upgrade to version %s or later.' % (ver, req_ver))
834 'Please upgrade to version %s or later.' % (ver, req_ver))
820 return ver
835 return ver
821
836
822
837
823 @decorator.decorator
838 @decorator.decorator
824 def jsonify(func, *args, **kwargs):
839 def jsonify(func, *args, **kwargs):
825 """Action decorator that formats output for JSON
840 """Action decorator that formats output for JSON
826
841
827 Given a function that will return content, this decorator will turn
842 Given a function that will return content, this decorator will turn
828 the result into JSON, with a content-type of 'application/json' and
843 the result into JSON, with a content-type of 'application/json' and
829 output it.
844 output it.
830
845
831 """
846 """
832 from pylons.decorators.util import get_pylons
847 from pylons.decorators.util import get_pylons
833 from kallithea.lib.compat import json
848 from kallithea.lib.compat import json
834 pylons = get_pylons(args)
849 pylons = get_pylons(args)
835 pylons.response.headers['Content-Type'] = 'application/json; charset=utf-8'
850 pylons.response.headers['Content-Type'] = 'application/json; charset=utf-8'
836 data = func(*args, **kwargs)
851 data = func(*args, **kwargs)
837 if isinstance(data, (list, tuple)):
852 if isinstance(data, (list, tuple)):
838 msg = "JSON responses with Array envelopes are susceptible to " \
853 msg = "JSON responses with Array envelopes are susceptible to " \
839 "cross-site data leak attacks, see " \
854 "cross-site data leak attacks, see " \
840 "http://wiki.pylonshq.com/display/pylonsfaq/Warnings"
855 "http://wiki.pylonshq.com/display/pylonsfaq/Warnings"
841 warnings.warn(msg, Warning, 2)
856 warnings.warn(msg, Warning, 2)
842 log.warning(msg)
857 log.warning(msg)
843 log.debug("Returning JSON wrapped action output")
858 log.debug("Returning JSON wrapped action output")
844 return json.dumps(data, encoding='utf-8')
859 return json.dumps(data, encoding='utf-8')
845
860
846
861
847 def conditional_cache(region, prefix, condition, func):
862 def conditional_cache(region, prefix, condition, func):
848 """
863 """
849
864
850 Conditional caching function use like::
865 Conditional caching function use like::
851 def _c(arg):
866 def _c(arg):
852 #heavy computation function
867 #heavy computation function
853 return data
868 return data
854
869
855 # denpending from condition the compute is wrapped in cache or not
870 # denpending from condition the compute is wrapped in cache or not
856 compute = conditional_cache('short_term', 'cache_desc', codnition=True, func=func)
871 compute = conditional_cache('short_term', 'cache_desc', codnition=True, func=func)
857 return compute(arg)
872 return compute(arg)
858
873
859 :param region: name of cache region
874 :param region: name of cache region
860 :param prefix: cache region prefix
875 :param prefix: cache region prefix
861 :param condition: condition for cache to be triggered, and return data cached
876 :param condition: condition for cache to be triggered, and return data cached
862 :param func: wrapped heavy function to compute
877 :param func: wrapped heavy function to compute
863
878
864 """
879 """
865 wrapped = func
880 wrapped = func
866 if condition:
881 if condition:
867 log.debug('conditional_cache: True, wrapping call of '
882 log.debug('conditional_cache: True, wrapping call of '
868 'func: %s into %s region cache' % (region, func))
883 'func: %s into %s region cache' % (region, func))
869 wrapped = _cache_decorate((prefix,), None, None, region)(func)
884 wrapped = _cache_decorate((prefix,), None, None, region)(func)
870
885
871 return wrapped
886 return wrapped
@@ -1,588 +1,600 b''
1 ################################################################################
1 ################################################################################
2 ################################################################################
2 ################################################################################
3 # Kallithea - config for tests: #
3 # Kallithea - config for tests: #
4 # initial_repo_scan = true #
4 # initial_repo_scan = true #
5 # vcs_full_cache = false #
5 # vcs_full_cache = false #
6 # sqlalchemy and kallithea_test.sqlite #
6 # sqlalchemy and kallithea_test.sqlite #
7 # custom logging #
7 # custom logging #
8 # #
8 # #
9 # The %(here)s variable will be replaced with the parent directory of this file#
9 # The %(here)s variable will be replaced with the parent directory of this file#
10 ################################################################################
10 ################################################################################
11 ################################################################################
11 ################################################################################
12
12
13 [DEFAULT]
13 [DEFAULT]
14 debug = true
14 debug = true
15 pdebug = false
15 pdebug = false
16
16
17 ################################################################################
17 ################################################################################
18 ## Email settings ##
18 ## Email settings ##
19 ## ##
19 ## ##
20 ## Refer to the documentation ("Email settings") for more details. ##
20 ## Refer to the documentation ("Email settings") for more details. ##
21 ## ##
21 ## ##
22 ## It is recommended to use a valid sender address that passes access ##
22 ## It is recommended to use a valid sender address that passes access ##
23 ## validation and spam filtering in mail servers. ##
23 ## validation and spam filtering in mail servers. ##
24 ################################################################################
24 ################################################################################
25
25
26 ## 'From' header for application emails. You can optionally add a name.
26 ## 'From' header for application emails. You can optionally add a name.
27 ## Default:
27 ## Default:
28 #app_email_from = Kallithea
28 #app_email_from = Kallithea
29 ## Examples:
29 ## Examples:
30 #app_email_from = Kallithea <kallithea-noreply@example.com>
30 #app_email_from = Kallithea <kallithea-noreply@example.com>
31 #app_email_from = kallithea-noreply@example.com
31 #app_email_from = kallithea-noreply@example.com
32
32
33 ## Subject prefix for application emails.
33 ## Subject prefix for application emails.
34 ## A space between this prefix and the real subject is automatically added.
34 ## A space between this prefix and the real subject is automatically added.
35 ## Default:
35 ## Default:
36 #email_prefix =
36 #email_prefix =
37 ## Example:
37 ## Example:
38 #email_prefix = [Kallithea]
38 #email_prefix = [Kallithea]
39
39
40 ## Recipients for error emails and fallback recipients of application mails.
40 ## Recipients for error emails and fallback recipients of application mails.
41 ## Multiple addresses can be specified, space-separated.
41 ## Multiple addresses can be specified, space-separated.
42 ## Only addresses are allowed, do not add any name part.
42 ## Only addresses are allowed, do not add any name part.
43 ## Default:
43 ## Default:
44 #email_to =
44 #email_to =
45 ## Examples:
45 ## Examples:
46 #email_to = admin@example.com
46 #email_to = admin@example.com
47 #email_to = admin@example.com another_admin@example.com
47 #email_to = admin@example.com another_admin@example.com
48
48
49 ## 'From' header for error emails. You can optionally add a name.
49 ## 'From' header for error emails. You can optionally add a name.
50 ## Default:
50 ## Default:
51 #error_email_from = pylons@yourapp.com
51 #error_email_from = pylons@yourapp.com
52 ## Examples:
52 ## Examples:
53 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
53 #error_email_from = Kallithea Errors <kallithea-noreply@example.com>
54 #error_email_from = paste_error@example.com
54 #error_email_from = paste_error@example.com
55
55
56 ## SMTP server settings
56 ## SMTP server settings
57 ## Only smtp_server is mandatory. All other settings take the specified default
57 ## Only smtp_server is mandatory. All other settings take the specified default
58 ## values.
58 ## values.
59 #smtp_server = smtp.example.com
59 #smtp_server = smtp.example.com
60 #smtp_username =
60 #smtp_username =
61 #smtp_password =
61 #smtp_password =
62 #smtp_port = 25
62 #smtp_port = 25
63 #smtp_use_tls = false
63 #smtp_use_tls = false
64 #smtp_use_ssl = false
64 #smtp_use_ssl = false
65 ## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).
65 ## SMTP authentication parameters to use (e.g. LOGIN PLAIN CRAM-MD5, etc.).
66 ## If empty, use any of the authentication parameters supported by the server.
66 ## If empty, use any of the authentication parameters supported by the server.
67 #smtp_auth =
67 #smtp_auth =
68
68
69 [server:main]
69 [server:main]
70 ## PASTE ##
70 ## PASTE ##
71 #use = egg:Paste#http
71 #use = egg:Paste#http
72 ## nr of worker threads to spawn
72 ## nr of worker threads to spawn
73 #threadpool_workers = 5
73 #threadpool_workers = 5
74 ## max request before thread respawn
74 ## max request before thread respawn
75 #threadpool_max_requests = 10
75 #threadpool_max_requests = 10
76 ## option to use threads of process
76 ## option to use threads of process
77 #use_threadpool = true
77 #use_threadpool = true
78
78
79 ## WAITRESS ##
79 ## WAITRESS ##
80 use = egg:waitress#main
80 use = egg:waitress#main
81 ## number of worker threads
81 ## number of worker threads
82 threads = 5
82 threads = 5
83 ## MAX BODY SIZE 100GB
83 ## MAX BODY SIZE 100GB
84 max_request_body_size = 107374182400
84 max_request_body_size = 107374182400
85 ## use poll instead of select, fixes fd limits, may not work on old
85 ## use poll instead of select, fixes fd limits, may not work on old
86 ## windows systems.
86 ## windows systems.
87 #asyncore_use_poll = True
87 #asyncore_use_poll = True
88
88
89 ## GUNICORN ##
89 ## GUNICORN ##
90 #use = egg:gunicorn#main
90 #use = egg:gunicorn#main
91 ## number of process workers. You must set `instance_id = *` when this option
91 ## number of process workers. You must set `instance_id = *` when this option
92 ## is set to more than one worker
92 ## is set to more than one worker
93 #workers = 1
93 #workers = 1
94 ## process name
94 ## process name
95 #proc_name = kallithea
95 #proc_name = kallithea
96 ## type of worker class, one of sync, eventlet, gevent, tornado
96 ## type of worker class, one of sync, eventlet, gevent, tornado
97 ## recommended for bigger setup is using of of other than sync one
97 ## recommended for bigger setup is using of of other than sync one
98 #worker_class = sync
98 #worker_class = sync
99 #max_requests = 1000
99 #max_requests = 1000
100 ## ammount of time a worker can handle request before it gets killed and
100 ## ammount of time a worker can handle request before it gets killed and
101 ## restarted
101 ## restarted
102 #timeout = 3600
102 #timeout = 3600
103
103
104 ## UWSGI ##
104 ## UWSGI ##
105 ## run with uwsgi --ini-paste-logged <inifile.ini>
105 ## run with uwsgi --ini-paste-logged <inifile.ini>
106 #[uwsgi]
106 #[uwsgi]
107 #socket = /tmp/uwsgi.sock
107 #socket = /tmp/uwsgi.sock
108 #master = true
108 #master = true
109 #http = 127.0.0.1:5000
109 #http = 127.0.0.1:5000
110
110
111 ## set as deamon and redirect all output to file
111 ## set as deamon and redirect all output to file
112 #daemonize = ./uwsgi_kallithea.log
112 #daemonize = ./uwsgi_kallithea.log
113
113
114 ## master process PID
114 ## master process PID
115 #pidfile = ./uwsgi_kallithea.pid
115 #pidfile = ./uwsgi_kallithea.pid
116
116
117 ## stats server with workers statistics, use uwsgitop
117 ## stats server with workers statistics, use uwsgitop
118 ## for monitoring, `uwsgitop 127.0.0.1:1717`
118 ## for monitoring, `uwsgitop 127.0.0.1:1717`
119 #stats = 127.0.0.1:1717
119 #stats = 127.0.0.1:1717
120 #memory-report = true
120 #memory-report = true
121
121
122 ## log 5XX errors
122 ## log 5XX errors
123 #log-5xx = true
123 #log-5xx = true
124
124
125 ## Set the socket listen queue size.
125 ## Set the socket listen queue size.
126 #listen = 256
126 #listen = 256
127
127
128 ## Gracefully Reload workers after the specified amount of managed requests
128 ## Gracefully Reload workers after the specified amount of managed requests
129 ## (avoid memory leaks).
129 ## (avoid memory leaks).
130 #max-requests = 1000
130 #max-requests = 1000
131
131
132 ## enable large buffers
132 ## enable large buffers
133 #buffer-size = 65535
133 #buffer-size = 65535
134
134
135 ## socket and http timeouts ##
135 ## socket and http timeouts ##
136 #http-timeout = 3600
136 #http-timeout = 3600
137 #socket-timeout = 3600
137 #socket-timeout = 3600
138
138
139 ## Log requests slower than the specified number of milliseconds.
139 ## Log requests slower than the specified number of milliseconds.
140 #log-slow = 10
140 #log-slow = 10
141
141
142 ## Exit if no app can be loaded.
142 ## Exit if no app can be loaded.
143 #need-app = true
143 #need-app = true
144
144
145 ## Set lazy mode (load apps in workers instead of master).
145 ## Set lazy mode (load apps in workers instead of master).
146 #lazy = true
146 #lazy = true
147
147
148 ## scaling ##
148 ## scaling ##
149 ## set cheaper algorithm to use, if not set default will be used
149 ## set cheaper algorithm to use, if not set default will be used
150 #cheaper-algo = spare
150 #cheaper-algo = spare
151
151
152 ## minimum number of workers to keep at all times
152 ## minimum number of workers to keep at all times
153 #cheaper = 1
153 #cheaper = 1
154
154
155 ## number of workers to spawn at startup
155 ## number of workers to spawn at startup
156 #cheaper-initial = 1
156 #cheaper-initial = 1
157
157
158 ## maximum number of workers that can be spawned
158 ## maximum number of workers that can be spawned
159 #workers = 4
159 #workers = 4
160
160
161 ## how many workers should be spawned at a time
161 ## how many workers should be spawned at a time
162 #cheaper-step = 1
162 #cheaper-step = 1
163
163
164 ## COMMON ##
164 ## COMMON ##
165 host = 127.0.0.1
165 host = 127.0.0.1
166 #port = 5000
166 #port = 5000
167 port = 4999
167 port = 4999
168
168
169 ## middleware for hosting the WSGI application under a URL prefix
169 ## middleware for hosting the WSGI application under a URL prefix
170 #[filter:proxy-prefix]
170 #[filter:proxy-prefix]
171 #use = egg:PasteDeploy#prefix
171 #use = egg:PasteDeploy#prefix
172 #prefix = /<your-prefix>
172 #prefix = /<your-prefix>
173
173
174 [app:main]
174 [app:main]
175 use = egg:kallithea
175 use = egg:kallithea
176 ## enable proxy prefix middleware
176 ## enable proxy prefix middleware
177 #filter-with = proxy-prefix
177 #filter-with = proxy-prefix
178
178
179 full_stack = true
179 full_stack = true
180 static_files = true
180 static_files = true
181 ## Available Languages:
181 ## Available Languages:
182 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
182 ## cs de fr hu ja nl_BE pl pt_BR ru sk zh_CN zh_TW
183 lang =
183 lang =
184 cache_dir = %(here)s/data
184 cache_dir = %(here)s/data
185 index_dir = %(here)s/data/index
185 index_dir = %(here)s/data/index
186
186
187 ## perform a full repository scan on each server start, this should be
187 ## perform a full repository scan on each server start, this should be
188 ## set to false after first startup, to allow faster server restarts.
188 ## set to false after first startup, to allow faster server restarts.
189 #initial_repo_scan = false
189 #initial_repo_scan = false
190 initial_repo_scan = true
190 initial_repo_scan = true
191
191
192 ## uncomment and set this path to use archive download cache
192 ## uncomment and set this path to use archive download cache
193 archive_cache_dir = %(here)s/tarballcache
193 archive_cache_dir = %(here)s/tarballcache
194
194
195 ## change this to unique ID for security
195 ## change this to unique ID for security
196 app_instance_uuid = test
196 app_instance_uuid = test
197
197
198 ## cut off limit for large diffs (size in bytes)
198 ## cut off limit for large diffs (size in bytes)
199 cut_off_limit = 256000
199 cut_off_limit = 256000
200
200
201 ## use cache version of scm repo everywhere
201 ## use cache version of scm repo everywhere
202 #vcs_full_cache = true
202 #vcs_full_cache = true
203 vcs_full_cache = false
203 vcs_full_cache = false
204
204
205 ## force https in Kallithea, fixes https redirects, assumes it's always https
205 ## force https in Kallithea, fixes https redirects, assumes it's always https
206 force_https = false
206 force_https = false
207
207
208 ## use Strict-Transport-Security headers
208 ## use Strict-Transport-Security headers
209 use_htsts = false
209 use_htsts = false
210
210
211 ## number of commits stats will parse on each iteration
211 ## number of commits stats will parse on each iteration
212 commit_parse_limit = 25
212 commit_parse_limit = 25
213
213
214 ## path to git executable
214 ## path to git executable
215 git_path = git
215 git_path = git
216
216
217 ## git rev filter option, --all is the default filter, if you need to
217 ## git rev filter option, --all is the default filter, if you need to
218 ## hide all refs in changelog switch this to --branches --tags
218 ## hide all refs in changelog switch this to --branches --tags
219 #git_rev_filter = --branches --tags
219 #git_rev_filter = --branches --tags
220
220
221 ## RSS feed options
221 ## RSS feed options
222 rss_cut_off_limit = 256000
222 rss_cut_off_limit = 256000
223 rss_items_per_page = 10
223 rss_items_per_page = 10
224 rss_include_diff = false
224 rss_include_diff = false
225
225
226 ## options for showing and identifying changesets
226 ## options for showing and identifying changesets
227 show_sha_length = 12
227 show_sha_length = 12
228 #show_revision_number = false
228 #show_revision_number = false
229 show_revision_number = true
229 show_revision_number = true
230
230
231 ## gist URL alias, used to create nicer urls for gist. This should be an
231 ## gist URL alias, used to create nicer urls for gist. This should be an
232 ## url that does rewrites to _admin/gists/<gistid>.
232 ## url that does rewrites to _admin/gists/<gistid>.
233 ## example: http://gist.example.com/{gistid}. Empty means use the internal
233 ## example: http://gist.example.com/{gistid}. Empty means use the internal
234 ## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid>
234 ## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid>
235 gist_alias_url =
235 gist_alias_url =
236
236
237 ## white list of API enabled controllers. This allows to add list of
237 ## white list of API enabled controllers. This allows to add list of
238 ## controllers to which access will be enabled by api_key. eg: to enable
238 ## controllers to which access will be enabled by api_key. eg: to enable
239 ## api access to raw_files put `FilesController:raw`, to enable access to patches
239 ## api access to raw_files put `FilesController:raw`, to enable access to patches
240 ## add `ChangesetController:changeset_patch`. This list should be "," separated
240 ## add `ChangesetController:changeset_patch`. This list should be "," separated
241 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
241 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
242 ## Recommended settings below are commented out:
242 ## Recommended settings below are commented out:
243 api_access_controllers_whitelist =
243 api_access_controllers_whitelist =
244 # ChangesetController:changeset_patch,
244 # ChangesetController:changeset_patch,
245 # ChangesetController:changeset_raw,
245 # ChangesetController:changeset_raw,
246 # FilesController:raw,
246 # FilesController:raw,
247 # FilesController:archivefile
247 # FilesController:archivefile
248
248
249 ## default encoding used to convert from and to unicode
249 ## default encoding used to convert from and to unicode
250 ## can be also a comma seperated list of encoding in case of mixed encodings
250 ## can be also a comma seperated list of encoding in case of mixed encodings
251 default_encoding = utf8
251 default_encoding = utf8
252
252
253 ## issue tracker for Kallithea (leave blank to disable, absent for default)
253 ## issue tracker for Kallithea (leave blank to disable, absent for default)
254 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
254 #bugtracker = https://bitbucket.org/conservancy/kallithea/issues
255
255
256 ## issue tracking mapping for commits messages
256 ## issue tracking mapping for commits messages
257 ## comment out issue_pat, issue_server, issue_prefix to enable
257 ## comment out issue_pat, issue_server, issue_prefix to enable
258
258
259 ## pattern to get the issues from commit messages
259 ## pattern to get the issues from commit messages
260 ## default one used here is #<numbers> with a regex passive group for `#`
260 ## default one used here is #<numbers> with a regex passive group for `#`
261 ## {id} will be all groups matched from this pattern
261 ## {id} will be all groups matched from this pattern
262
262
263 issue_pat = (?:\s*#)(\d+)
263 issue_pat = (?:\s*#)(\d+)
264
264
265 ## server url to the issue, each {id} will be replaced with match
265 ## server url to the issue, each {id} will be replaced with match
266 ## fetched from the regex and {repo} is replaced with full repository name
266 ## fetched from the regex and {repo} is replaced with full repository name
267 ## including groups {repo_name} is replaced with just name of repo
267 ## including groups {repo_name} is replaced with just name of repo
268
268
269 issue_server_link = https://issues.example.com/{repo}/issue/{id}
269 issue_server_link = https://issues.example.com/{repo}/issue/{id}
270
270
271 ## prefix to add to link to indicate it's an url
271 ## prefix to add to link to indicate it's an url
272 ## #314 will be replaced by <issue_prefix><id>
272 ## #314 will be replaced by <issue_prefix><id>
273
273
274 issue_prefix = #
274 issue_prefix = #
275
275
276 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
276 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
277 ## multiple patterns, to other issues server, wiki or others
277 ## multiple patterns, to other issues server, wiki or others
278 ## below an example how to create a wiki pattern
278 ## below an example how to create a wiki pattern
279 # wiki-some-id -> https://wiki.example.com/some-id
279 # wiki-some-id -> https://wiki.example.com/some-id
280
280
281 #issue_pat_wiki = (?:wiki-)(.+)
281 #issue_pat_wiki = (?:wiki-)(.+)
282 #issue_server_link_wiki = https://wiki.example.com/{id}
282 #issue_server_link_wiki = https://wiki.example.com/{id}
283 #issue_prefix_wiki = WIKI-
283 #issue_prefix_wiki = WIKI-
284
284
285 ## alternative return HTTP header for failed authentication. Default HTTP
285 ## alternative return HTTP header for failed authentication. Default HTTP
286 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
286 ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with
287 ## handling that. Set this variable to 403 to return HTTPForbidden
287 ## handling that. Set this variable to 403 to return HTTPForbidden
288 auth_ret_code =
288 auth_ret_code =
289
289
290 ## locking return code. When repository is locked return this HTTP code. 2XX
290 ## locking return code. When repository is locked return this HTTP code. 2XX
291 ## codes don't break the transactions while 4XX codes do
291 ## codes don't break the transactions while 4XX codes do
292 lock_ret_code = 423
292 lock_ret_code = 423
293
293
294 ## allows to change the repository location in settings page
294 ## allows to change the repository location in settings page
295 allow_repo_location_change = True
295 allow_repo_location_change = True
296
296
297 ## allows to setup custom hooks in settings page
297 ## allows to setup custom hooks in settings page
298 allow_custom_hooks_settings = True
298 allow_custom_hooks_settings = True
299
299
300 ## extra extensions for indexing, space separated and without the leading '.'.
301 # index.extensions =
302 # gemfile
303 # lock
304
305 ## extra filenames for indexing, space separated
306 # index.filenames =
307 # .dockerignore
308 # .editorconfig
309 # INSTALL
310 # CHANGELOG
311
300 ####################################
312 ####################################
301 ### CELERY CONFIG ####
313 ### CELERY CONFIG ####
302 ####################################
314 ####################################
303
315
304 use_celery = false
316 use_celery = false
305 broker.host = localhost
317 broker.host = localhost
306 broker.vhost = rabbitmqhost
318 broker.vhost = rabbitmqhost
307 broker.port = 5672
319 broker.port = 5672
308 broker.user = rabbitmq
320 broker.user = rabbitmq
309 broker.password = qweqwe
321 broker.password = qweqwe
310
322
311 celery.imports = kallithea.lib.celerylib.tasks
323 celery.imports = kallithea.lib.celerylib.tasks
312
324
313 celery.result.backend = amqp
325 celery.result.backend = amqp
314 celery.result.dburi = amqp://
326 celery.result.dburi = amqp://
315 celery.result.serialier = json
327 celery.result.serialier = json
316
328
317 #celery.send.task.error.emails = true
329 #celery.send.task.error.emails = true
318 #celery.amqp.task.result.expires = 18000
330 #celery.amqp.task.result.expires = 18000
319
331
320 celeryd.concurrency = 2
332 celeryd.concurrency = 2
321 #celeryd.log.file = celeryd.log
333 #celeryd.log.file = celeryd.log
322 celeryd.log.level = DEBUG
334 celeryd.log.level = DEBUG
323 celeryd.max.tasks.per.child = 1
335 celeryd.max.tasks.per.child = 1
324
336
325 ## tasks will never be sent to the queue, but executed locally instead.
337 ## tasks will never be sent to the queue, but executed locally instead.
326 celery.always.eager = false
338 celery.always.eager = false
327
339
328 ####################################
340 ####################################
329 ### BEAKER CACHE ####
341 ### BEAKER CACHE ####
330 ####################################
342 ####################################
331
343
332 beaker.cache.data_dir = %(here)s/data/cache/data
344 beaker.cache.data_dir = %(here)s/data/cache/data
333 beaker.cache.lock_dir = %(here)s/data/cache/lock
345 beaker.cache.lock_dir = %(here)s/data/cache/lock
334
346
335 beaker.cache.regions = short_term,long_term,sql_cache_short
347 beaker.cache.regions = short_term,long_term,sql_cache_short
336
348
337 beaker.cache.short_term.type = memory
349 beaker.cache.short_term.type = memory
338 beaker.cache.short_term.expire = 60
350 beaker.cache.short_term.expire = 60
339 beaker.cache.short_term.key_length = 256
351 beaker.cache.short_term.key_length = 256
340
352
341 beaker.cache.long_term.type = memory
353 beaker.cache.long_term.type = memory
342 beaker.cache.long_term.expire = 36000
354 beaker.cache.long_term.expire = 36000
343 beaker.cache.long_term.key_length = 256
355 beaker.cache.long_term.key_length = 256
344
356
345 beaker.cache.sql_cache_short.type = memory
357 beaker.cache.sql_cache_short.type = memory
346 #beaker.cache.sql_cache_short.expire = 10
358 #beaker.cache.sql_cache_short.expire = 10
347 beaker.cache.sql_cache_short.expire = 1
359 beaker.cache.sql_cache_short.expire = 1
348 beaker.cache.sql_cache_short.key_length = 256
360 beaker.cache.sql_cache_short.key_length = 256
349
361
350 ####################################
362 ####################################
351 ### BEAKER SESSION ####
363 ### BEAKER SESSION ####
352 ####################################
364 ####################################
353
365
354 ## Name of session cookie. Should be unique for a given host and path, even when running
366 ## Name of session cookie. Should be unique for a given host and path, even when running
355 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
367 ## on different ports. Otherwise, cookie sessions will be shared and messed up.
356 beaker.session.key = kallithea
368 beaker.session.key = kallithea
357 ## Sessions should always only be accessible by the browser, not directly by JavaScript.
369 ## Sessions should always only be accessible by the browser, not directly by JavaScript.
358 beaker.session.httponly = true
370 beaker.session.httponly = true
359 ## Session lifetime. 2592000 seconds is 30 days.
371 ## Session lifetime. 2592000 seconds is 30 days.
360 beaker.session.timeout = 2592000
372 beaker.session.timeout = 2592000
361
373
362 ## Server secret used with HMAC to ensure integrity of cookies.
374 ## Server secret used with HMAC to ensure integrity of cookies.
363 beaker.session.secret = {74e0cd75-b339-478b-b129-07dd221def1f}
375 beaker.session.secret = {74e0cd75-b339-478b-b129-07dd221def1f}
364 ## Further, encrypt the data with AES.
376 ## Further, encrypt the data with AES.
365 #beaker.session.encrypt_key = <key_for_encryption>
377 #beaker.session.encrypt_key = <key_for_encryption>
366 #beaker.session.validate_key = <validation_key>
378 #beaker.session.validate_key = <validation_key>
367
379
368 ## Type of storage used for the session, current types are
380 ## Type of storage used for the session, current types are
369 ## dbm, file, memcached, database, and memory.
381 ## dbm, file, memcached, database, and memory.
370
382
371 ## File system storage of session data. (default)
383 ## File system storage of session data. (default)
372 #beaker.session.type = file
384 #beaker.session.type = file
373
385
374 ## Cookie only, store all session data inside the cookie. Requires secure secrets.
386 ## Cookie only, store all session data inside the cookie. Requires secure secrets.
375 #beaker.session.type = cookie
387 #beaker.session.type = cookie
376
388
377 ## Database storage of session data.
389 ## Database storage of session data.
378 #beaker.session.type = ext:database
390 #beaker.session.type = ext:database
379 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
391 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
380 #beaker.session.table_name = db_session
392 #beaker.session.table_name = db_session
381
393
382 ############################
394 ############################
383 ## ERROR HANDLING SYSTEMS ##
395 ## ERROR HANDLING SYSTEMS ##
384 ############################
396 ############################
385
397
386 ####################
398 ####################
387 ### [errormator] ###
399 ### [errormator] ###
388 ####################
400 ####################
389
401
390 ## Errormator is tailored to work with Kallithea, see
402 ## Errormator is tailored to work with Kallithea, see
391 ## http://errormator.com for details how to obtain an account
403 ## http://errormator.com for details how to obtain an account
392 ## you must install python package `errormator_client` to make it work
404 ## you must install python package `errormator_client` to make it work
393
405
394 ## errormator enabled
406 ## errormator enabled
395 errormator = false
407 errormator = false
396
408
397 errormator.server_url = https://api.errormator.com
409 errormator.server_url = https://api.errormator.com
398 errormator.api_key = YOUR_API_KEY
410 errormator.api_key = YOUR_API_KEY
399
411
400 ## TWEAK AMOUNT OF INFO SENT HERE
412 ## TWEAK AMOUNT OF INFO SENT HERE
401
413
402 ## enables 404 error logging (default False)
414 ## enables 404 error logging (default False)
403 errormator.report_404 = false
415 errormator.report_404 = false
404
416
405 ## time in seconds after request is considered being slow (default 1)
417 ## time in seconds after request is considered being slow (default 1)
406 errormator.slow_request_time = 1
418 errormator.slow_request_time = 1
407
419
408 ## record slow requests in application
420 ## record slow requests in application
409 ## (needs to be enabled for slow datastore recording and time tracking)
421 ## (needs to be enabled for slow datastore recording and time tracking)
410 errormator.slow_requests = true
422 errormator.slow_requests = true
411
423
412 ## enable hooking to application loggers
424 ## enable hooking to application loggers
413 #errormator.logging = true
425 #errormator.logging = true
414
426
415 ## minimum log level for log capture
427 ## minimum log level for log capture
416 #errormator.logging.level = WARNING
428 #errormator.logging.level = WARNING
417
429
418 ## send logs only from erroneous/slow requests
430 ## send logs only from erroneous/slow requests
419 ## (saves API quota for intensive logging)
431 ## (saves API quota for intensive logging)
420 errormator.logging_on_error = false
432 errormator.logging_on_error = false
421
433
422 ## list of additonal keywords that should be grabbed from environ object
434 ## list of additonal keywords that should be grabbed from environ object
423 ## can be string with comma separated list of words in lowercase
435 ## can be string with comma separated list of words in lowercase
424 ## (by default client will always send following info:
436 ## (by default client will always send following info:
425 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
437 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
426 ## start with HTTP* this list be extended with additional keywords here
438 ## start with HTTP* this list be extended with additional keywords here
427 errormator.environ_keys_whitelist =
439 errormator.environ_keys_whitelist =
428
440
429 ## list of keywords that should be blanked from request object
441 ## list of keywords that should be blanked from request object
430 ## can be string with comma separated list of words in lowercase
442 ## can be string with comma separated list of words in lowercase
431 ## (by default client will always blank keys that contain following words
443 ## (by default client will always blank keys that contain following words
432 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
444 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
433 ## this list be extended with additional keywords set here
445 ## this list be extended with additional keywords set here
434 errormator.request_keys_blacklist =
446 errormator.request_keys_blacklist =
435
447
436 ## list of namespaces that should be ignores when gathering log entries
448 ## list of namespaces that should be ignores when gathering log entries
437 ## can be string with comma separated list of namespaces
449 ## can be string with comma separated list of namespaces
438 ## (by default the client ignores own entries: errormator_client.client)
450 ## (by default the client ignores own entries: errormator_client.client)
439 errormator.log_namespace_blacklist =
451 errormator.log_namespace_blacklist =
440
452
441 ################
453 ################
442 ### [sentry] ###
454 ### [sentry] ###
443 ################
455 ################
444
456
445 ## sentry is a alternative open source error aggregator
457 ## sentry is a alternative open source error aggregator
446 ## you must install python packages `sentry` and `raven` to enable
458 ## you must install python packages `sentry` and `raven` to enable
447
459
448 sentry.dsn = YOUR_DNS
460 sentry.dsn = YOUR_DNS
449 sentry.servers =
461 sentry.servers =
450 sentry.name =
462 sentry.name =
451 sentry.key =
463 sentry.key =
452 sentry.public_key =
464 sentry.public_key =
453 sentry.secret_key =
465 sentry.secret_key =
454 sentry.project =
466 sentry.project =
455 sentry.site =
467 sentry.site =
456 sentry.include_paths =
468 sentry.include_paths =
457 sentry.exclude_paths =
469 sentry.exclude_paths =
458
470
459 ################################################################################
471 ################################################################################
460 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
472 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
461 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
473 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
462 ## execute malicious code after an exception is raised. ##
474 ## execute malicious code after an exception is raised. ##
463 ################################################################################
475 ################################################################################
464 set debug = false
476 set debug = false
465
477
466 ##################################
478 ##################################
467 ### LOGVIEW CONFIG ###
479 ### LOGVIEW CONFIG ###
468 ##################################
480 ##################################
469
481
470 logview.sqlalchemy = #faa
482 logview.sqlalchemy = #faa
471 logview.pylons.templating = #bfb
483 logview.pylons.templating = #bfb
472 logview.pylons.util = #eee
484 logview.pylons.util = #eee
473
485
474 #########################################################
486 #########################################################
475 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
487 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
476 #########################################################
488 #########################################################
477
489
478 # SQLITE [default]
490 # SQLITE [default]
479 #sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60
491 #sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60
480 sqlalchemy.db1.url = sqlite:///%(here)s/kallithea_test.sqlite
492 sqlalchemy.db1.url = sqlite:///%(here)s/kallithea_test.sqlite
481
493
482 # POSTGRESQL
494 # POSTGRESQL
483 #sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
495 #sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea
484
496
485 # MySQL
497 # MySQL
486 #sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
498 #sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea
487
499
488 # see sqlalchemy docs for others
500 # see sqlalchemy docs for others
489
501
490 sqlalchemy.db1.echo = false
502 sqlalchemy.db1.echo = false
491 sqlalchemy.db1.pool_recycle = 3600
503 sqlalchemy.db1.pool_recycle = 3600
492 sqlalchemy.db1.convert_unicode = true
504 sqlalchemy.db1.convert_unicode = true
493
505
494 ################################
506 ################################
495 ### LOGGING CONFIGURATION ####
507 ### LOGGING CONFIGURATION ####
496 ################################
508 ################################
497
509
498 [loggers]
510 [loggers]
499 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
511 keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer
500
512
501 [handlers]
513 [handlers]
502 keys = console, console_sql
514 keys = console, console_sql
503
515
504 [formatters]
516 [formatters]
505 keys = generic, color_formatter, color_formatter_sql
517 keys = generic, color_formatter, color_formatter_sql
506
518
507 #############
519 #############
508 ## LOGGERS ##
520 ## LOGGERS ##
509 #############
521 #############
510
522
511 [logger_root]
523 [logger_root]
512 #level = NOTSET
524 #level = NOTSET
513 level = DEBUG
525 level = DEBUG
514 handlers = console
526 handlers = console
515
527
516 [logger_routes]
528 [logger_routes]
517 level = DEBUG
529 level = DEBUG
518 handlers =
530 handlers =
519 qualname = routes.middleware
531 qualname = routes.middleware
520 ## "level = DEBUG" logs the route matched and routing variables.
532 ## "level = DEBUG" logs the route matched and routing variables.
521 propagate = 1
533 propagate = 1
522
534
523 [logger_beaker]
535 [logger_beaker]
524 level = DEBUG
536 level = DEBUG
525 handlers =
537 handlers =
526 qualname = beaker.container
538 qualname = beaker.container
527 propagate = 1
539 propagate = 1
528
540
529 [logger_templates]
541 [logger_templates]
530 level = INFO
542 level = INFO
531 handlers =
543 handlers =
532 qualname = pylons.templating
544 qualname = pylons.templating
533 propagate = 1
545 propagate = 1
534
546
535 [logger_kallithea]
547 [logger_kallithea]
536 level = DEBUG
548 level = DEBUG
537 handlers =
549 handlers =
538 qualname = kallithea
550 qualname = kallithea
539 propagate = 1
551 propagate = 1
540
552
541 [logger_sqlalchemy]
553 [logger_sqlalchemy]
542 #level = INFO
554 #level = INFO
543 level = ERROR
555 level = ERROR
544 #handlers = console_sql
556 #handlers = console_sql
545 handlers = console
557 handlers = console
546 qualname = sqlalchemy.engine
558 qualname = sqlalchemy.engine
547 propagate = 0
559 propagate = 0
548
560
549 [logger_whoosh_indexer]
561 [logger_whoosh_indexer]
550 level = DEBUG
562 level = DEBUG
551 handlers =
563 handlers =
552 qualname = whoosh_indexer
564 qualname = whoosh_indexer
553 propagate = 1
565 propagate = 1
554
566
555 ##############
567 ##############
556 ## HANDLERS ##
568 ## HANDLERS ##
557 ##############
569 ##############
558
570
559 [handler_console]
571 [handler_console]
560 class = StreamHandler
572 class = StreamHandler
561 args = (sys.stderr,)
573 args = (sys.stderr,)
562 #level = INFO
574 #level = INFO
563 level = NOTSET
575 level = NOTSET
564 formatter = generic
576 formatter = generic
565
577
566 [handler_console_sql]
578 [handler_console_sql]
567 class = StreamHandler
579 class = StreamHandler
568 args = (sys.stderr,)
580 args = (sys.stderr,)
569 level = WARN
581 level = WARN
570 formatter = generic
582 formatter = generic
571
583
572 ################
584 ################
573 ## FORMATTERS ##
585 ## FORMATTERS ##
574 ################
586 ################
575
587
576 [formatter_generic]
588 [formatter_generic]
577 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
589 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
578 datefmt = %Y-%m-%d %H:%M:%S
590 datefmt = %Y-%m-%d %H:%M:%S
579
591
580 [formatter_color_formatter]
592 [formatter_color_formatter]
581 class = kallithea.lib.colored_formatter.ColorFormatter
593 class = kallithea.lib.colored_formatter.ColorFormatter
582 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
594 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
583 datefmt = %Y-%m-%d %H:%M:%S
595 datefmt = %Y-%m-%d %H:%M:%S
584
596
585 [formatter_color_formatter_sql]
597 [formatter_color_formatter_sql]
586 class = kallithea.lib.colored_formatter.ColorFormatterSql
598 class = kallithea.lib.colored_formatter.ColorFormatterSql
587 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
599 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
588 datefmt = %Y-%m-%d %H:%M:%S
600 datefmt = %Y-%m-%d %H:%M:%S
General Comments 0
You need to be logged in to leave comments. Login now