Show More
@@ -0,0 +1,138 b'' | |||
|
1 | """ | |
|
2 | config generator | |
|
3 | ||
|
4 | """ | |
|
5 | from __future__ import with_statement | |
|
6 | import os | |
|
7 | import sys | |
|
8 | import uuid | |
|
9 | import argparse | |
|
10 | from mako.template import Template | |
|
11 | TMPL = 'template.ini.mako' | |
|
12 | here = os.path.dirname(os.path.abspath(__file__)) | |
|
13 | ||
|
14 | def argparser(argv): | |
|
15 | usage = ( | |
|
16 | "rhodecode-config [-h] [--filename=FILENAME] [--template=TEMPLATE] \n" | |
|
17 | "VARS optional specify extra template variable that will be available in " | |
|
18 | "template. Use comma separated key=val format eg.\n" | |
|
19 | "key1=val1,port=5000,host=127.0.0.1,elements='a\,b\,c'\n" | |
|
20 | ) | |
|
21 | ||
|
22 | parser = argparse.ArgumentParser( | |
|
23 | description='RhodeCode CONFIG generator with variable replacement', | |
|
24 | usage=usage | |
|
25 | ) | |
|
26 | ||
|
27 | ## config | |
|
28 | group = parser.add_argument_group('CONFIG') | |
|
29 | group.add_argument('--filename', help='Output ini filename.') | |
|
30 | group.add_argument('--template', help='Mako template file to use instead of ' | |
|
31 | 'the default builtin template') | |
|
32 | group.add_argument('--raw', help='Store given mako template as raw without ' | |
|
33 | 'parsing. Use this to create custom template ' | |
|
34 | 'initially', action='store_true') | |
|
35 | group.add_argument('--show-defaults', help='Show all default variables for ' | |
|
36 | 'builtin template', action='store_true') | |
|
37 | args, other = parser.parse_known_args() | |
|
38 | return parser, args, other | |
|
39 | ||
|
40 | ||
|
41 | def _escape_split(text, sep): | |
|
42 | """ | |
|
43 | Allows for escaping of the separator: e.g. arg='foo\, bar' | |
|
44 | ||
|
45 | It should be noted that the way bash et. al. do command line parsing, those | |
|
46 | single quotes are required. a shameless ripoff from fabric project. | |
|
47 | ||
|
48 | """ | |
|
49 | escaped_sep = r'\%s' % sep | |
|
50 | ||
|
51 | if escaped_sep not in text: | |
|
52 | return text.split(sep) | |
|
53 | ||
|
54 | before, _, after = text.partition(escaped_sep) | |
|
55 | startlist = before.split(sep) # a regular split is fine here | |
|
56 | unfinished = startlist[-1] | |
|
57 | startlist = startlist[:-1] | |
|
58 | ||
|
59 | # recurse because there may be more escaped separators | |
|
60 | endlist = _escape_split(after, sep) | |
|
61 | ||
|
62 | # finish building the escaped value. we use endlist[0] becaue the first | |
|
63 | # part of the string sent in recursion is the rest of the escaped value. | |
|
64 | unfinished += sep + endlist[0] | |
|
65 | ||
|
66 | return startlist + [unfinished] + endlist[1:] # put together all the parts | |
|
67 | ||
|
68 | def _run(argv): | |
|
69 | parser, args, other = argparser(argv) | |
|
70 | if not len(sys.argv) > 1: | |
|
71 | print parser.print_help() | |
|
72 | sys.exit(0) | |
|
73 | # defaults that can be overwritten by arguments | |
|
74 | tmpl_stored_args = { | |
|
75 | 'http_server': 'waitress', | |
|
76 | 'lang': 'en', | |
|
77 | 'database_engine': 'sqlite', | |
|
78 | 'host': '127.0.0.1', | |
|
79 | 'port': 5000, | |
|
80 | 'error_aggregation_service': None | |
|
81 | } | |
|
82 | if other: | |
|
83 | # parse arguments, we assume only first is correct | |
|
84 | kwargs = {} | |
|
85 | for el in _escape_split(other[0], ','): | |
|
86 | kv = _escape_split(el, '=') | |
|
87 | if len(kv) == 2: | |
|
88 | k, v = kv | |
|
89 | kwargs[k] = v | |
|
90 | # update our template stored args | |
|
91 | tmpl_stored_args.update(kwargs) | |
|
92 | ||
|
93 | # use default that cannot be replaced | |
|
94 | tmpl_stored_args.update({ | |
|
95 | 'uuid': lambda: uuid.uuid4().hex, | |
|
96 | 'here': os.path.abspath(os.curdir), | |
|
97 | }) | |
|
98 | if args.show_defaults: | |
|
99 | for k,v in tmpl_stored_args.iteritems(): | |
|
100 | print '%s=%s' % (k, v) | |
|
101 | sys.exit(0) | |
|
102 | try: | |
|
103 | # built in template | |
|
104 | tmpl_file = os.path.join(here, TMPL) | |
|
105 | if args.template: | |
|
106 | tmpl_file = args.template | |
|
107 | ||
|
108 | with open(tmpl_file, 'rb') as f: | |
|
109 | tmpl_data = f.read() | |
|
110 | if args.raw: | |
|
111 | tmpl = tmpl_data | |
|
112 | else: | |
|
113 | tmpl = Template(tmpl_data).render(**tmpl_stored_args) | |
|
114 | with open(args.filename, 'wb') as f: | |
|
115 | f.write(tmpl) | |
|
116 | print 'Wrote new config file in %s' % (os.path.abspath(args.filename)) | |
|
117 | ||
|
118 | except Exception: | |
|
119 | from mako import exceptions | |
|
120 | print exceptions.text_error_template().render() | |
|
121 | ||
|
122 | def main(argv=None): | |
|
123 | """ | |
|
124 | Main execution function for cli | |
|
125 | ||
|
126 | :param argv: | |
|
127 | """ | |
|
128 | if argv is None: | |
|
129 | argv = sys.argv | |
|
130 | ||
|
131 | try: | |
|
132 | return _run(argv) | |
|
133 | except Exception: | |
|
134 | raise | |
|
135 | ||
|
136 | ||
|
137 | if __name__ == '__main__': | |
|
138 | sys.exit(main(sys.argv)) |
This diff has been collapsed as it changes many lines, (545 lines changed) Show them Hide them | |||
@@ -0,0 +1,545 b'' | |||
|
1 | ## -*- coding: utf-8 -*- | |
|
2 | <%text> | |
|
3 | ################################################################################ | |
|
4 | ################################################################################ | |
|
5 | # RhodeCode - Example config # | |
|
6 | # Built-in functions and variables # | |
|
7 | # The ${here} variable will be replaced with the parent directory of this file # | |
|
8 | # ${uuid()} function will generate a unique hash # | |
|
9 | ################################################################################ | |
|
10 | </%text> | |
|
11 | [DEFAULT] | |
|
12 | debug = true | |
|
13 | pdebug = false | |
|
14 | <%text> | |
|
15 | ################################################################################ | |
|
16 | ## Uncomment and replace with the address which should receive ## | |
|
17 | ## any error reports after application crash ## | |
|
18 | ## Additionally those settings will be used by RhodeCode mailing system ## | |
|
19 | ################################################################################ | |
|
20 | </%text> | |
|
21 | #email_to = admin@localhost | |
|
22 | #error_email_from = paste_error@localhost | |
|
23 | #app_email_from = rhodecode-noreply@localhost | |
|
24 | #error_message = | |
|
25 | #email_prefix = [RhodeCode] | |
|
26 | ||
|
27 | #smtp_server = mail.server.com | |
|
28 | #smtp_username = | |
|
29 | #smtp_password = | |
|
30 | #smtp_port = | |
|
31 | #smtp_use_tls = false | |
|
32 | #smtp_use_ssl = true | |
|
33 | <%text>## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)</%text> | |
|
34 | #smtp_auth = | |
|
35 | ||
|
36 | [server:main] | |
|
37 | %if http_server == 'paste': | |
|
38 | <%text>## PASTE ##</%text> | |
|
39 | use = egg:Paste#http | |
|
40 | <%text>## nr of worker threads to spawn</%text> | |
|
41 | threadpool_workers = 5 | |
|
42 | <%text>## max request before thread respawn</%text> | |
|
43 | threadpool_max_requests = 10 | |
|
44 | <%text>## option to use threads of process</%text> | |
|
45 | use_threadpool = true | |
|
46 | %endif | |
|
47 | %if http_server == 'waitress': | |
|
48 | <%text>## WAITRESS ##</%text> | |
|
49 | use = egg:waitress#main | |
|
50 | <%text>## number of worker threads</%text> | |
|
51 | threads = 5 | |
|
52 | <%text>## MAX BODY SIZE 100GB</%text> | |
|
53 | max_request_body_size = 107374182400 | |
|
54 | <%text>## use poll instead of select, fixes fd limits, may not work on old</%text> | |
|
55 | <%text>## windows systems.</%text> | |
|
56 | #asyncore_use_poll = True | |
|
57 | %endif | |
|
58 | %if http_server == 'gunicorn': | |
|
59 | <%text>## GUNICORN ##</%text> | |
|
60 | use = egg:gunicorn#main | |
|
61 | <%text>## number of process workers. You must set `instance_id = *` when this option</%text> | |
|
62 | <%text>## is set to more than one worker</%text> | |
|
63 | workers = 1 | |
|
64 | <%text>## process name</%text> | |
|
65 | proc_name = rhodecode | |
|
66 | <%text>## type of worker class, one of sync, eventlet, gevent, tornado</%text> | |
|
67 | <%text>## recommended for bigger setup is using of of other than sync one</%text> | |
|
68 | worker_class = sync | |
|
69 | max_requests = 1000 | |
|
70 | <%text>## ammount of time a worker can handle request before it get's killed and</%text> | |
|
71 | <%text>## restarted</%text> | |
|
72 | timeout = 3600 | |
|
73 | %endif | |
|
74 | <%text>## COMMON ##</%text> | |
|
75 | host = ${host} | |
|
76 | port = ${port} | |
|
77 | ||
|
78 | <%text>## prefix middleware for rc</%text> | |
|
79 | #[filter:proxy-prefix] | |
|
80 | #use = egg:PasteDeploy#prefix | |
|
81 | #prefix = /<your-prefix> | |
|
82 | ||
|
83 | [app:main] | |
|
84 | use = egg:rhodecode | |
|
85 | <%text>## enable proxy prefix middleware</%text> | |
|
86 | #filter-with = proxy-prefix | |
|
87 | ||
|
88 | full_stack = true | |
|
89 | static_files = true | |
|
90 | <%text>## Optional Languages</%text> | |
|
91 | <%text>## en, fr, ja, pt_BR, zh_CN, zh_TW, pl, ru</%text> | |
|
92 | lang = ${lang} | |
|
93 | cache_dir = ${here}/data | |
|
94 | index_dir = ${here}/data/index | |
|
95 | ||
|
96 | <%text>## perform a full repository scan on each server start, this should be</%text> | |
|
97 | <%text>## set to false after first startup, to allow faster server restarts.</%text> | |
|
98 | initial_repo_scan = false | |
|
99 | ||
|
100 | <%text>## uncomment and set this path to use archive download cache</%text> | |
|
101 | archive_cache_dir = ${here}/tarballcache | |
|
102 | ||
|
103 | <%text>## change this to unique ID for security</%text> | |
|
104 | app_instance_uuid = ${uuid()} | |
|
105 | ||
|
106 | <%text>## cut off limit for large diffs (size in bytes)</%text> | |
|
107 | cut_off_limit = 256000 | |
|
108 | ||
|
109 | <%text>## use cache version of scm repo everywhere</%text> | |
|
110 | vcs_full_cache = true | |
|
111 | ||
|
112 | <%text>## force https in RhodeCode, fixes https redirects, assumes it's always https</%text> | |
|
113 | force_https = false | |
|
114 | ||
|
115 | <%text>## use Strict-Transport-Security headers</%text> | |
|
116 | use_htsts = false | |
|
117 | ||
|
118 | <%text>## number of commits stats will parse on each iteration</%text> | |
|
119 | commit_parse_limit = 25 | |
|
120 | ||
|
121 | <%text>## use gravatar service to display avatars</%text> | |
|
122 | use_gravatar = true | |
|
123 | ||
|
124 | <%text>## path to git executable</%text> | |
|
125 | git_path = git | |
|
126 | ||
|
127 | <%text>## git rev filter option, --all is the default filter, if you need to</%text> | |
|
128 | <%text>## hide all refs in changelog switch this to --branches --tags</%text> | |
|
129 | git_rev_filter=--branches --tags | |
|
130 | ||
|
131 | <%text>## RSS feed options</%text> | |
|
132 | rss_cut_off_limit = 256000 | |
|
133 | rss_items_per_page = 10 | |
|
134 | rss_include_diff = false | |
|
135 | ||
|
136 | <%text>## options for showing and identifying changesets</%text> | |
|
137 | show_sha_length = 12 | |
|
138 | show_revision_number = true | |
|
139 | ||
|
140 | <%text>## gist URL alias, used to create nicer urls for gist. This should be an</%text> | |
|
141 | <%text>## url that does rewrites to _admin/gists/<gistid>.</%text> | |
|
142 | <%text>## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal</%text> | |
|
143 | <%text>## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/<gistid></%text> | |
|
144 | gist_alias_url = | |
|
145 | ||
|
146 | <%text>## white list of API enabled controllers. This allows to add list of</%text> | |
|
147 | <%text>## controllers to which access will be enabled by api_key. eg: to enable</%text> | |
|
148 | <%text>## api access to raw_files put `FilesController:raw`, to enable access to patches</%text> | |
|
149 | <%text>## add `ChangesetController:changeset_patch`. This list should be "," separated</%text> | |
|
150 | <%text>## Syntax is <ControllerClass>:<function>. Check debug logs for generated names</%text> | |
|
151 | api_access_controllers_whitelist = | |
|
152 | ||
|
153 | <%text>## alternative_gravatar_url allows you to use your own avatar server application</%text> | |
|
154 | <%text>## the following parts of the URL will be replaced</%text> | |
|
155 | <%text>## {email} user email</%text> | |
|
156 | <%text>## {md5email} md5 hash of the user email (like at gravatar.com)</%text> | |
|
157 | <%text>## {size} size of the image that is expected from the server application</%text> | |
|
158 | <%text>## {scheme} http/https from RhodeCode server</%text> | |
|
159 | <%text>## {netloc} network location from RhodeCode server</%text> | |
|
160 | #alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size} | |
|
161 | #alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size} | |
|
162 | ||
|
163 | ||
|
164 | <%text>## container auth options</%text> | |
|
165 | container_auth_enabled = false | |
|
166 | proxypass_auth_enabled = false | |
|
167 | ||
|
168 | <%text>## default encoding used to convert from and to unicode</%text> | |
|
169 | <%text>## can be also a comma seperated list of encoding in case of mixed encodings</%text> | |
|
170 | default_encoding = utf8 | |
|
171 | ||
|
172 | <%text>## overwrite schema of clone url</%text> | |
|
173 | <%text>## available vars:</%text> | |
|
174 | <%text>## scheme - http/https</%text> | |
|
175 | <%text>## user - current user</%text> | |
|
176 | <%text>## pass - password</%text> | |
|
177 | <%text>## netloc - network location</%text> | |
|
178 | <%text>## path - usually repo_name</%text> | |
|
179 | ||
|
180 | #clone_uri = {scheme}://{user}{pass}{netloc}{path} | |
|
181 | ||
|
182 | <%text>## issue tracker for RhodeCode (leave blank to disable, absent for default)</%text> | |
|
183 | #bugtracker = http://bitbucket.org/marcinkuzminski/rhodecode/issues | |
|
184 | ||
|
185 | <%text>## issue tracking mapping for commits messages</%text> | |
|
186 | <%text>## comment out issue_pat, issue_server, issue_prefix to enable</%text> | |
|
187 | ||
|
188 | <%text>## pattern to get the issues from commit messages</%text> | |
|
189 | <%text>## default one used here is #<numbers> with a regex passive group for `#`</%text> | |
|
190 | <%text>## {id} will be all groups matched from this pattern</%text> | |
|
191 | ||
|
192 | issue_pat = (?:\s*#)(\d+) | |
|
193 | ||
|
194 | <%text>## server url to the issue, each {id} will be replaced with match</%text> | |
|
195 | <%text>## fetched from the regex and {repo} is replaced with full repository name</%text> | |
|
196 | <%text>## including groups {repo_name} is replaced with just name of repo</%text> | |
|
197 | ||
|
198 | issue_server_link = https://myissueserver.com/{repo}/issue/{id} | |
|
199 | ||
|
200 | <%text>## prefix to add to link to indicate it's an url</%text> | |
|
201 | <%text>## #314 will be replaced by <issue_prefix><id></%text> | |
|
202 | ||
|
203 | issue_prefix = # | |
|
204 | ||
|
205 | <%text>## issue_pat, issue_server_link, issue_prefix can have suffixes to specify</%text> | |
|
206 | <%text>## multiple patterns, to other issues server, wiki or others</%text> | |
|
207 | <%text>## below an example how to create a wiki pattern</%text> | |
|
208 | <%text>## wiki-some-id -> https://mywiki.com/some-id</%text> | |
|
209 | ||
|
210 | #issue_pat_wiki = (?:wiki-)(.+) | |
|
211 | #issue_server_link_wiki = https://mywiki.com/{id} | |
|
212 | #issue_prefix_wiki = WIKI- | |
|
213 | ||
|
214 | ||
|
215 | <%text>## instance-id prefix</%text> | |
|
216 | <%text>## a prefix key for this instance used for cache invalidation when running</%text> | |
|
217 | <%text>## multiple instances of rhodecode, make sure it's globally unique for</%text> | |
|
218 | <%text>## all running rhodecode instances. Leave empty if you don't use it</%text> | |
|
219 | instance_id = | |
|
220 | ||
|
221 | <%text>## alternative return HTTP header for failed authentication. Default HTTP</%text> | |
|
222 | <%text>## response is 401 HTTPUnauthorized. Currently HG clients have troubles with</%text> | |
|
223 | <%text>## handling that. Set this variable to 403 to return HTTPForbidden</%text> | |
|
224 | auth_ret_code = | |
|
225 | ||
|
226 | <%text>## locking return code. When repository is locked return this HTTP code. 2XX</%text> | |
|
227 | <%text>## codes don't break the transactions while 4XX codes do</%text> | |
|
228 | lock_ret_code = 423 | |
|
229 | ||
|
230 | <%text>## allow chaning the repository store location from web interface</%text> | |
|
231 | allow_repo_location_change = True | |
|
232 | ||
|
233 | <%text> | |
|
234 | #################################### | |
|
235 | ### CELERY CONFIG #### | |
|
236 | #################################### | |
|
237 | </%text> | |
|
238 | use_celery = false | |
|
239 | broker.host = localhost | |
|
240 | broker.vhost = rabbitmqhost | |
|
241 | broker.port = 5672 | |
|
242 | broker.user = rabbitmq | |
|
243 | broker.password = qweqwe | |
|
244 | ||
|
245 | celery.imports = rhodecode.lib.celerylib.tasks | |
|
246 | ||
|
247 | celery.result.backend = amqp | |
|
248 | celery.result.dburi = amqp:// | |
|
249 | celery.result.serialier = json | |
|
250 | ||
|
251 | #celery.send.task.error.emails = true | |
|
252 | #celery.amqp.task.result.expires = 18000 | |
|
253 | ||
|
254 | celeryd.concurrency = 2 | |
|
255 | #celeryd.log.file = celeryd.log | |
|
256 | celeryd.log.level = debug | |
|
257 | celeryd.max.tasks.per.child = 1 | |
|
258 | ||
|
259 | <%text>## tasks will never be sent to the queue, but executed locally instead.</%text> | |
|
260 | celery.always.eager = false | |
|
261 | <%text> | |
|
262 | #################################### | |
|
263 | ### BEAKER CACHE #### | |
|
264 | #################################### | |
|
265 | </%text> | |
|
266 | beaker.cache.data_dir=${here}/data/cache/data | |
|
267 | beaker.cache.lock_dir=${here}/data/cache/lock | |
|
268 | ||
|
269 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long | |
|
270 | ||
|
271 | beaker.cache.super_short_term.type=memory | |
|
272 | beaker.cache.super_short_term.expire=10 | |
|
273 | beaker.cache.super_short_term.key_length = 256 | |
|
274 | ||
|
275 | beaker.cache.short_term.type=memory | |
|
276 | beaker.cache.short_term.expire=60 | |
|
277 | beaker.cache.short_term.key_length = 256 | |
|
278 | ||
|
279 | beaker.cache.long_term.type=memory | |
|
280 | beaker.cache.long_term.expire=36000 | |
|
281 | beaker.cache.long_term.key_length = 256 | |
|
282 | ||
|
283 | beaker.cache.sql_cache_short.type=memory | |
|
284 | beaker.cache.sql_cache_short.expire=10 | |
|
285 | beaker.cache.sql_cache_short.key_length = 256 | |
|
286 | ||
|
287 | beaker.cache.sql_cache_med.type=memory | |
|
288 | beaker.cache.sql_cache_med.expire=360 | |
|
289 | beaker.cache.sql_cache_med.key_length = 256 | |
|
290 | ||
|
291 | beaker.cache.sql_cache_long.type=file | |
|
292 | beaker.cache.sql_cache_long.expire=3600 | |
|
293 | beaker.cache.sql_cache_long.key_length = 256 | |
|
294 | <%text> | |
|
295 | #################################### | |
|
296 | ### BEAKER SESSION #### | |
|
297 | #################################### | |
|
298 | ## Type of storage used for the session, current types are | |
|
299 | ## dbm, file, memcached, database, and memory. | |
|
300 | ## The storage uses the Container API | |
|
301 | ## that is also used by the cache system. | |
|
302 | </%text> | |
|
303 | <%text>## db session ##</%text> | |
|
304 | #beaker.session.type = ext:database | |
|
305 | #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode | |
|
306 | #beaker.session.table_name = db_session | |
|
307 | ||
|
308 | <%text>## encrypted cookie client side session, good for many instances ##</%text> | |
|
309 | #beaker.session.type = cookie | |
|
310 | ||
|
311 | <%text>## file based cookies (default) ##</%text> | |
|
312 | #beaker.session.type = file | |
|
313 | ||
|
314 | beaker.session.key = rhodecode | |
|
315 | beaker.session.secret = ${uuid()} | |
|
316 | ||
|
317 | <%text>## Secure encrypted cookie. Requires AES and AES python libraries</%text> | |
|
318 | <%text>## you must disable beaker.session.secret to use this</%text> | |
|
319 | #beaker.session.encrypt_key = <key_for_encryption> | |
|
320 | #beaker.session.validate_key = <validation_key> | |
|
321 | ||
|
322 | <%text>## sets session as invalid if it haven't been accessed for given amount of time</%text> | |
|
323 | beaker.session.timeout = 2592000 | |
|
324 | beaker.session.httponly = true | |
|
325 | #beaker.session.cookie_path = /<your-prefix> | |
|
326 | ||
|
327 | <%text>## uncomment for https secure cookie</%text> | |
|
328 | beaker.session.secure = false | |
|
329 | ||
|
330 | <%text>## auto save the session to not to use .save()</%text> | |
|
331 | beaker.session.auto = False | |
|
332 | ||
|
333 | <%text>## default cookie expiration time in seconds `true` expire at browser close ##</%text> | |
|
334 | #beaker.session.cookie_expires = 3600 | |
|
335 | ||
|
336 | %if error_aggregation_service == 'errormator': | |
|
337 | <%text> | |
|
338 | ############################ | |
|
339 | ## ERROR HANDLING SYSTEMS ## | |
|
340 | ############################ | |
|
341 | ||
|
342 | #################### | |
|
343 | ### [errormator] ### | |
|
344 | #################### | |
|
345 | ||
|
346 | ## Errormator is tailored to work with RhodeCode, see | |
|
347 | ## http://errormator.com for details how to obtain an account | |
|
348 | ## you must install python package `errormator_client` to make it work | |
|
349 | </%text> | |
|
350 | <%text>## errormator enabled</%text> | |
|
351 | errormator = false | |
|
352 | ||
|
353 | errormator.server_url = https://api.errormator.com | |
|
354 | errormator.api_key = YOUR_API_KEY | |
|
355 | ||
|
356 | <%text>## TWEAK AMOUNT OF INFO SENT HERE</%text> | |
|
357 | ||
|
358 | <%text>## enables 404 error logging (default False)</%text> | |
|
359 | errormator.report_404 = false | |
|
360 | ||
|
361 | <%text>## time in seconds after request is considered being slow (default 1)</%text> | |
|
362 | errormator.slow_request_time = 1 | |
|
363 | ||
|
364 | <%text>## record slow requests in application</%text> | |
|
365 | <%text>## (needs to be enabled for slow datastore recording and time tracking)</%text> | |
|
366 | errormator.slow_requests = true | |
|
367 | ||
|
368 | <%text>## enable hooking to application loggers</%text> | |
|
369 | # errormator.logging = true | |
|
370 | ||
|
371 | <%text>## minimum log level for log capture</%text> | |
|
372 | # errormator.logging.level = WARNING | |
|
373 | ||
|
374 | <%text>## send logs only from erroneous/slow requests</%text> | |
|
375 | <%text>## (saves API quota for intensive logging)</%text> | |
|
376 | errormator.logging_on_error = false | |
|
377 | ||
|
378 | <%text>## list of additonal keywords that should be grabbed from environ object</%text> | |
|
379 | <%text>## can be string with comma separated list of words in lowercase</%text> | |
|
380 | <%text>## (by default client will always send following info:</%text> | |
|
381 | <%text>## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that</%text> | |
|
382 | <%text>## start with HTTP* this list be extended with additional keywords here</%text> | |
|
383 | errormator.environ_keys_whitelist = | |
|
384 | ||
|
385 | ||
|
386 | <%text>## list of keywords that should be blanked from request object</%text> | |
|
387 | <%text>## can be string with comma separated list of words in lowercase</%text> | |
|
388 | <%text>## (by default client will always blank keys that contain following words</%text> | |
|
389 | <%text>## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'</%text> | |
|
390 | <%text>## this list be extended with additional keywords set here</%text> | |
|
391 | errormator.request_keys_blacklist = | |
|
392 | ||
|
393 | ||
|
394 | <%text>## list of namespaces that should be ignores when gathering log entries</%text> | |
|
395 | <%text>## can be string with comma separated list of namespaces</%text> | |
|
396 | <%text>## (by default the client ignores own entries: errormator_client.client)</%text> | |
|
397 | errormator.log_namespace_blacklist = | |
|
398 | %elif error_aggregation_service == 'sentry': | |
|
399 | <%text> | |
|
400 | ################ | |
|
401 | ### [sentry] ### | |
|
402 | ################ | |
|
403 | ||
|
404 | ## sentry is a alternative open source error aggregator | |
|
405 | ## you must install python packages `sentry` and `raven` to enable | |
|
406 | </%text> | |
|
407 | sentry.dsn = YOUR_DNS | |
|
408 | sentry.servers = | |
|
409 | sentry.name = | |
|
410 | sentry.key = | |
|
411 | sentry.public_key = | |
|
412 | sentry.secret_key = | |
|
413 | sentry.project = | |
|
414 | sentry.site = | |
|
415 | sentry.include_paths = | |
|
416 | sentry.exclude_paths = | |
|
417 | %endif | |
|
418 | <%text> | |
|
419 | ################################################################################ | |
|
420 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## | |
|
421 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## | |
|
422 | ## execute malicious code after an exception is raised. ## | |
|
423 | ################################################################################ | |
|
424 | </%text> | |
|
425 | set debug = false | |
|
426 | <%text> | |
|
427 | ################################## | |
|
428 | ### LOGVIEW CONFIG ### | |
|
429 | ################################## | |
|
430 | </%text> | |
|
431 | logview.sqlalchemy = #faa | |
|
432 | logview.pylons.templating = #bfb | |
|
433 | logview.pylons.util = #eee | |
|
434 | <%text> | |
|
435 | ######################################################### | |
|
436 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### | |
|
437 | ######################################################### | |
|
438 | </%text> | |
|
439 | %if database_engine == 'sqlite': | |
|
440 | # SQLITE [default] | |
|
441 | sqlalchemy.db1.url = sqlite:///${here}/rhodecode.db?timeout=60 | |
|
442 | %elif database_engine == 'postgres': | |
|
443 | # POSTGRESQL | |
|
444 | sqlalchemy.db1.url = postgresql://user:pass@localhost/rhodecode | |
|
445 | %elif database_engine == 'mysql': | |
|
446 | # MySQL | |
|
447 | sqlalchemy.db1.url = mysql://user:pass@localhost/rhodecode | |
|
448 | %endif | |
|
449 | # see sqlalchemy docs for others | |
|
450 | ||
|
451 | sqlalchemy.db1.echo = false | |
|
452 | sqlalchemy.db1.pool_recycle = 3600 | |
|
453 | sqlalchemy.db1.convert_unicode = true | |
|
454 | <%text> | |
|
455 | ################################ | |
|
456 | ### LOGGING CONFIGURATION #### | |
|
457 | ################################ | |
|
458 | </%text> | |
|
459 | [loggers] | |
|
460 | keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer | |
|
461 | ||
|
462 | [handlers] | |
|
463 | keys = console, console_sql | |
|
464 | ||
|
465 | [formatters] | |
|
466 | keys = generic, color_formatter, color_formatter_sql | |
|
467 | <%text> | |
|
468 | ############# | |
|
469 | ## LOGGERS ## | |
|
470 | ############# | |
|
471 | </%text> | |
|
472 | [logger_root] | |
|
473 | level = NOTSET | |
|
474 | handlers = console | |
|
475 | ||
|
476 | [logger_routes] | |
|
477 | level = DEBUG | |
|
478 | handlers = | |
|
479 | qualname = routes.middleware | |
|
480 | <%text>## "level = DEBUG" logs the route matched and routing variables.</%text> | |
|
481 | propagate = 1 | |
|
482 | ||
|
483 | [logger_beaker] | |
|
484 | level = DEBUG | |
|
485 | handlers = | |
|
486 | qualname = beaker.container | |
|
487 | propagate = 1 | |
|
488 | ||
|
489 | [logger_templates] | |
|
490 | level = INFO | |
|
491 | handlers = | |
|
492 | qualname = pylons.templating | |
|
493 | propagate = 1 | |
|
494 | ||
|
495 | [logger_rhodecode] | |
|
496 | level = DEBUG | |
|
497 | handlers = | |
|
498 | qualname = rhodecode | |
|
499 | propagate = 1 | |
|
500 | ||
|
501 | [logger_sqlalchemy] | |
|
502 | level = INFO | |
|
503 | handlers = console_sql | |
|
504 | qualname = sqlalchemy.engine | |
|
505 | propagate = 0 | |
|
506 | ||
|
507 | [logger_whoosh_indexer] | |
|
508 | level = DEBUG | |
|
509 | handlers = | |
|
510 | qualname = whoosh_indexer | |
|
511 | propagate = 1 | |
|
512 | <%text> | |
|
513 | ############## | |
|
514 | ## HANDLERS ## | |
|
515 | ############## | |
|
516 | </%text> | |
|
517 | [handler_console] | |
|
518 | class = StreamHandler | |
|
519 | args = (sys.stderr,) | |
|
520 | level = INFO | |
|
521 | formatter = generic | |
|
522 | ||
|
523 | [handler_console_sql] | |
|
524 | class = StreamHandler | |
|
525 | args = (sys.stderr,) | |
|
526 | level = WARN | |
|
527 | formatter = generic | |
|
528 | <%text> | |
|
529 | ################ | |
|
530 | ## FORMATTERS ## | |
|
531 | ################ | |
|
532 | </%text> | |
|
533 | [formatter_generic] | |
|
534 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
|
535 | datefmt = %Y-%m-%d %H:%M:%S | |
|
536 | ||
|
537 | [formatter_color_formatter] | |
|
538 | class=rhodecode.lib.colored_formatter.ColorFormatter | |
|
539 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
|
540 | datefmt = %Y-%m-%d %H:%M:%S | |
|
541 | ||
|
542 | [formatter_color_formatter_sql] | |
|
543 | class=rhodecode.lib.colored_formatter.ColorFormatterSql | |
|
544 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
|
545 | datefmt = %Y-%m-%d %H:%M:%S |
@@ -154,8 +154,9 b' setup(' | |||
|
154 | 154 | paster_plugins=['PasteScript', 'Pylons'], |
|
155 | 155 | entry_points=""" |
|
156 | 156 | [console_scripts] |
|
157 | rhodecode-api = rhodecode.bin.rhodecode_api:main | |
|
158 | rhodecode-gist = rhodecode.bin.rhodecode_gist:main | |
|
157 | rhodecode-api = rhodecode.bin.rhodecode_api:main | |
|
158 | rhodecode-gist = rhodecode.bin.rhodecode_gist:main | |
|
159 | rhodecode-config = rhodecode.bin.rhodecode_config:main | |
|
159 | 160 | |
|
160 | 161 | [paste.app_factory] |
|
161 | 162 | main = rhodecode.config.middleware:make_app |
General Comments 0
You need to be logged in to leave comments.
Login now