##// END OF EJS Templates
Implemented #661 Add option to include diff in RSS feed...
marcink -
r3028:30a22640 beta
parent child Browse files
Show More
@@ -1,425 +1,432 b''
1 1 ################################################################################
2 2 ################################################################################
3 3 # RhodeCode - Pylons environment configuration #
4 4 # #
5 5 # The %(here)s variable will be replaced with the parent directory of this file#
6 6 ################################################################################
7 7
8 8 [DEFAULT]
9 9 debug = true
10 10 pdebug = false
11 11 ################################################################################
12 12 ## Uncomment and replace with the address which should receive ##
13 13 ## any error reports after application crash ##
14 14 ## Additionally those settings will be used by RhodeCode mailing system ##
15 15 ################################################################################
16 16 #email_to = admin@localhost
17 17 #error_email_from = paste_error@localhost
18 18 #app_email_from = rhodecode-noreply@localhost
19 19 #error_message =
20 20 #email_prefix = [RhodeCode]
21 21
22 22 #smtp_server = mail.server.com
23 23 #smtp_username =
24 24 #smtp_password =
25 25 #smtp_port =
26 26 #smtp_use_tls = false
27 27 #smtp_use_ssl = true
28 28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
29 29 #smtp_auth =
30 30
31 31 [server:main]
32 32 ##nr of threads to spawn
33 33 #threadpool_workers = 5
34 34
35 35 ##max request before thread respawn
36 36 #threadpool_max_requests = 10
37 37
38 38 ##option to use threads of process
39 39 #use_threadpool = true
40 40
41 41 #use = egg:Paste#http
42 42 use = egg:waitress#main
43 43 host = 0.0.0.0
44 44 port = 5000
45 45
46 46 [filter:proxy-prefix]
47 47 # prefix middleware for rc
48 48 use = egg:PasteDeploy#prefix
49 49 prefix = /<your-prefix>
50 50
51 51 [app:main]
52 52 use = egg:rhodecode
53 53 #filter-with = proxy-prefix
54 54 full_stack = true
55 55 static_files = true
56 56 # Optional Languages
57 57 # en, fr, ja, pt_BR, zh_CN, zh_TW
58 58 lang = en
59 59 cache_dir = %(here)s/data
60 60 index_dir = %(here)s/data/index
61 61 app_instance_uuid = rc-develop
62 62 cut_off_limit = 256000
63 63 vcs_full_cache = True
64 64 force_https = false
65 65 commit_parse_limit = 25
66 66 use_gravatar = true
67 67
68 ## RSS feed options
69
70 rss_cut_off_limit = 256000
71 rss_items_per_page = 10
72 rss_include_diff = false
73
74
68 75 ## alternative_gravatar_url allows you to use your own avatar server application
69 76 ## the following parts of the URL will be replaced
70 77 ## {email} user email
71 78 ## {md5email} md5 hash of the user email (like at gravatar.com)
72 79 ## {size} size of the image that is expected from the server application
73 80 ## {scheme} http/https from RhodeCode server
74 81 ## {netloc} network location from RhodeCode server
75 82 #alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
76 83 #alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
77 84
78 85 container_auth_enabled = false
79 86 proxypass_auth_enabled = false
80 87 ## default encoding used to convert from and to unicode
81 88 ## can be also a comma seperated list of encoding in case of mixed encodings
82 89 default_encoding = utf8
83 90
84 91 ## overwrite schema of clone url
85 92 ## available vars:
86 93 ## scheme - http/https
87 94 ## user - current user
88 95 ## pass - password
89 96 ## netloc - network location
90 97 ## path - usually repo_name
91 98
92 99 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
93 100
94 101 ## issue tracking mapping for commits messages
95 102 ## comment out issue_pat, issue_server, issue_prefix to enable
96 103
97 104 ## pattern to get the issues from commit messages
98 105 ## default one used here is #<numbers> with a regex passive group for `#`
99 106 ## {id} will be all groups matched from this pattern
100 107
101 108 issue_pat = (?:\s*#)(\d+)
102 109
103 110 ## server url to the issue, each {id} will be replaced with match
104 111 ## fetched from the regex and {repo} is replaced with full repository name
105 112 ## including groups {repo_name} is replaced with just name of repo
106 113
107 114 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
108 115
109 116 ## prefix to add to link to indicate it's an url
110 117 ## #314 will be replaced by <issue_prefix><id>
111 118
112 119 issue_prefix = #
113 120
114 121 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
115 122 ## multiple patterns, to other issues server, wiki or others
116 123 ## below an example how to create a wiki pattern
117 124 # #wiki-some-id -> https://mywiki.com/some-id
118 125
119 126 #issue_pat_wiki = (?:wiki-)(.+)
120 127 #issue_server_link_wiki = https://mywiki.com/{id}
121 128 #issue_prefix_wiki = WIKI-
122 129
123 130
124 131 ## instance-id prefix
125 132 ## a prefix key for this instance used for cache invalidation when running
126 133 ## multiple instances of rhodecode, make sure it's globally unique for
127 134 ## all running rhodecode instances. Leave empty if you don't use it
128 135 instance_id =
129 136
130 137 ## alternative return HTTP header for failed authentication. Default HTTP
131 138 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
132 139 ## handling that. Set this variable to 403 to return HTTPForbidden
133 140 auth_ret_code =
134 141
135 142 ####################################
136 143 ### CELERY CONFIG ####
137 144 ####################################
138 145 use_celery = false
139 146 broker.host = localhost
140 147 broker.vhost = rabbitmqhost
141 148 broker.port = 5672
142 149 broker.user = rabbitmq
143 150 broker.password = qweqwe
144 151
145 152 celery.imports = rhodecode.lib.celerylib.tasks
146 153
147 154 celery.result.backend = amqp
148 155 celery.result.dburi = amqp://
149 156 celery.result.serialier = json
150 157
151 158 #celery.send.task.error.emails = true
152 159 #celery.amqp.task.result.expires = 18000
153 160
154 161 celeryd.concurrency = 2
155 162 #celeryd.log.file = celeryd.log
156 163 celeryd.log.level = debug
157 164 celeryd.max.tasks.per.child = 1
158 165
159 166 #tasks will never be sent to the queue, but executed locally instead.
160 167 celery.always.eager = false
161 168
162 169 ####################################
163 170 ### BEAKER CACHE ####
164 171 ####################################
165 172 beaker.cache.data_dir=%(here)s/data/cache/data
166 173 beaker.cache.lock_dir=%(here)s/data/cache/lock
167 174
168 175 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
169 176
170 177 beaker.cache.super_short_term.type=memory
171 178 beaker.cache.super_short_term.expire=10
172 179 beaker.cache.super_short_term.key_length = 256
173 180
174 181 beaker.cache.short_term.type=memory
175 182 beaker.cache.short_term.expire=60
176 183 beaker.cache.short_term.key_length = 256
177 184
178 185 beaker.cache.long_term.type=memory
179 186 beaker.cache.long_term.expire=36000
180 187 beaker.cache.long_term.key_length = 256
181 188
182 189 beaker.cache.sql_cache_short.type=memory
183 190 beaker.cache.sql_cache_short.expire=10
184 191 beaker.cache.sql_cache_short.key_length = 256
185 192
186 193 beaker.cache.sql_cache_med.type=memory
187 194 beaker.cache.sql_cache_med.expire=360
188 195 beaker.cache.sql_cache_med.key_length = 256
189 196
190 197 beaker.cache.sql_cache_long.type=file
191 198 beaker.cache.sql_cache_long.expire=3600
192 199 beaker.cache.sql_cache_long.key_length = 256
193 200
194 201 ####################################
195 202 ### BEAKER SESSION ####
196 203 ####################################
197 204 ## Type of storage used for the session, current types are
198 205 ## dbm, file, memcached, database, and memory.
199 206 ## The storage uses the Container API
200 207 ## that is also used by the cache system.
201 208
202 209 ## db session ##
203 210 #beaker.session.type = ext:database
204 211 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
205 212 #beaker.session.table_name = db_session
206 213
207 214 ## encrypted cookie client side session, good for many instances ##
208 215 #beaker.session.type = cookie
209 216
210 217 ## file based cookies (default) ##
211 218 #beaker.session.type = file
212 219
213 220
214 221 beaker.session.key = rhodecode
215 222 ## secure cookie requires AES python libraries ##
216 223 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
217 224 #beaker.session.validate_key = 9712sds2212c--zxc123
218 225 ## sets session as invalid if it haven't been accessed for given amount of time
219 226 beaker.session.timeout = 2592000
220 227 beaker.session.httponly = true
221 228 #beaker.session.cookie_path = /<your-prefix>
222 229
223 230 ## uncomment for https secure cookie ##
224 231 beaker.session.secure = false
225 232
226 233 ## auto save the session to not to use .save() ##
227 234 beaker.session.auto = False
228 235
229 236 ## default cookie expiration time in seconds `true` expire at browser close ##
230 237 #beaker.session.cookie_expires = 3600
231 238
232 239
233 240 ############################
234 241 ## ERROR HANDLING SYSTEMS ##
235 242 ############################
236 243
237 244 ####################
238 245 ### [errormator] ###
239 246 ####################
240 247
241 248 # Errormator is tailored to work with RhodeCode, see
242 249 # http://errormator.com for details how to obtain an account
243 250 # you must install python package `errormator_client` to make it work
244 251
245 252 # errormator enabled
246 253 errormator = true
247 254
248 255 errormator.server_url = https://api.errormator.com
249 256 errormator.api_key = YOUR_API_KEY
250 257
251 258 # TWEAK AMOUNT OF INFO SENT HERE
252 259
253 260 # enables 404 error logging (default False)
254 261 errormator.report_404 = false
255 262
256 263 # time in seconds after request is considered being slow (default 1)
257 264 errormator.slow_request_time = 1
258 265
259 266 # record slow requests in application
260 267 # (needs to be enabled for slow datastore recording and time tracking)
261 268 errormator.slow_requests = true
262 269
263 270 # enable hooking to application loggers
264 271 # errormator.logging = true
265 272
266 273 # minimum log level for log capture
267 274 # errormator.logging.level = WARNING
268 275
269 276 # send logs only from erroneous/slow requests
270 277 # (saves API quota for intensive logging)
271 278 errormator.logging_on_error = false
272 279
273 280 # list of additonal keywords that should be grabbed from environ object
274 281 # can be string with comma separated list of words in lowercase
275 282 # (by default client will always send following info:
276 283 # 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
277 284 # start with HTTP* this list be extended with additional keywords here
278 285 errormator.environ_keys_whitelist =
279 286
280 287
281 288 # list of keywords that should be blanked from request object
282 289 # can be string with comma separated list of words in lowercase
283 290 # (by default client will always blank keys that contain following words
284 291 # 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
285 292 # this list be extended with additional keywords set here
286 293 errormator.request_keys_blacklist =
287 294
288 295
289 296 # list of namespaces that should be ignores when gathering log entries
290 297 # can be string with comma separated list of namespaces
291 298 # (by default the client ignores own entries: errormator_client.client)
292 299 errormator.log_namespace_blacklist =
293 300
294 301
295 302 ################
296 303 ### [sentry] ###
297 304 ################
298 305
299 306 # sentry is a alternative open source error aggregator
300 307 # you must install python packages `sentry` and `raven` to enable
301 308
302 309 sentry.dsn = YOUR_DNS
303 310 sentry.servers =
304 311 sentry.name =
305 312 sentry.key =
306 313 sentry.public_key =
307 314 sentry.secret_key =
308 315 sentry.project =
309 316 sentry.site =
310 317 sentry.include_paths =
311 318 sentry.exclude_paths =
312 319
313 320
314 321 ################################################################################
315 322 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
316 323 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
317 324 ## execute malicious code after an exception is raised. ##
318 325 ################################################################################
319 326 #set debug = false
320 327
321 328 ##################################
322 329 ### LOGVIEW CONFIG ###
323 330 ##################################
324 331 logview.sqlalchemy = #faa
325 332 logview.pylons.templating = #bfb
326 333 logview.pylons.util = #eee
327 334
328 335 #########################################################
329 336 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
330 337 #########################################################
331 338 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
332 339 sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
333 340 sqlalchemy.db1.echo = false
334 341 sqlalchemy.db1.pool_recycle = 3600
335 342 sqlalchemy.db1.convert_unicode = true
336 343
337 344 ################################
338 345 ### LOGGING CONFIGURATION ####
339 346 ################################
340 347 [loggers]
341 348 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
342 349
343 350 [handlers]
344 351 keys = console, console_sql
345 352
346 353 [formatters]
347 354 keys = generic, color_formatter, color_formatter_sql
348 355
349 356 #############
350 357 ## LOGGERS ##
351 358 #############
352 359 [logger_root]
353 360 level = NOTSET
354 361 handlers = console
355 362
356 363 [logger_routes]
357 364 level = DEBUG
358 365 handlers =
359 366 qualname = routes.middleware
360 367 # "level = DEBUG" logs the route matched and routing variables.
361 368 propagate = 1
362 369
363 370 [logger_beaker]
364 371 level = DEBUG
365 372 handlers =
366 373 qualname = beaker.container
367 374 propagate = 1
368 375
369 376 [logger_templates]
370 377 level = INFO
371 378 handlers =
372 379 qualname = pylons.templating
373 380 propagate = 1
374 381
375 382 [logger_rhodecode]
376 383 level = DEBUG
377 384 handlers =
378 385 qualname = rhodecode
379 386 propagate = 1
380 387
381 388 [logger_sqlalchemy]
382 389 level = INFO
383 390 handlers = console_sql
384 391 qualname = sqlalchemy.engine
385 392 propagate = 0
386 393
387 394 [logger_whoosh_indexer]
388 395 level = DEBUG
389 396 handlers =
390 397 qualname = whoosh_indexer
391 398 propagate = 1
392 399
393 400 ##############
394 401 ## HANDLERS ##
395 402 ##############
396 403
397 404 [handler_console]
398 405 class = StreamHandler
399 406 args = (sys.stderr,)
400 407 level = DEBUG
401 408 formatter = color_formatter
402 409
403 410 [handler_console_sql]
404 411 class = StreamHandler
405 412 args = (sys.stderr,)
406 413 level = DEBUG
407 414 formatter = color_formatter_sql
408 415
409 416 ################
410 417 ## FORMATTERS ##
411 418 ################
412 419
413 420 [formatter_generic]
414 421 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
415 422 datefmt = %Y-%m-%d %H:%M:%S
416 423
417 424 [formatter_color_formatter]
418 425 class=rhodecode.lib.colored_formatter.ColorFormatter
419 426 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
420 427 datefmt = %Y-%m-%d %H:%M:%S
421 428
422 429 [formatter_color_formatter_sql]
423 430 class=rhodecode.lib.colored_formatter.ColorFormatterSql
424 431 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
425 432 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,425 +1,432 b''
1 1 ################################################################################
2 2 ################################################################################
3 3 # RhodeCode - Pylons environment configuration #
4 4 # #
5 5 # The %(here)s variable will be replaced with the parent directory of this file#
6 6 ################################################################################
7 7
8 8 [DEFAULT]
9 9 debug = true
10 10 pdebug = false
11 11 ################################################################################
12 12 ## Uncomment and replace with the address which should receive ##
13 13 ## any error reports after application crash ##
14 14 ## Additionally those settings will be used by RhodeCode mailing system ##
15 15 ################################################################################
16 16 #email_to = admin@localhost
17 17 #error_email_from = paste_error@localhost
18 18 #app_email_from = rhodecode-noreply@localhost
19 19 #error_message =
20 20 #email_prefix = [RhodeCode]
21 21
22 22 #smtp_server = mail.server.com
23 23 #smtp_username =
24 24 #smtp_password =
25 25 #smtp_port =
26 26 #smtp_use_tls = false
27 27 #smtp_use_ssl = true
28 28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
29 29 #smtp_auth =
30 30
31 31 [server:main]
32 32 ##nr of threads to spawn
33 33 #threadpool_workers = 5
34 34
35 35 ##max request before thread respawn
36 36 #threadpool_max_requests = 10
37 37
38 38 ##option to use threads of process
39 39 #use_threadpool = true
40 40
41 41 #use = egg:Paste#http
42 42 use = egg:waitress#main
43 43 host = 127.0.0.1
44 44 port = 8001
45 45
46 46 [filter:proxy-prefix]
47 47 # prefix middleware for rc
48 48 use = egg:PasteDeploy#prefix
49 49 prefix = /<your-prefix>
50 50
51 51 [app:main]
52 52 use = egg:rhodecode
53 53 #filter-with = proxy-prefix
54 54 full_stack = true
55 55 static_files = true
56 56 # Optional Languages
57 57 # en, fr, ja, pt_BR, zh_CN, zh_TW
58 58 lang = en
59 59 cache_dir = %(here)s/data
60 60 index_dir = %(here)s/data/index
61 61 app_instance_uuid = rc-production
62 62 cut_off_limit = 256000
63 63 vcs_full_cache = True
64 64 force_https = false
65 65 commit_parse_limit = 50
66 66 use_gravatar = true
67 67
68 ## RSS feed options
69
70 rss_cut_off_limit = 256000
71 rss_items_per_page = 10
72 rss_include_diff = false
73
74
68 75 ## alternative_gravatar_url allows you to use your own avatar server application
69 76 ## the following parts of the URL will be replaced
70 77 ## {email} user email
71 78 ## {md5email} md5 hash of the user email (like at gravatar.com)
72 79 ## {size} size of the image that is expected from the server application
73 80 ## {scheme} http/https from RhodeCode server
74 81 ## {netloc} network location from RhodeCode server
75 82 #alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
76 83 #alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
77 84
78 85 container_auth_enabled = false
79 86 proxypass_auth_enabled = false
80 87 ## default encoding used to convert from and to unicode
81 88 ## can be also a comma seperated list of encoding in case of mixed encodings
82 89 default_encoding = utf8
83 90
84 91 ## overwrite schema of clone url
85 92 ## available vars:
86 93 ## scheme - http/https
87 94 ## user - current user
88 95 ## pass - password
89 96 ## netloc - network location
90 97 ## path - usually repo_name
91 98
92 99 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
93 100
94 101 ## issue tracking mapping for commits messages
95 102 ## comment out issue_pat, issue_server, issue_prefix to enable
96 103
97 104 ## pattern to get the issues from commit messages
98 105 ## default one used here is #<numbers> with a regex passive group for `#`
99 106 ## {id} will be all groups matched from this pattern
100 107
101 108 issue_pat = (?:\s*#)(\d+)
102 109
103 110 ## server url to the issue, each {id} will be replaced with match
104 111 ## fetched from the regex and {repo} is replaced with full repository name
105 112 ## including groups {repo_name} is replaced with just name of repo
106 113
107 114 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
108 115
109 116 ## prefix to add to link to indicate it's an url
110 117 ## #314 will be replaced by <issue_prefix><id>
111 118
112 119 issue_prefix = #
113 120
114 121 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
115 122 ## multiple patterns, to other issues server, wiki or others
116 123 ## below an example how to create a wiki pattern
117 124 # #wiki-some-id -> https://mywiki.com/some-id
118 125
119 126 #issue_pat_wiki = (?:wiki-)(.+)
120 127 #issue_server_link_wiki = https://mywiki.com/{id}
121 128 #issue_prefix_wiki = WIKI-
122 129
123 130
124 131 ## instance-id prefix
125 132 ## a prefix key for this instance used for cache invalidation when running
126 133 ## multiple instances of rhodecode, make sure it's globally unique for
127 134 ## all running rhodecode instances. Leave empty if you don't use it
128 135 instance_id =
129 136
130 137 ## alternative return HTTP header for failed authentication. Default HTTP
131 138 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
132 139 ## handling that. Set this variable to 403 to return HTTPForbidden
133 140 auth_ret_code =
134 141
135 142 ####################################
136 143 ### CELERY CONFIG ####
137 144 ####################################
138 145 use_celery = false
139 146 broker.host = localhost
140 147 broker.vhost = rabbitmqhost
141 148 broker.port = 5672
142 149 broker.user = rabbitmq
143 150 broker.password = qweqwe
144 151
145 152 celery.imports = rhodecode.lib.celerylib.tasks
146 153
147 154 celery.result.backend = amqp
148 155 celery.result.dburi = amqp://
149 156 celery.result.serialier = json
150 157
151 158 #celery.send.task.error.emails = true
152 159 #celery.amqp.task.result.expires = 18000
153 160
154 161 celeryd.concurrency = 2
155 162 #celeryd.log.file = celeryd.log
156 163 celeryd.log.level = debug
157 164 celeryd.max.tasks.per.child = 1
158 165
159 166 #tasks will never be sent to the queue, but executed locally instead.
160 167 celery.always.eager = false
161 168
162 169 ####################################
163 170 ### BEAKER CACHE ####
164 171 ####################################
165 172 beaker.cache.data_dir=%(here)s/data/cache/data
166 173 beaker.cache.lock_dir=%(here)s/data/cache/lock
167 174
168 175 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
169 176
170 177 beaker.cache.super_short_term.type=memory
171 178 beaker.cache.super_short_term.expire=10
172 179 beaker.cache.super_short_term.key_length = 256
173 180
174 181 beaker.cache.short_term.type=memory
175 182 beaker.cache.short_term.expire=60
176 183 beaker.cache.short_term.key_length = 256
177 184
178 185 beaker.cache.long_term.type=memory
179 186 beaker.cache.long_term.expire=36000
180 187 beaker.cache.long_term.key_length = 256
181 188
182 189 beaker.cache.sql_cache_short.type=memory
183 190 beaker.cache.sql_cache_short.expire=10
184 191 beaker.cache.sql_cache_short.key_length = 256
185 192
186 193 beaker.cache.sql_cache_med.type=memory
187 194 beaker.cache.sql_cache_med.expire=360
188 195 beaker.cache.sql_cache_med.key_length = 256
189 196
190 197 beaker.cache.sql_cache_long.type=file
191 198 beaker.cache.sql_cache_long.expire=3600
192 199 beaker.cache.sql_cache_long.key_length = 256
193 200
194 201 ####################################
195 202 ### BEAKER SESSION ####
196 203 ####################################
197 204 ## Type of storage used for the session, current types are
198 205 ## dbm, file, memcached, database, and memory.
199 206 ## The storage uses the Container API
200 207 ## that is also used by the cache system.
201 208
202 209 ## db session ##
203 210 #beaker.session.type = ext:database
204 211 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
205 212 #beaker.session.table_name = db_session
206 213
207 214 ## encrypted cookie client side session, good for many instances ##
208 215 #beaker.session.type = cookie
209 216
210 217 ## file based cookies (default) ##
211 218 #beaker.session.type = file
212 219
213 220
214 221 beaker.session.key = rhodecode
215 222 ## secure cookie requires AES python libraries ##
216 223 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
217 224 #beaker.session.validate_key = 9712sds2212c--zxc123
218 225 ## sets session as invalid if it haven't been accessed for given amount of time
219 226 beaker.session.timeout = 2592000
220 227 beaker.session.httponly = true
221 228 #beaker.session.cookie_path = /<your-prefix>
222 229
223 230 ## uncomment for https secure cookie ##
224 231 beaker.session.secure = false
225 232
226 233 ## auto save the session to not to use .save() ##
227 234 beaker.session.auto = False
228 235
229 236 ## default cookie expiration time in seconds `true` expire at browser close ##
230 237 #beaker.session.cookie_expires = 3600
231 238
232 239
233 240 ############################
234 241 ## ERROR HANDLING SYSTEMS ##
235 242 ############################
236 243
237 244 ####################
238 245 ### [errormator] ###
239 246 ####################
240 247
241 248 # Errormator is tailored to work with RhodeCode, see
242 249 # http://errormator.com for details how to obtain an account
243 250 # you must install python package `errormator_client` to make it work
244 251
245 252 # errormator enabled
246 253 errormator = true
247 254
248 255 errormator.server_url = https://api.errormator.com
249 256 errormator.api_key = YOUR_API_KEY
250 257
251 258 # TWEAK AMOUNT OF INFO SENT HERE
252 259
253 260 # enables 404 error logging (default False)
254 261 errormator.report_404 = false
255 262
256 263 # time in seconds after request is considered being slow (default 1)
257 264 errormator.slow_request_time = 1
258 265
259 266 # record slow requests in application
260 267 # (needs to be enabled for slow datastore recording and time tracking)
261 268 errormator.slow_requests = true
262 269
263 270 # enable hooking to application loggers
264 271 # errormator.logging = true
265 272
266 273 # minimum log level for log capture
267 274 # errormator.logging.level = WARNING
268 275
269 276 # send logs only from erroneous/slow requests
270 277 # (saves API quota for intensive logging)
271 278 errormator.logging_on_error = false
272 279
273 280 # list of additonal keywords that should be grabbed from environ object
274 281 # can be string with comma separated list of words in lowercase
275 282 # (by default client will always send following info:
276 283 # 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
277 284 # start with HTTP* this list be extended with additional keywords here
278 285 errormator.environ_keys_whitelist =
279 286
280 287
281 288 # list of keywords that should be blanked from request object
282 289 # can be string with comma separated list of words in lowercase
283 290 # (by default client will always blank keys that contain following words
284 291 # 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
285 292 # this list be extended with additional keywords set here
286 293 errormator.request_keys_blacklist =
287 294
288 295
289 296 # list of namespaces that should be ignores when gathering log entries
290 297 # can be string with comma separated list of namespaces
291 298 # (by default the client ignores own entries: errormator_client.client)
292 299 errormator.log_namespace_blacklist =
293 300
294 301
295 302 ################
296 303 ### [sentry] ###
297 304 ################
298 305
299 306 # sentry is a alternative open source error aggregator
300 307 # you must install python packages `sentry` and `raven` to enable
301 308
302 309 sentry.dsn = YOUR_DNS
303 310 sentry.servers =
304 311 sentry.name =
305 312 sentry.key =
306 313 sentry.public_key =
307 314 sentry.secret_key =
308 315 sentry.project =
309 316 sentry.site =
310 317 sentry.include_paths =
311 318 sentry.exclude_paths =
312 319
313 320
314 321 ################################################################################
315 322 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
316 323 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
317 324 ## execute malicious code after an exception is raised. ##
318 325 ################################################################################
319 326 set debug = false
320 327
321 328 ##################################
322 329 ### LOGVIEW CONFIG ###
323 330 ##################################
324 331 logview.sqlalchemy = #faa
325 332 logview.pylons.templating = #bfb
326 333 logview.pylons.util = #eee
327 334
328 335 #########################################################
329 336 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
330 337 #########################################################
331 338 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
332 339 sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
333 340 sqlalchemy.db1.echo = false
334 341 sqlalchemy.db1.pool_recycle = 3600
335 342 sqlalchemy.db1.convert_unicode = true
336 343
337 344 ################################
338 345 ### LOGGING CONFIGURATION ####
339 346 ################################
340 347 [loggers]
341 348 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
342 349
343 350 [handlers]
344 351 keys = console, console_sql
345 352
346 353 [formatters]
347 354 keys = generic, color_formatter, color_formatter_sql
348 355
349 356 #############
350 357 ## LOGGERS ##
351 358 #############
352 359 [logger_root]
353 360 level = NOTSET
354 361 handlers = console
355 362
356 363 [logger_routes]
357 364 level = DEBUG
358 365 handlers =
359 366 qualname = routes.middleware
360 367 # "level = DEBUG" logs the route matched and routing variables.
361 368 propagate = 1
362 369
363 370 [logger_beaker]
364 371 level = DEBUG
365 372 handlers =
366 373 qualname = beaker.container
367 374 propagate = 1
368 375
369 376 [logger_templates]
370 377 level = INFO
371 378 handlers =
372 379 qualname = pylons.templating
373 380 propagate = 1
374 381
375 382 [logger_rhodecode]
376 383 level = DEBUG
377 384 handlers =
378 385 qualname = rhodecode
379 386 propagate = 1
380 387
381 388 [logger_sqlalchemy]
382 389 level = INFO
383 390 handlers = console_sql
384 391 qualname = sqlalchemy.engine
385 392 propagate = 0
386 393
387 394 [logger_whoosh_indexer]
388 395 level = DEBUG
389 396 handlers =
390 397 qualname = whoosh_indexer
391 398 propagate = 1
392 399
393 400 ##############
394 401 ## HANDLERS ##
395 402 ##############
396 403
397 404 [handler_console]
398 405 class = StreamHandler
399 406 args = (sys.stderr,)
400 407 level = INFO
401 408 formatter = generic
402 409
403 410 [handler_console_sql]
404 411 class = StreamHandler
405 412 args = (sys.stderr,)
406 413 level = WARN
407 414 formatter = generic
408 415
409 416 ################
410 417 ## FORMATTERS ##
411 418 ################
412 419
413 420 [formatter_generic]
414 421 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
415 422 datefmt = %Y-%m-%d %H:%M:%S
416 423
417 424 [formatter_color_formatter]
418 425 class=rhodecode.lib.colored_formatter.ColorFormatter
419 426 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
420 427 datefmt = %Y-%m-%d %H:%M:%S
421 428
422 429 [formatter_color_formatter_sql]
423 430 class=rhodecode.lib.colored_formatter.ColorFormatterSql
424 431 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
425 432 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,435 +1,442 b''
1 1 ################################################################################
2 2 ################################################################################
3 3 # RhodeCode - Pylons environment configuration #
4 4 # #
5 5 # The %(here)s variable will be replaced with the parent directory of this file#
6 6 ################################################################################
7 7
8 8 [DEFAULT]
9 9 debug = true
10 10 pdebug = false
11 11 ################################################################################
12 12 ## Uncomment and replace with the address which should receive ##
13 13 ## any error reports after application crash ##
14 14 ## Additionally those settings will be used by RhodeCode mailing system ##
15 15 ################################################################################
16 16 #email_to = admin@localhost
17 17 #error_email_from = paste_error@localhost
18 18 #app_email_from = rhodecode-noreply@localhost
19 19 #error_message =
20 20 #email_prefix = [RhodeCode]
21 21
22 22 #smtp_server = mail.server.com
23 23 #smtp_username =
24 24 #smtp_password =
25 25 #smtp_port =
26 26 #smtp_use_tls = false
27 27 #smtp_use_ssl = true
28 28 # Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
29 29 #smtp_auth =
30 30
31 31 [server:main]
32 32 ##nr of threads to spawn
33 33 #threadpool_workers = 5
34 34
35 35 ##max request before thread respawn
36 36 #threadpool_max_requests = 10
37 37
38 38 ##option to use threads of process
39 39 #use_threadpool = true
40 40
41 41 #use = egg:Paste#http
42 42 use = egg:waitress#main
43 43 host = 127.0.0.1
44 44 port = 5000
45 45
46 46 [filter:proxy-prefix]
47 47 # prefix middleware for rc
48 48 use = egg:PasteDeploy#prefix
49 49 prefix = /<your-prefix>
50 50
51 51 [app:main]
52 52 use = egg:rhodecode
53 53 #filter-with = proxy-prefix
54 54 full_stack = true
55 55 static_files = true
56 56 # Optional Languages
57 57 # en, fr, ja, pt_BR, zh_CN, zh_TW
58 58 lang = en
59 59 cache_dir = %(here)s/data
60 60 index_dir = %(here)s/data/index
61 61 app_instance_uuid = ${app_instance_uuid}
62 62 cut_off_limit = 256000
63 63 vcs_full_cache = True
64 64 force_https = false
65 65 commit_parse_limit = 50
66 66 use_gravatar = true
67 67
68 ## RSS feed options
69
70 rss_cut_off_limit = 256000
71 rss_items_per_page = 10
72 rss_include_diff = false
73
74
68 75 ## alternative_gravatar_url allows you to use your own avatar server application
69 76 ## the following parts of the URL will be replaced
70 77 ## {email} user email
71 78 ## {md5email} md5 hash of the user email (like at gravatar.com)
72 79 ## {size} size of the image that is expected from the server application
73 80 ## {scheme} http/https from RhodeCode server
74 81 ## {netloc} network location from RhodeCode server
75 82 #alternative_gravatar_url = http://myavatarserver.com/getbyemail/{email}/{size}
76 83 #alternative_gravatar_url = http://myavatarserver.com/getbymd5/{md5email}?s={size}
77 84
78 85 container_auth_enabled = false
79 86 proxypass_auth_enabled = false
80 87 ## default encoding used to convert from and to unicode
81 88 ## can be also a comma seperated list of encoding in case of mixed encodings
82 89 default_encoding = utf8
83 90
84 91 ## overwrite schema of clone url
85 92 ## available vars:
86 93 ## scheme - http/https
87 94 ## user - current user
88 95 ## pass - password
89 96 ## netloc - network location
90 97 ## path - usually repo_name
91 98
92 99 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
93 100
94 101 ## issue tracking mapping for commits messages
95 102 ## comment out issue_pat, issue_server, issue_prefix to enable
96 103
97 104 ## pattern to get the issues from commit messages
98 105 ## default one used here is #<numbers> with a regex passive group for `#`
99 106 ## {id} will be all groups matched from this pattern
100 107
101 108 issue_pat = (?:\s*#)(\d+)
102 109
103 110 ## server url to the issue, each {id} will be replaced with match
104 111 ## fetched from the regex and {repo} is replaced with full repository name
105 112 ## including groups {repo_name} is replaced with just name of repo
106 113
107 114 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
108 115
109 116 ## prefix to add to link to indicate it's an url
110 117 ## #314 will be replaced by <issue_prefix><id>
111 118
112 119 issue_prefix = #
113 120
114 121 ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify
115 122 ## multiple patterns, to other issues server, wiki or others
116 123 ## below an example how to create a wiki pattern
117 124 # #wiki-some-id -> https://mywiki.com/some-id
118 125
119 126 #issue_pat_wiki = (?:wiki-)(.+)
120 127 #issue_server_link_wiki = https://mywiki.com/{id}
121 128 #issue_prefix_wiki = WIKI-
122 129
123 130
124 131 ## instance-id prefix
125 132 ## a prefix key for this instance used for cache invalidation when running
126 133 ## multiple instances of rhodecode, make sure it's globally unique for
127 134 ## all running rhodecode instances. Leave empty if you don't use it
128 135 instance_id =
129 136
130 137 ## alternative return HTTP header for failed authentication. Default HTTP
131 138 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
132 139 ## handling that. Set this variable to 403 to return HTTPForbidden
133 140 auth_ret_code =
134 141
135 142 ####################################
136 143 ### CELERY CONFIG ####
137 144 ####################################
138 145 use_celery = false
139 146 broker.host = localhost
140 147 broker.vhost = rabbitmqhost
141 148 broker.port = 5672
142 149 broker.user = rabbitmq
143 150 broker.password = qweqwe
144 151
145 152 celery.imports = rhodecode.lib.celerylib.tasks
146 153
147 154 celery.result.backend = amqp
148 155 celery.result.dburi = amqp://
149 156 celery.result.serialier = json
150 157
151 158 #celery.send.task.error.emails = true
152 159 #celery.amqp.task.result.expires = 18000
153 160
154 161 celeryd.concurrency = 2
155 162 #celeryd.log.file = celeryd.log
156 163 celeryd.log.level = debug
157 164 celeryd.max.tasks.per.child = 1
158 165
159 166 #tasks will never be sent to the queue, but executed locally instead.
160 167 celery.always.eager = false
161 168
162 169 ####################################
163 170 ### BEAKER CACHE ####
164 171 ####################################
165 172 beaker.cache.data_dir=%(here)s/data/cache/data
166 173 beaker.cache.lock_dir=%(here)s/data/cache/lock
167 174
168 175 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
169 176
170 177 beaker.cache.super_short_term.type=memory
171 178 beaker.cache.super_short_term.expire=10
172 179 beaker.cache.super_short_term.key_length = 256
173 180
174 181 beaker.cache.short_term.type=memory
175 182 beaker.cache.short_term.expire=60
176 183 beaker.cache.short_term.key_length = 256
177 184
178 185 beaker.cache.long_term.type=memory
179 186 beaker.cache.long_term.expire=36000
180 187 beaker.cache.long_term.key_length = 256
181 188
182 189 beaker.cache.sql_cache_short.type=memory
183 190 beaker.cache.sql_cache_short.expire=10
184 191 beaker.cache.sql_cache_short.key_length = 256
185 192
186 193 beaker.cache.sql_cache_med.type=memory
187 194 beaker.cache.sql_cache_med.expire=360
188 195 beaker.cache.sql_cache_med.key_length = 256
189 196
190 197 beaker.cache.sql_cache_long.type=file
191 198 beaker.cache.sql_cache_long.expire=3600
192 199 beaker.cache.sql_cache_long.key_length = 256
193 200
194 201 ####################################
195 202 ### BEAKER SESSION ####
196 203 ####################################
197 204 ## Type of storage used for the session, current types are
198 205 ## dbm, file, memcached, database, and memory.
199 206 ## The storage uses the Container API
200 207 ## that is also used by the cache system.
201 208
202 209 ## db session ##
203 210 #beaker.session.type = ext:database
204 211 #beaker.session.sa.url = postgresql://postgres:qwe@localhost/rhodecode
205 212 #beaker.session.table_name = db_session
206 213
207 214 ## encrypted cookie client side session, good for many instances ##
208 215 #beaker.session.type = cookie
209 216
210 217 ## file based cookies (default) ##
211 218 #beaker.session.type = file
212 219
213 220
214 221 beaker.session.key = rhodecode
215 222 ## secure cookie requires AES python libraries ##
216 223 #beaker.session.encrypt_key = g654dcno0-9873jhgfreyu
217 224 #beaker.session.validate_key = 9712sds2212c--zxc123
218 225 ## sets session as invalid if it haven't been accessed for given amount of time
219 226 beaker.session.timeout = 2592000
220 227 beaker.session.httponly = true
221 228 #beaker.session.cookie_path = /<your-prefix>
222 229
223 230 ## uncomment for https secure cookie ##
224 231 beaker.session.secure = false
225 232
226 233 ## auto save the session to not to use .save() ##
227 234 beaker.session.auto = False
228 235
229 236 ## default cookie expiration time in seconds `true` expire at browser close ##
230 237 #beaker.session.cookie_expires = 3600
231 238
232 239
233 240 ############################
234 241 ## ERROR HANDLING SYSTEMS ##
235 242 ############################
236 243
237 244 ####################
238 245 ### [errormator] ###
239 246 ####################
240 247
241 248 # Errormator is tailored to work with RhodeCode, see
242 249 # http://errormator.com for details how to obtain an account
243 250 # you must install python package `errormator_client` to make it work
244 251
245 252 # errormator enabled
246 253 errormator = true
247 254
248 255 errormator.server_url = https://api.errormator.com
249 256 errormator.api_key = YOUR_API_KEY
250 257
251 258 # TWEAK AMOUNT OF INFO SENT HERE
252 259
253 260 # enables 404 error logging (default False)
254 261 errormator.report_404 = false
255 262
256 263 # time in seconds after request is considered being slow (default 1)
257 264 errormator.slow_request_time = 1
258 265
259 266 # record slow requests in application
260 267 # (needs to be enabled for slow datastore recording and time tracking)
261 268 errormator.slow_requests = true
262 269
263 270 # enable hooking to application loggers
264 271 # errormator.logging = true
265 272
266 273 # minimum log level for log capture
267 274 # errormator.logging.level = WARNING
268 275
269 276 # send logs only from erroneous/slow requests
270 277 # (saves API quota for intensive logging)
271 278 errormator.logging_on_error = false
272 279
273 280 # list of additonal keywords that should be grabbed from environ object
274 281 # can be string with comma separated list of words in lowercase
275 282 # (by default client will always send following info:
276 283 # 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
277 284 # start with HTTP* this list be extended with additional keywords here
278 285 errormator.environ_keys_whitelist =
279 286
280 287
281 288 # list of keywords that should be blanked from request object
282 289 # can be string with comma separated list of words in lowercase
283 290 # (by default client will always blank keys that contain following words
284 291 # 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
285 292 # this list be extended with additional keywords set here
286 293 errormator.request_keys_blacklist =
287 294
288 295
289 296 # list of namespaces that should be ignores when gathering log entries
290 297 # can be string with comma separated list of namespaces
291 298 # (by default the client ignores own entries: errormator_client.client)
292 299 errormator.log_namespace_blacklist =
293 300
294 301
295 302 ################
296 303 ### [sentry] ###
297 304 ################
298 305
299 306 # sentry is a alternative open source error aggregator
300 307 # you must install python packages `sentry` and `raven` to enable
301 308
302 309 sentry.dsn = YOUR_DNS
303 310 sentry.servers =
304 311 sentry.name =
305 312 sentry.key =
306 313 sentry.public_key =
307 314 sentry.secret_key =
308 315 sentry.project =
309 316 sentry.site =
310 317 sentry.include_paths =
311 318 sentry.exclude_paths =
312 319
313 320
314 321 ################################################################################
315 322 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
316 323 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
317 324 ## execute malicious code after an exception is raised. ##
318 325 ################################################################################
319 326 set debug = false
320 327
321 328 ##################################
322 329 ### LOGVIEW CONFIG ###
323 330 ##################################
324 331 logview.sqlalchemy = #faa
325 332 logview.pylons.templating = #bfb
326 333 logview.pylons.util = #eee
327 334
328 335 #########################################################
329 336 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ###
330 337 #########################################################
331 338
332 339 # SQLITE [default]
333 340 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
334 341
335 342 # POSTGRESQL
336 343 # sqlalchemy.db1.url = postgresql://user:pass@localhost/rhodecode
337 344
338 345 # MySQL
339 346 # sqlalchemy.db1.url = mysql://user:pass@localhost/rhodecode
340 347
341 348 # see sqlalchemy docs for others
342 349
343 350 sqlalchemy.db1.echo = false
344 351 sqlalchemy.db1.pool_recycle = 3600
345 352 sqlalchemy.db1.convert_unicode = true
346 353
347 354 ################################
348 355 ### LOGGING CONFIGURATION ####
349 356 ################################
350 357 [loggers]
351 358 keys = root, routes, rhodecode, sqlalchemy, beaker, templates, whoosh_indexer
352 359
353 360 [handlers]
354 361 keys = console, console_sql
355 362
356 363 [formatters]
357 364 keys = generic, color_formatter, color_formatter_sql
358 365
359 366 #############
360 367 ## LOGGERS ##
361 368 #############
362 369 [logger_root]
363 370 level = NOTSET
364 371 handlers = console
365 372
366 373 [logger_routes]
367 374 level = DEBUG
368 375 handlers =
369 376 qualname = routes.middleware
370 377 # "level = DEBUG" logs the route matched and routing variables.
371 378 propagate = 1
372 379
373 380 [logger_beaker]
374 381 level = DEBUG
375 382 handlers =
376 383 qualname = beaker.container
377 384 propagate = 1
378 385
379 386 [logger_templates]
380 387 level = INFO
381 388 handlers =
382 389 qualname = pylons.templating
383 390 propagate = 1
384 391
385 392 [logger_rhodecode]
386 393 level = DEBUG
387 394 handlers =
388 395 qualname = rhodecode
389 396 propagate = 1
390 397
391 398 [logger_sqlalchemy]
392 399 level = INFO
393 400 handlers = console_sql
394 401 qualname = sqlalchemy.engine
395 402 propagate = 0
396 403
397 404 [logger_whoosh_indexer]
398 405 level = DEBUG
399 406 handlers =
400 407 qualname = whoosh_indexer
401 408 propagate = 1
402 409
403 410 ##############
404 411 ## HANDLERS ##
405 412 ##############
406 413
407 414 [handler_console]
408 415 class = StreamHandler
409 416 args = (sys.stderr,)
410 417 level = INFO
411 418 formatter = generic
412 419
413 420 [handler_console_sql]
414 421 class = StreamHandler
415 422 args = (sys.stderr,)
416 423 level = WARN
417 424 formatter = generic
418 425
419 426 ################
420 427 ## FORMATTERS ##
421 428 ################
422 429
423 430 [formatter_generic]
424 431 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
425 432 datefmt = %Y-%m-%d %H:%M:%S
426 433
427 434 [formatter_color_formatter]
428 435 class=rhodecode.lib.colored_formatter.ColorFormatter
429 436 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
430 437 datefmt = %Y-%m-%d %H:%M:%S
431 438
432 439 [formatter_color_formatter_sql]
433 440 class=rhodecode.lib.colored_formatter.ColorFormatterSql
434 441 format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
435 442 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,175 +1,183 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.controllers.feed
4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 6 Feed controller for rhodecode
7 7
8 8 :created_on: Apr 23, 2010
9 9 :author: marcink
10 10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
11 11 :license: GPLv3, see COPYING for more details.
12 12 """
13 13 # This program is free software: you can redistribute it and/or modify
14 14 # it under the terms of the GNU General Public License as published by
15 15 # the Free Software Foundation, either version 3 of the License, or
16 16 # (at your option) any later version.
17 17 #
18 18 # This program is distributed in the hope that it will be useful,
19 19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 21 # GNU General Public License for more details.
22 22 #
23 23 # You should have received a copy of the GNU General Public License
24 24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 25
26 26 import logging
27 27
28 28 from pylons import url, response, tmpl_context as c
29 29 from pylons.i18n.translation import _
30 30
31 31 from beaker.cache import cache_region, region_invalidate
32 32 from webhelpers.feedgenerator import Atom1Feed, Rss201rev2Feed
33 33
34 34 from rhodecode.lib import helpers as h
35 35 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
36 36 from rhodecode.lib.base import BaseRepoController
37 37 from rhodecode.lib.diffs import DiffProcessor, LimitedDiffContainer
38 38 from rhodecode.model.db import CacheInvalidation
39 from rhodecode.lib.utils2 import safe_int, str2bool
39 40
40 41 log = logging.getLogger(__name__)
41 42
42 43
43 44 class FeedController(BaseRepoController):
44 45
45 46 @LoginRequired(api_access=True)
46 47 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
47 48 'repository.admin')
48 49 def __before__(self):
49 50 super(FeedController, self).__before__()
50 51 #common values for feeds
51 52 self.description = _('Changes on %s repository')
52 53 self.title = self.title = _('%s %s feed') % (c.rhodecode_name, '%s')
53 54 self.language = 'en-us'
54 55 self.ttl = "5"
55 self.feed_nr = 20
56 import rhodecode
57 CONF = rhodecode.CONFIG
58 self.include_diff = str2bool(CONF.get('rss_include_diff', False))
59 self.feed_nr = safe_int(CONF.get('rss_items_per_page', 20))
56 60 # we need to protect from parsing huge diffs here other way
57 # we can kill the server, 32*1024 chars is a reasonable limit
58 self.feed_diff_limit = 32 * 1024
61 # we can kill the server
62 self.feed_diff_limit = safe_int(CONF.get('rss_cut_off_limit'), 32 * 1024)
59 63
60 64 def _get_title(self, cs):
61 65 return "%s" % (
62 66 h.shorter(cs.message, 160)
63 67 )
64 68
65 69 def __changes(self, cs):
66 70 changes = []
67 71 diff_processor = DiffProcessor(cs.diff(),
68 72 diff_limit=self.feed_diff_limit)
69 73 _parsed = diff_processor.prepare(inline_diff=False)
70 74 limited_diff = False
71 75 if isinstance(_parsed, LimitedDiffContainer):
72 76 limited_diff = True
73 77
74 78 for st in _parsed:
75 79 st.update({'added': st['stats'][0],
76 80 'removed': st['stats'][1]})
77 81 changes.append('\n %(operation)s %(filename)s '
78 82 '(%(added)s lines added, %(removed)s lines removed)'
79 83 % st)
80 84 if limited_diff:
81 85 changes = changes + ['\n ' +
82 86 _('Changeset was too big and was cut off...')]
83 return changes
87 return diff_processor, changes
84 88
85 89 def __get_desc(self, cs):
86 90 desc_msg = []
87 91 desc_msg.append('%s %s %s<br/>' % (h.person(cs.author),
88 92 _('commited on'),
89 93 h.fmt_date(cs.date)))
90 94 #branches, tags, bookmarks
91 95 if cs.branch:
92 96 desc_msg.append('branch: %s<br/>' % cs.branch)
93 97 if h.is_hg(c.rhodecode_repo):
94 98 for book in cs.bookmarks:
95 99 desc_msg.append('bookmark: %s<br/>' % book)
96 100 for tag in cs.tags:
97 101 desc_msg.append('tag: %s<br/>' % tag)
102 diff_processor, changes = self.__changes(cs)
98 103 # rev link
99 104 _url = url('changeset_home', repo_name=cs.repository.name,
100 105 revision=cs.raw_id, qualified=True)
101 106 desc_msg.append('changesest: <a href="%s">%s</a>' % (_url, cs.raw_id[:8]))
102 107
103 108 desc_msg.append('<pre>')
104 109 desc_msg.append(cs.message)
105 110 desc_msg.append('\n')
106 desc_msg.extend(self.__changes(cs))
111 desc_msg.extend(changes)
112 if self.include_diff:
113 desc_msg.append('\n\n')
114 desc_msg.append(diff_processor.as_raw())
107 115 desc_msg.append('</pre>')
108 116 return desc_msg
109 117
110 118 def atom(self, repo_name):
111 119 """Produce an atom-1.0 feed via feedgenerator module"""
112 120
113 121 @cache_region('long_term')
114 122 def _get_feed_from_cache(key):
115 123 feed = Atom1Feed(
116 124 title=self.title % repo_name,
117 125 link=url('summary_home', repo_name=repo_name,
118 126 qualified=True),
119 127 description=self.description % repo_name,
120 128 language=self.language,
121 129 ttl=self.ttl
122 130 )
123 131
124 132 for cs in reversed(list(c.rhodecode_repo[-self.feed_nr:])):
125 133 feed.add_item(title=self._get_title(cs),
126 134 link=url('changeset_home', repo_name=repo_name,
127 135 revision=cs.raw_id, qualified=True),
128 136 author_name=cs.author,
129 137 description=''.join(self.__get_desc(cs)),
130 138 pubdate=cs.date,
131 139 )
132 140
133 141 response.content_type = feed.mime_type
134 142 return feed.writeString('utf-8')
135 143
136 144 key = repo_name + '_ATOM'
137 145 inv = CacheInvalidation.invalidate(key)
138 146 if inv is not None:
139 147 region_invalidate(_get_feed_from_cache, None, key)
140 148 CacheInvalidation.set_valid(inv.cache_key)
141 149 return _get_feed_from_cache(key)
142 150
143 151 def rss(self, repo_name):
144 152 """Produce an rss2 feed via feedgenerator module"""
145 153
146 154 @cache_region('long_term')
147 155 def _get_feed_from_cache(key):
148 156 feed = Rss201rev2Feed(
149 157 title=self.title % repo_name,
150 158 link=url('summary_home', repo_name=repo_name,
151 159 qualified=True),
152 160 description=self.description % repo_name,
153 161 language=self.language,
154 162 ttl=self.ttl
155 163 )
156 164
157 165 for cs in reversed(list(c.rhodecode_repo[-self.feed_nr:])):
158 166 feed.add_item(title=self._get_title(cs),
159 167 link=url('changeset_home', repo_name=repo_name,
160 168 revision=cs.raw_id, qualified=True),
161 169 author_name=cs.author,
162 170 description=''.join(self.__get_desc(cs)),
163 171 pubdate=cs.date,
164 172 )
165 173
166 174 response.content_type = feed.mime_type
167 175 return feed.writeString('utf-8')
168 176
169 177 key = repo_name + '_RSS'
170 178 inv = CacheInvalidation.invalidate(key)
171 179 if inv is not None:
172 180 region_invalidate(_get_feed_from_cache, None, key)
173 181 CacheInvalidation.set_valid(inv.cache_key)
174 182 return _get_feed_from_cache(key)
175 183
General Comments 0
You need to be logged in to leave comments. Login now