##// END OF EJS Templates
user-sessions: added option to cleanup redis based sessions in user session interface.
ergo -
r3539:78388d8d default
parent child Browse files
Show More
@@ -1,737 +1,741 b''
1 1
2 2
3 3 ################################################################################
4 4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
5 5 ################################################################################
6 6
7 7 [DEFAULT]
8 8 ## Debug flag sets all loggers to debug, and enables request tracking
9 9 debug = true
10 10
11 11 ################################################################################
12 12 ## EMAIL CONFIGURATION ##
13 13 ## Uncomment and replace with the email address which should receive ##
14 14 ## any error reports after an application crash ##
15 15 ## Additionally these settings will be used by the RhodeCode mailing system ##
16 16 ################################################################################
17 17
18 18 ## prefix all emails subjects with given prefix, helps filtering out emails
19 19 #email_prefix = [RhodeCode]
20 20
21 21 ## email FROM address all mails will be sent
22 22 #app_email_from = rhodecode-noreply@localhost
23 23
24 24 #smtp_server = mail.server.com
25 25 #smtp_username =
26 26 #smtp_password =
27 27 #smtp_port =
28 28 #smtp_use_tls = false
29 29 #smtp_use_ssl = true
30 30
31 31 [server:main]
32 32 ## COMMON ##
33 33 host = 127.0.0.1
34 34 port = 5000
35 35
36 36 ###########################################################
37 37 ## WAITRESS WSGI SERVER - Recommended for Development ####
38 38 ###########################################################
39 39
40 40 use = egg:waitress#main
41 41 ## number of worker threads
42 42 threads = 5
43 43 ## MAX BODY SIZE 100GB
44 44 max_request_body_size = 107374182400
45 45 ## Use poll instead of select, fixes file descriptors limits problems.
46 46 ## May not work on old windows systems.
47 47 asyncore_use_poll = true
48 48
49 49
50 50 ##########################
51 51 ## GUNICORN WSGI SERVER ##
52 52 ##########################
53 53 ## run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
54 54
55 55 #use = egg:gunicorn#main
56 56 ## Sets the number of process workers. More workers means more concurrent connections
57 57 ## RhodeCode can handle at the same time. Each additional worker also it increases
58 58 ## memory usage as each has it's own set of caches.
59 59 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
60 60 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
61 61 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
62 62 ## when using more than 1 worker.
63 63 #workers = 2
64 64 ## process name visible in process list
65 65 #proc_name = rhodecode
66 66 ## type of worker class, one of sync, gevent
67 67 ## recommended for bigger setup is using of of other than sync one
68 68 #worker_class = gevent
69 69 ## The maximum number of simultaneous clients. Valid only for Gevent
70 70 #worker_connections = 10
71 71 ## max number of requests that worker will handle before being gracefully
72 72 ## restarted, could prevent memory leaks
73 73 #max_requests = 1000
74 74 #max_requests_jitter = 30
75 75 ## amount of time a worker can spend with handling a request before it
76 76 ## gets killed and restarted. Set to 6hrs
77 77 #timeout = 21600
78 78
79 79
80 80 ## prefix middleware for RhodeCode.
81 81 ## recommended when using proxy setup.
82 82 ## allows to set RhodeCode under a prefix in server.
83 83 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
84 84 ## And set your prefix like: `prefix = /custom_prefix`
85 85 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
86 86 ## to make your cookies only work on prefix url
87 87 [filter:proxy-prefix]
88 88 use = egg:PasteDeploy#prefix
89 89 prefix = /
90 90
91 91 [app:main]
92 92 ## The %(here)s variable will be replaced with the absolute path of parent directory
93 93 ## of this file
94 94 ## In addition ENVIRONMENT variables usage is possible, e.g
95 95 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
96 96
97 97 use = egg:rhodecode-enterprise-ce
98 98
99 99 ## enable proxy prefix middleware, defined above
100 100 #filter-with = proxy-prefix
101 101
102 102 # During development the we want to have the debug toolbar enabled
103 103 pyramid.includes =
104 104 pyramid_debugtoolbar
105 105 rhodecode.lib.middleware.request_wrapper
106 106
107 107 pyramid.reload_templates = true
108 108
109 109 debugtoolbar.hosts = 0.0.0.0/0
110 110 debugtoolbar.exclude_prefixes =
111 111 /css
112 112 /fonts
113 113 /images
114 114 /js
115 115
116 116 ## RHODECODE PLUGINS ##
117 117 rhodecode.includes =
118 118 rhodecode.api
119 119
120 120
121 121 # api prefix url
122 122 rhodecode.api.url = /_admin/api
123 123
124 124
125 125 ## END RHODECODE PLUGINS ##
126 126
127 127 ## encryption key used to encrypt social plugin tokens,
128 128 ## remote_urls with credentials etc, if not set it defaults to
129 129 ## `beaker.session.secret`
130 130 #rhodecode.encrypted_values.secret =
131 131
132 132 ## decryption strict mode (enabled by default). It controls if decryption raises
133 133 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
134 134 #rhodecode.encrypted_values.strict = false
135 135
136 136 ## Pick algorithm for encryption. Either fernet (more secure) or aes (default)
137 137 ## fernet is safer, and we strongly recommend switching to it.
138 138 ## Due to backward compatibility aes is used as default.
139 139 #rhodecode.encrypted_values.algorithm = fernet
140 140
141 141 ## return gzipped responses from RhodeCode (static files/application)
142 142 gzip_responses = false
143 143
144 144 ## auto-generate javascript routes file on startup
145 145 generate_js_files = false
146 146
147 147 ## System global default language.
148 148 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
149 149 lang = en
150 150
151 151 ## Perform a full repository scan and import on each server start.
152 152 ## Settings this to true could lead to very long startup time.
153 153 startup.import_repos = false
154 154
155 155 ## Uncomment and set this path to use archive download cache.
156 156 ## Once enabled, generated archives will be cached at this location
157 157 ## and served from the cache during subsequent requests for the same archive of
158 158 ## the repository.
159 159 #archive_cache_dir = /tmp/tarballcache
160 160
161 161 ## URL at which the application is running. This is used for Bootstrapping
162 162 ## requests in context when no web request is available. Used in ishell, or
163 163 ## SSH calls. Set this for events to receive proper url for SSH calls.
164 164 app.base_url = http://rhodecode.local
165 165
166 166 ## Unique application ID. Should be a random unique string for security.
167 167 app_instance_uuid = rc-production
168 168
169 169 ## Cut off limit for large diffs (size in bytes). If overall diff size on
170 170 ## commit, or pull request exceeds this limit this diff will be displayed
171 171 ## partially. E.g 512000 == 512Kb
172 172 cut_off_limit_diff = 512000
173 173
174 174 ## Cut off limit for large files inside diffs (size in bytes). Each individual
175 175 ## file inside diff which exceeds this limit will be displayed partially.
176 176 ## E.g 128000 == 128Kb
177 177 cut_off_limit_file = 128000
178 178
179 179 ## use cached version of vcs repositories everywhere. Recommended to be `true`
180 180 vcs_full_cache = true
181 181
182 182 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
183 183 ## Normally this is controlled by proper http flags sent from http server
184 184 force_https = false
185 185
186 186 ## use Strict-Transport-Security headers
187 187 use_htsts = false
188 188
189 189 ## git rev filter option, --all is the default filter, if you need to
190 190 ## hide all refs in changelog switch this to --branches --tags
191 191 git_rev_filter = --branches --tags
192 192
193 193 # Set to true if your repos are exposed using the dumb protocol
194 194 git_update_server_info = false
195 195
196 196 ## RSS/ATOM feed options
197 197 rss_cut_off_limit = 256000
198 198 rss_items_per_page = 10
199 199 rss_include_diff = false
200 200
201 201 ## gist URL alias, used to create nicer urls for gist. This should be an
202 202 ## url that does rewrites to _admin/gists/{gistid}.
203 203 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
204 204 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
205 205 gist_alias_url =
206 206
207 207 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
208 208 ## used for access.
209 209 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
210 210 ## came from the the logged in user who own this authentication token.
211 211 ## Additionally @TOKEN syntax can be used to bound the view to specific
212 212 ## authentication token. Such view would be only accessible when used together
213 213 ## with this authentication token
214 214 ##
215 215 ## list of all views can be found under `/_admin/permissions/auth_token_access`
216 216 ## The list should be "," separated and on a single line.
217 217 ##
218 218 ## Most common views to enable:
219 219 # RepoCommitsView:repo_commit_download
220 220 # RepoCommitsView:repo_commit_patch
221 221 # RepoCommitsView:repo_commit_raw
222 222 # RepoCommitsView:repo_commit_raw@TOKEN
223 223 # RepoFilesView:repo_files_diff
224 224 # RepoFilesView:repo_archivefile
225 225 # RepoFilesView:repo_file_raw
226 226 # GistView:*
227 227 api_access_controllers_whitelist =
228 228
229 229 ## Default encoding used to convert from and to unicode
230 230 ## can be also a comma separated list of encoding in case of mixed encodings
231 231 default_encoding = UTF-8
232 232
233 233 ## instance-id prefix
234 234 ## a prefix key for this instance used for cache invalidation when running
235 235 ## multiple instances of RhodeCode, make sure it's globally unique for
236 236 ## all running RhodeCode instances. Leave empty if you don't use it
237 237 instance_id =
238 238
239 239 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
240 240 ## of an authentication plugin also if it is disabled by it's settings.
241 241 ## This could be useful if you are unable to log in to the system due to broken
242 242 ## authentication settings. Then you can enable e.g. the internal RhodeCode auth
243 243 ## module to log in again and fix the settings.
244 244 ##
245 245 ## Available builtin plugin IDs (hash is part of the ID):
246 246 ## egg:rhodecode-enterprise-ce#rhodecode
247 247 ## egg:rhodecode-enterprise-ce#pam
248 248 ## egg:rhodecode-enterprise-ce#ldap
249 249 ## egg:rhodecode-enterprise-ce#jasig_cas
250 250 ## egg:rhodecode-enterprise-ce#headers
251 251 ## egg:rhodecode-enterprise-ce#crowd
252 252 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
253 253
254 254 ## alternative return HTTP header for failed authentication. Default HTTP
255 255 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
256 256 ## handling that causing a series of failed authentication calls.
257 257 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
258 258 ## This will be served instead of default 401 on bad authentication
259 259 auth_ret_code =
260 260
261 261 ## use special detection method when serving auth_ret_code, instead of serving
262 262 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
263 263 ## and then serve auth_ret_code to clients
264 264 auth_ret_code_detection = false
265 265
266 266 ## locking return code. When repository is locked return this HTTP code. 2XX
267 267 ## codes don't break the transactions while 4XX codes do
268 268 lock_ret_code = 423
269 269
270 270 ## allows to change the repository location in settings page
271 271 allow_repo_location_change = true
272 272
273 273 ## allows to setup custom hooks in settings page
274 274 allow_custom_hooks_settings = true
275 275
276 276 ## Generated license token required for EE edition license.
277 277 ## New generated token value can be found in Admin > settings > license page.
278 278 license_token =
279 279
280 280 ## supervisor connection uri, for managing supervisor and logs.
281 281 supervisor.uri =
282 282 ## supervisord group name/id we only want this RC instance to handle
283 283 supervisor.group_id = dev
284 284
285 285 ## Display extended labs settings
286 286 labs_settings_active = true
287 287
288 288 ## Custom exception store path, defaults to TMPDIR
289 289 ## This is used to store exception from RhodeCode in shared directory
290 290 #exception_tracker.store_path =
291 291
292 292 ## File store configuration. This is used to store and serve uploaded files
293 293 file_store.enabled = true
294 294 ## Storage backend, available options are: local
295 295 file_store.backend = local
296 296 ## path to store the uploaded binaries
297 297 file_store.storage_path = %(here)s/data/file_store
298 298
299 299
300 300 ####################################
301 301 ### CELERY CONFIG ####
302 302 ####################################
303 303 ## run: /path/to/celery worker \
304 304 ## -E --beat --app rhodecode.lib.celerylib.loader \
305 305 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
306 306 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
307 307
308 308 use_celery = false
309 309
310 310 ## connection url to the message broker (default rabbitmq)
311 311 celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
312 312
313 313 ## maximum tasks to execute before worker restart
314 314 celery.max_tasks_per_child = 100
315 315
316 316 ## tasks will never be sent to the queue, but executed locally instead.
317 317 celery.task_always_eager = false
318 318
319 319 #####################################
320 320 ### DOGPILE CACHE ####
321 321 #####################################
322 322 ## Default cache dir for caches. Putting this into a ramdisk
323 323 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
324 324 ## large amount of space
325 325 cache_dir = %(here)s/data
326 326
327 327 ## `cache_perms` cache settings for permission tree, auth TTL.
328 328 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
329 329 rc_cache.cache_perms.expiration_time = 300
330 330
331 331 ## alternative `cache_perms` redis backend with distributed lock
332 332 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
333 333 #rc_cache.cache_perms.expiration_time = 300
334 334 ## redis_expiration_time needs to be greater then expiration_time
335 335 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
336 336 #rc_cache.cache_perms.arguments.socket_timeout = 30
337 337 #rc_cache.cache_perms.arguments.host = localhost
338 338 #rc_cache.cache_perms.arguments.port = 6379
339 339 #rc_cache.cache_perms.arguments.db = 0
340 340 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
341 341 #rc_cache.cache_perms.arguments.distributed_lock = true
342 342
343 343 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
344 344 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
345 345 rc_cache.cache_repo.expiration_time = 2592000
346 346
347 347 ## alternative `cache_repo` redis backend with distributed lock
348 348 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
349 349 #rc_cache.cache_repo.expiration_time = 2592000
350 350 ## redis_expiration_time needs to be greater then expiration_time
351 351 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
352 352 #rc_cache.cache_repo.arguments.socket_timeout = 30
353 353 #rc_cache.cache_repo.arguments.host = localhost
354 354 #rc_cache.cache_repo.arguments.port = 6379
355 355 #rc_cache.cache_repo.arguments.db = 1
356 356 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
357 357 #rc_cache.cache_repo.arguments.distributed_lock = true
358 358
359 359 ## cache settings for SQL queries, this needs to use memory type backend
360 360 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
361 361 rc_cache.sql_cache_short.expiration_time = 30
362 362
363 363 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
364 364 ## type backend as the objects kept are not pickle serializable
365 365 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
366 366 ## by default we use 96H, this is using invalidation on push anyway
367 367 rc_cache.cache_repo_longterm.expiration_time = 345600
368 368 ## max items in LRU cache, reduce this number to save memory, and expire last used
369 369 ## cached objects
370 370 rc_cache.cache_repo_longterm.max_size = 10000
371 371
372 372
373 373 ####################################
374 374 ### BEAKER SESSION ####
375 375 ####################################
376 376
377 377 ## .session.type is type of storage options for the session, current allowed
378 378 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
379 379 beaker.session.type = file
380 380 beaker.session.data_dir = %(here)s/data/sessions
381 381
382 ## redis sessions
383 #beaker.session.type = ext:redis
384 #beaker.session.url = redis://127.0.0.1:6379/2
385
382 386 ## db based session, fast, and allows easy management over logged in users
383 387 #beaker.session.type = ext:database
384 388 #beaker.session.table_name = db_session
385 389 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
386 390 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
387 391 #beaker.session.sa.pool_recycle = 3600
388 392 #beaker.session.sa.echo = false
389 393
390 394 beaker.session.key = rhodecode
391 395 beaker.session.secret = develop-rc-uytcxaz
392 396 beaker.session.lock_dir = %(here)s/data/sessions/lock
393 397
394 398 ## Secure encrypted cookie. Requires AES and AES python libraries
395 399 ## you must disable beaker.session.secret to use this
396 400 #beaker.session.encrypt_key = key_for_encryption
397 401 #beaker.session.validate_key = validation_key
398 402
399 403 ## sets session as invalid(also logging out user) if it haven not been
400 404 ## accessed for given amount of time in seconds
401 405 beaker.session.timeout = 2592000
402 406 beaker.session.httponly = true
403 407 ## Path to use for the cookie. Set to prefix if you use prefix middleware
404 408 #beaker.session.cookie_path = /custom_prefix
405 409
406 410 ## uncomment for https secure cookie
407 411 beaker.session.secure = false
408 412
409 413 ## auto save the session to not to use .save()
410 414 beaker.session.auto = false
411 415
412 416 ## default cookie expiration time in seconds, set to `true` to set expire
413 417 ## at browser close
414 418 #beaker.session.cookie_expires = 3600
415 419
416 420 ###################################
417 421 ## SEARCH INDEXING CONFIGURATION ##
418 422 ###################################
419 423 ## Full text search indexer is available in rhodecode-tools under
420 424 ## `rhodecode-tools index` command
421 425
422 426 ## WHOOSH Backend, doesn't require additional services to run
423 427 ## it works good with few dozen repos
424 428 search.module = rhodecode.lib.index.whoosh
425 429 search.location = %(here)s/data/index
426 430
427 431 ########################################
428 432 ### CHANNELSTREAM CONFIG ####
429 433 ########################################
430 434 ## channelstream enables persistent connections and live notification
431 435 ## in the system. It's also used by the chat system
432 436
433 437 channelstream.enabled = false
434 438
435 439 ## server address for channelstream server on the backend
436 440 channelstream.server = 127.0.0.1:9800
437 441
438 442 ## location of the channelstream server from outside world
439 443 ## use ws:// for http or wss:// for https. This address needs to be handled
440 444 ## by external HTTP server such as Nginx or Apache
441 445 ## see Nginx/Apache configuration examples in our docs
442 446 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
443 447 channelstream.secret = secret
444 448 channelstream.history.location = %(here)s/channelstream_history
445 449
446 450 ## Internal application path that Javascript uses to connect into.
447 451 ## If you use proxy-prefix the prefix should be added before /_channelstream
448 452 channelstream.proxy_path = /_channelstream
449 453
450 454
451 455 ###################################
452 456 ## APPENLIGHT CONFIG ##
453 457 ###################################
454 458
455 459 ## Appenlight is tailored to work with RhodeCode, see
456 460 ## http://appenlight.com for details how to obtain an account
457 461
458 462 ## Appenlight integration enabled
459 463 appenlight = false
460 464
461 465 appenlight.server_url = https://api.appenlight.com
462 466 appenlight.api_key = YOUR_API_KEY
463 467 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
464 468
465 469 ## used for JS client
466 470 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
467 471
468 472 ## TWEAK AMOUNT OF INFO SENT HERE
469 473
470 474 ## enables 404 error logging (default False)
471 475 appenlight.report_404 = false
472 476
473 477 ## time in seconds after request is considered being slow (default 1)
474 478 appenlight.slow_request_time = 1
475 479
476 480 ## record slow requests in application
477 481 ## (needs to be enabled for slow datastore recording and time tracking)
478 482 appenlight.slow_requests = true
479 483
480 484 ## enable hooking to application loggers
481 485 appenlight.logging = true
482 486
483 487 ## minimum log level for log capture
484 488 appenlight.logging.level = WARNING
485 489
486 490 ## send logs only from erroneous/slow requests
487 491 ## (saves API quota for intensive logging)
488 492 appenlight.logging_on_error = false
489 493
490 494 ## list of additional keywords that should be grabbed from environ object
491 495 ## can be string with comma separated list of words in lowercase
492 496 ## (by default client will always send following info:
493 497 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
494 498 ## start with HTTP* this list be extended with additional keywords here
495 499 appenlight.environ_keys_whitelist =
496 500
497 501 ## list of keywords that should be blanked from request object
498 502 ## can be string with comma separated list of words in lowercase
499 503 ## (by default client will always blank keys that contain following words
500 504 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
501 505 ## this list be extended with additional keywords set here
502 506 appenlight.request_keys_blacklist =
503 507
504 508 ## list of namespaces that should be ignores when gathering log entries
505 509 ## can be string with comma separated list of namespaces
506 510 ## (by default the client ignores own entries: appenlight_client.client)
507 511 appenlight.log_namespace_blacklist =
508 512
509 513 # enable debug style page
510 514 debug_style = true
511 515
512 516 ###########################################
513 517 ### MAIN RHODECODE DATABASE CONFIG ###
514 518 ###########################################
515 519 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
516 520 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
517 521 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8
518 522 # pymysql is an alternative driver for MySQL, use in case of problems with default one
519 523 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
520 524
521 525 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
522 526
523 527 # see sqlalchemy docs for other advanced settings
524 528
525 529 ## print the sql statements to output
526 530 sqlalchemy.db1.echo = false
527 531 ## recycle the connections after this amount of seconds
528 532 sqlalchemy.db1.pool_recycle = 3600
529 533 sqlalchemy.db1.convert_unicode = true
530 534
531 535 ## the number of connections to keep open inside the connection pool.
532 536 ## 0 indicates no limit
533 537 #sqlalchemy.db1.pool_size = 5
534 538
535 539 ## the number of connections to allow in connection pool "overflow", that is
536 540 ## connections that can be opened above and beyond the pool_size setting,
537 541 ## which defaults to five.
538 542 #sqlalchemy.db1.max_overflow = 10
539 543
540 544 ## Connection check ping, used to detect broken database connections
541 545 ## could be enabled to better handle cases if MySQL has gone away errors
542 546 #sqlalchemy.db1.ping_connection = true
543 547
544 548 ##################
545 549 ### VCS CONFIG ###
546 550 ##################
547 551 vcs.server.enable = true
548 552 vcs.server = localhost:9900
549 553
550 554 ## Web server connectivity protocol, responsible for web based VCS operations
551 555 ## Available protocols are:
552 556 ## `http` - use http-rpc backend (default)
553 557 vcs.server.protocol = http
554 558
555 559 ## Push/Pull operations protocol, available options are:
556 560 ## `http` - use http-rpc backend (default)
557 561 vcs.scm_app_implementation = http
558 562
559 563 ## Push/Pull operations hooks protocol, available options are:
560 564 ## `http` - use http-rpc backend (default)
561 565 vcs.hooks.protocol = http
562 566
563 567 ## Host on which this instance is listening for hooks. If vcsserver is in other location
564 568 ## this should be adjusted.
565 569 vcs.hooks.host = 127.0.0.1
566 570
567 571 vcs.server.log_level = debug
568 572 ## Start VCSServer with this instance as a subprocess, useful for development
569 573 vcs.start_server = false
570 574
571 575 ## List of enabled VCS backends, available options are:
572 576 ## `hg` - mercurial
573 577 ## `git` - git
574 578 ## `svn` - subversion
575 579 vcs.backends = hg, git, svn
576 580
577 581 vcs.connection_timeout = 3600
578 582 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
579 583 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
580 584 #vcs.svn.compatible_version = pre-1.8-compatible
581 585
582 586
583 587 ############################################################
584 588 ### Subversion proxy support (mod_dav_svn) ###
585 589 ### Maps RhodeCode repo groups into SVN paths for Apache ###
586 590 ############################################################
587 591 ## Enable or disable the config file generation.
588 592 svn.proxy.generate_config = false
589 593 ## Generate config file with `SVNListParentPath` set to `On`.
590 594 svn.proxy.list_parent_path = true
591 595 ## Set location and file name of generated config file.
592 596 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
593 597 ## alternative mod_dav config template. This needs to be a mako template
594 598 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
595 599 ## Used as a prefix to the `Location` block in the generated config file.
596 600 ## In most cases it should be set to `/`.
597 601 svn.proxy.location_root = /
598 602 ## Command to reload the mod dav svn configuration on change.
599 603 ## Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh
600 604 ## Make sure user who runs RhodeCode process is allowed to reload Apache
601 605 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
602 606 ## If the timeout expires before the reload command finishes, the command will
603 607 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
604 608 #svn.proxy.reload_timeout = 10
605 609
606 610 ############################################################
607 611 ### SSH Support Settings ###
608 612 ############################################################
609 613
610 614 ## Defines if a custom authorized_keys file should be created and written on
611 615 ## any change user ssh keys. Setting this to false also disables possibility
612 616 ## of adding SSH keys by users from web interface. Super admins can still
613 617 ## manage SSH Keys.
614 618 ssh.generate_authorized_keyfile = false
615 619
616 620 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
617 621 # ssh.authorized_keys_ssh_opts =
618 622
619 623 ## Path to the authorized_keys file where the generate entries are placed.
620 624 ## It is possible to have multiple key files specified in `sshd_config` e.g.
621 625 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
622 626 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
623 627
624 628 ## Command to execute the SSH wrapper. The binary is available in the
625 629 ## RhodeCode installation directory.
626 630 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
627 631 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
628 632
629 633 ## Allow shell when executing the ssh-wrapper command
630 634 ssh.wrapper_cmd_allow_shell = false
631 635
632 636 ## Enables logging, and detailed output send back to the client during SSH
633 637 ## operations. Useful for debugging, shouldn't be used in production.
634 638 ssh.enable_debug_logging = true
635 639
636 640 ## Paths to binary executable, by default they are the names, but we can
637 641 ## override them if we want to use a custom one
638 642 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
639 643 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
640 644 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
641 645
642 646 ## Enables SSH key generator web interface. Disabling this still allows users
643 647 ## to add their own keys.
644 648 ssh.enable_ui_key_generator = true
645 649
646 650
647 651 ## Dummy marker to add new entries after.
648 652 ## Add any custom entries below. Please don't remove.
649 653 custom.conf = 1
650 654
651 655
652 656 ################################
653 657 ### LOGGING CONFIGURATION ####
654 658 ################################
655 659 [loggers]
656 660 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
657 661
658 662 [handlers]
659 663 keys = console, console_sql
660 664
661 665 [formatters]
662 666 keys = generic, color_formatter, color_formatter_sql
663 667
664 668 #############
665 669 ## LOGGERS ##
666 670 #############
667 671 [logger_root]
668 672 level = NOTSET
669 673 handlers = console
670 674
671 675 [logger_sqlalchemy]
672 676 level = INFO
673 677 handlers = console_sql
674 678 qualname = sqlalchemy.engine
675 679 propagate = 0
676 680
677 681 [logger_beaker]
678 682 level = DEBUG
679 683 handlers =
680 684 qualname = beaker.container
681 685 propagate = 1
682 686
683 687 [logger_rhodecode]
684 688 level = DEBUG
685 689 handlers =
686 690 qualname = rhodecode
687 691 propagate = 1
688 692
689 693 [logger_ssh_wrapper]
690 694 level = DEBUG
691 695 handlers =
692 696 qualname = ssh_wrapper
693 697 propagate = 1
694 698
695 699 [logger_celery]
696 700 level = DEBUG
697 701 handlers =
698 702 qualname = celery
699 703
700 704
701 705 ##############
702 706 ## HANDLERS ##
703 707 ##############
704 708
705 709 [handler_console]
706 710 class = StreamHandler
707 711 args = (sys.stderr, )
708 712 level = DEBUG
709 713 formatter = color_formatter
710 714
711 715 [handler_console_sql]
712 716 # "level = DEBUG" logs SQL queries and results.
713 717 # "level = INFO" logs SQL queries.
714 718 # "level = WARN" logs neither. (Recommended for production systems.)
715 719 class = StreamHandler
716 720 args = (sys.stderr, )
717 721 level = WARN
718 722 formatter = color_formatter_sql
719 723
720 724 ################
721 725 ## FORMATTERS ##
722 726 ################
723 727
724 728 [formatter_generic]
725 729 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
726 730 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
727 731 datefmt = %Y-%m-%d %H:%M:%S
728 732
729 733 [formatter_color_formatter]
730 734 class = rhodecode.lib.logging_formatter.ColorFormatter
731 735 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
732 736 datefmt = %Y-%m-%d %H:%M:%S
733 737
734 738 [formatter_color_formatter_sql]
735 739 class = rhodecode.lib.logging_formatter.ColorFormatterSql
736 740 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
737 741 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,710 +1,714 b''
1 1
2 2
3 3 ################################################################################
4 4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
5 5 ################################################################################
6 6
7 7 [DEFAULT]
8 8 ## Debug flag sets all loggers to debug, and enables request tracking
9 9 debug = false
10 10
11 11 ################################################################################
12 12 ## EMAIL CONFIGURATION ##
13 13 ## Uncomment and replace with the email address which should receive ##
14 14 ## any error reports after an application crash ##
15 15 ## Additionally these settings will be used by the RhodeCode mailing system ##
16 16 ################################################################################
17 17
18 18 ## prefix all emails subjects with given prefix, helps filtering out emails
19 19 #email_prefix = [RhodeCode]
20 20
21 21 ## email FROM address all mails will be sent
22 22 #app_email_from = rhodecode-noreply@localhost
23 23
24 24 #smtp_server = mail.server.com
25 25 #smtp_username =
26 26 #smtp_password =
27 27 #smtp_port =
28 28 #smtp_use_tls = false
29 29 #smtp_use_ssl = true
30 30
31 31 [server:main]
32 32 ## COMMON ##
33 33 host = 127.0.0.1
34 34 port = 5000
35 35
36 36 ###########################################################
37 37 ## WAITRESS WSGI SERVER - Recommended for Development ####
38 38 ###########################################################
39 39
40 40 #use = egg:waitress#main
41 41 ## number of worker threads
42 42 #threads = 5
43 43 ## MAX BODY SIZE 100GB
44 44 #max_request_body_size = 107374182400
45 45 ## Use poll instead of select, fixes file descriptors limits problems.
46 46 ## May not work on old windows systems.
47 47 #asyncore_use_poll = true
48 48
49 49
50 50 ##########################
51 51 ## GUNICORN WSGI SERVER ##
52 52 ##########################
53 53 ## run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
54 54
55 55 use = egg:gunicorn#main
56 56 ## Sets the number of process workers. More workers means more concurrent connections
57 57 ## RhodeCode can handle at the same time. Each additional worker also it increases
58 58 ## memory usage as each has it's own set of caches.
59 59 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
60 60 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
61 61 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
62 62 ## when using more than 1 worker.
63 63 workers = 2
64 64 ## process name visible in process list
65 65 proc_name = rhodecode
66 66 ## type of worker class, one of sync, gevent
67 67 ## recommended for bigger setup is using of of other than sync one
68 68 worker_class = gevent
69 69 ## The maximum number of simultaneous clients. Valid only for Gevent
70 70 worker_connections = 10
71 71 ## max number of requests that worker will handle before being gracefully
72 72 ## restarted, could prevent memory leaks
73 73 max_requests = 1000
74 74 max_requests_jitter = 30
75 75 ## amount of time a worker can spend with handling a request before it
76 76 ## gets killed and restarted. Set to 6hrs
77 77 timeout = 21600
78 78
79 79
80 80 ## prefix middleware for RhodeCode.
81 81 ## recommended when using proxy setup.
82 82 ## allows to set RhodeCode under a prefix in server.
83 83 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
84 84 ## And set your prefix like: `prefix = /custom_prefix`
85 85 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
86 86 ## to make your cookies only work on prefix url
87 87 [filter:proxy-prefix]
88 88 use = egg:PasteDeploy#prefix
89 89 prefix = /
90 90
91 91 [app:main]
92 92 ## The %(here)s variable will be replaced with the absolute path of parent directory
93 93 ## of this file
94 94 ## In addition ENVIRONMENT variables usage is possible, e.g
95 95 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
96 96
97 97 use = egg:rhodecode-enterprise-ce
98 98
99 99 ## enable proxy prefix middleware, defined above
100 100 #filter-with = proxy-prefix
101 101
102 102 ## encryption key used to encrypt social plugin tokens,
103 103 ## remote_urls with credentials etc, if not set it defaults to
104 104 ## `beaker.session.secret`
105 105 #rhodecode.encrypted_values.secret =
106 106
107 107 ## decryption strict mode (enabled by default). It controls if decryption raises
108 108 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
109 109 #rhodecode.encrypted_values.strict = false
110 110
111 111 ## Pick algorithm for encryption. Either fernet (more secure) or aes (default)
112 112 ## fernet is safer, and we strongly recommend switching to it.
113 113 ## Due to backward compatibility aes is used as default.
114 114 #rhodecode.encrypted_values.algorithm = fernet
115 115
116 116 ## return gzipped responses from RhodeCode (static files/application)
117 117 gzip_responses = false
118 118
119 119 ## auto-generate javascript routes file on startup
120 120 generate_js_files = false
121 121
122 122 ## System global default language.
123 123 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
124 124 lang = en
125 125
126 126 ## Perform a full repository scan and import on each server start.
127 127 ## Settings this to true could lead to very long startup time.
128 128 startup.import_repos = false
129 129
130 130 ## Uncomment and set this path to use archive download cache.
131 131 ## Once enabled, generated archives will be cached at this location
132 132 ## and served from the cache during subsequent requests for the same archive of
133 133 ## the repository.
134 134 #archive_cache_dir = /tmp/tarballcache
135 135
136 136 ## URL at which the application is running. This is used for Bootstrapping
137 137 ## requests in context when no web request is available. Used in ishell, or
138 138 ## SSH calls. Set this for events to receive proper url for SSH calls.
139 139 app.base_url = http://rhodecode.local
140 140
141 141 ## Unique application ID. Should be a random unique string for security.
142 142 app_instance_uuid = rc-production
143 143
144 144 ## Cut off limit for large diffs (size in bytes). If overall diff size on
145 145 ## commit, or pull request exceeds this limit this diff will be displayed
146 146 ## partially. E.g 512000 == 512Kb
147 147 cut_off_limit_diff = 512000
148 148
149 149 ## Cut off limit for large files inside diffs (size in bytes). Each individual
150 150 ## file inside diff which exceeds this limit will be displayed partially.
151 151 ## E.g 128000 == 128Kb
152 152 cut_off_limit_file = 128000
153 153
154 154 ## use cached version of vcs repositories everywhere. Recommended to be `true`
155 155 vcs_full_cache = true
156 156
157 157 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
158 158 ## Normally this is controlled by proper http flags sent from http server
159 159 force_https = false
160 160
161 161 ## use Strict-Transport-Security headers
162 162 use_htsts = false
163 163
164 164 ## git rev filter option, --all is the default filter, if you need to
165 165 ## hide all refs in changelog switch this to --branches --tags
166 166 git_rev_filter = --branches --tags
167 167
168 168 # Set to true if your repos are exposed using the dumb protocol
169 169 git_update_server_info = false
170 170
171 171 ## RSS/ATOM feed options
172 172 rss_cut_off_limit = 256000
173 173 rss_items_per_page = 10
174 174 rss_include_diff = false
175 175
176 176 ## gist URL alias, used to create nicer urls for gist. This should be an
177 177 ## url that does rewrites to _admin/gists/{gistid}.
178 178 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
179 179 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
180 180 gist_alias_url =
181 181
182 182 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
183 183 ## used for access.
184 184 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
185 185 ## came from the the logged in user who own this authentication token.
186 186 ## Additionally @TOKEN syntax can be used to bound the view to specific
187 187 ## authentication token. Such view would be only accessible when used together
188 188 ## with this authentication token
189 189 ##
190 190 ## list of all views can be found under `/_admin/permissions/auth_token_access`
191 191 ## The list should be "," separated and on a single line.
192 192 ##
193 193 ## Most common views to enable:
194 194 # RepoCommitsView:repo_commit_download
195 195 # RepoCommitsView:repo_commit_patch
196 196 # RepoCommitsView:repo_commit_raw
197 197 # RepoCommitsView:repo_commit_raw@TOKEN
198 198 # RepoFilesView:repo_files_diff
199 199 # RepoFilesView:repo_archivefile
200 200 # RepoFilesView:repo_file_raw
201 201 # GistView:*
202 202 api_access_controllers_whitelist =
203 203
204 204 ## Default encoding used to convert from and to unicode
205 205 ## can be also a comma separated list of encoding in case of mixed encodings
206 206 default_encoding = UTF-8
207 207
208 208 ## instance-id prefix
209 209 ## a prefix key for this instance used for cache invalidation when running
210 210 ## multiple instances of RhodeCode, make sure it's globally unique for
211 211 ## all running RhodeCode instances. Leave empty if you don't use it
212 212 instance_id =
213 213
214 214 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
215 215 ## of an authentication plugin also if it is disabled by it's settings.
216 216 ## This could be useful if you are unable to log in to the system due to broken
217 217 ## authentication settings. Then you can enable e.g. the internal RhodeCode auth
218 218 ## module to log in again and fix the settings.
219 219 ##
220 220 ## Available builtin plugin IDs (hash is part of the ID):
221 221 ## egg:rhodecode-enterprise-ce#rhodecode
222 222 ## egg:rhodecode-enterprise-ce#pam
223 223 ## egg:rhodecode-enterprise-ce#ldap
224 224 ## egg:rhodecode-enterprise-ce#jasig_cas
225 225 ## egg:rhodecode-enterprise-ce#headers
226 226 ## egg:rhodecode-enterprise-ce#crowd
227 227 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
228 228
229 229 ## alternative return HTTP header for failed authentication. Default HTTP
230 230 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
231 231 ## handling that causing a series of failed authentication calls.
232 232 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
233 233 ## This will be served instead of default 401 on bad authentication
234 234 auth_ret_code =
235 235
236 236 ## use special detection method when serving auth_ret_code, instead of serving
237 237 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
238 238 ## and then serve auth_ret_code to clients
239 239 auth_ret_code_detection = false
240 240
241 241 ## locking return code. When repository is locked return this HTTP code. 2XX
242 242 ## codes don't break the transactions while 4XX codes do
243 243 lock_ret_code = 423
244 244
245 245 ## allows to change the repository location in settings page
246 246 allow_repo_location_change = true
247 247
248 248 ## allows to setup custom hooks in settings page
249 249 allow_custom_hooks_settings = true
250 250
251 251 ## Generated license token required for EE edition license.
252 252 ## New generated token value can be found in Admin > settings > license page.
253 253 license_token =
254 254
255 255 ## supervisor connection uri, for managing supervisor and logs.
256 256 supervisor.uri =
257 257 ## supervisord group name/id we only want this RC instance to handle
258 258 supervisor.group_id = prod
259 259
260 260 ## Display extended labs settings
261 261 labs_settings_active = true
262 262
263 263 ## Custom exception store path, defaults to TMPDIR
264 264 ## This is used to store exception from RhodeCode in shared directory
265 265 #exception_tracker.store_path =
266 266
267 267 ## File store configuration. This is used to store and serve uploaded files
268 268 file_store.enabled = true
269 269 ## Storage backend, available options are: local
270 270 file_store.backend = local
271 271 ## path to store the uploaded binaries
272 272 file_store.storage_path = %(here)s/data/file_store
273 273
274 274
275 275 ####################################
276 276 ### CELERY CONFIG ####
277 277 ####################################
278 278 ## run: /path/to/celery worker \
279 279 ## -E --beat --app rhodecode.lib.celerylib.loader \
280 280 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
281 281 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
282 282
283 283 use_celery = false
284 284
285 285 ## connection url to the message broker (default rabbitmq)
286 286 celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
287 287
288 288 ## maximum tasks to execute before worker restart
289 289 celery.max_tasks_per_child = 100
290 290
291 291 ## tasks will never be sent to the queue, but executed locally instead.
292 292 celery.task_always_eager = false
293 293
294 294 #####################################
295 295 ### DOGPILE CACHE ####
296 296 #####################################
297 297 ## Default cache dir for caches. Putting this into a ramdisk
298 298 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
299 299 ## large amount of space
300 300 cache_dir = %(here)s/data
301 301
302 302 ## `cache_perms` cache settings for permission tree, auth TTL.
303 303 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
304 304 rc_cache.cache_perms.expiration_time = 300
305 305
306 306 ## alternative `cache_perms` redis backend with distributed lock
307 307 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
308 308 #rc_cache.cache_perms.expiration_time = 300
309 309 ## redis_expiration_time needs to be greater then expiration_time
310 310 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
311 311 #rc_cache.cache_perms.arguments.socket_timeout = 30
312 312 #rc_cache.cache_perms.arguments.host = localhost
313 313 #rc_cache.cache_perms.arguments.port = 6379
314 314 #rc_cache.cache_perms.arguments.db = 0
315 315 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
316 316 #rc_cache.cache_perms.arguments.distributed_lock = true
317 317
318 318 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
319 319 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
320 320 rc_cache.cache_repo.expiration_time = 2592000
321 321
322 322 ## alternative `cache_repo` redis backend with distributed lock
323 323 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
324 324 #rc_cache.cache_repo.expiration_time = 2592000
325 325 ## redis_expiration_time needs to be greater then expiration_time
326 326 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
327 327 #rc_cache.cache_repo.arguments.socket_timeout = 30
328 328 #rc_cache.cache_repo.arguments.host = localhost
329 329 #rc_cache.cache_repo.arguments.port = 6379
330 330 #rc_cache.cache_repo.arguments.db = 1
331 331 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
332 332 #rc_cache.cache_repo.arguments.distributed_lock = true
333 333
334 334 ## cache settings for SQL queries, this needs to use memory type backend
335 335 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
336 336 rc_cache.sql_cache_short.expiration_time = 30
337 337
338 338 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
339 339 ## type backend as the objects kept are not pickle serializable
340 340 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
341 341 ## by default we use 96H, this is using invalidation on push anyway
342 342 rc_cache.cache_repo_longterm.expiration_time = 345600
343 343 ## max items in LRU cache, reduce this number to save memory, and expire last used
344 344 ## cached objects
345 345 rc_cache.cache_repo_longterm.max_size = 10000
346 346
347 347
348 348 ####################################
349 349 ### BEAKER SESSION ####
350 350 ####################################
351 351
352 352 ## .session.type is type of storage options for the session, current allowed
353 353 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
354 354 beaker.session.type = file
355 355 beaker.session.data_dir = %(here)s/data/sessions
356 356
357 ## redis sessions
358 #beaker.session.type = ext:redis
359 #beaker.session.url = redis://127.0.0.1:6379/2
360
357 361 ## db based session, fast, and allows easy management over logged in users
358 362 #beaker.session.type = ext:database
359 363 #beaker.session.table_name = db_session
360 364 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
361 365 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
362 366 #beaker.session.sa.pool_recycle = 3600
363 367 #beaker.session.sa.echo = false
364 368
365 369 beaker.session.key = rhodecode
366 370 beaker.session.secret = production-rc-uytcxaz
367 371 beaker.session.lock_dir = %(here)s/data/sessions/lock
368 372
369 373 ## Secure encrypted cookie. Requires AES and AES python libraries
370 374 ## you must disable beaker.session.secret to use this
371 375 #beaker.session.encrypt_key = key_for_encryption
372 376 #beaker.session.validate_key = validation_key
373 377
374 378 ## sets session as invalid(also logging out user) if it haven not been
375 379 ## accessed for given amount of time in seconds
376 380 beaker.session.timeout = 2592000
377 381 beaker.session.httponly = true
378 382 ## Path to use for the cookie. Set to prefix if you use prefix middleware
379 383 #beaker.session.cookie_path = /custom_prefix
380 384
381 385 ## uncomment for https secure cookie
382 386 beaker.session.secure = false
383 387
384 388 ## auto save the session to not to use .save()
385 389 beaker.session.auto = false
386 390
387 391 ## default cookie expiration time in seconds, set to `true` to set expire
388 392 ## at browser close
389 393 #beaker.session.cookie_expires = 3600
390 394
391 395 ###################################
392 396 ## SEARCH INDEXING CONFIGURATION ##
393 397 ###################################
394 398 ## Full text search indexer is available in rhodecode-tools under
395 399 ## `rhodecode-tools index` command
396 400
397 401 ## WHOOSH Backend, doesn't require additional services to run
398 402 ## it works good with few dozen repos
399 403 search.module = rhodecode.lib.index.whoosh
400 404 search.location = %(here)s/data/index
401 405
402 406 ########################################
403 407 ### CHANNELSTREAM CONFIG ####
404 408 ########################################
405 409 ## channelstream enables persistent connections and live notification
406 410 ## in the system. It's also used by the chat system
407 411
408 412 channelstream.enabled = false
409 413
410 414 ## server address for channelstream server on the backend
411 415 channelstream.server = 127.0.0.1:9800
412 416
413 417 ## location of the channelstream server from outside world
414 418 ## use ws:// for http or wss:// for https. This address needs to be handled
415 419 ## by external HTTP server such as Nginx or Apache
416 420 ## see Nginx/Apache configuration examples in our docs
417 421 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
418 422 channelstream.secret = secret
419 423 channelstream.history.location = %(here)s/channelstream_history
420 424
421 425 ## Internal application path that Javascript uses to connect into.
422 426 ## If you use proxy-prefix the prefix should be added before /_channelstream
423 427 channelstream.proxy_path = /_channelstream
424 428
425 429
426 430 ###################################
427 431 ## APPENLIGHT CONFIG ##
428 432 ###################################
429 433
430 434 ## Appenlight is tailored to work with RhodeCode, see
431 435 ## http://appenlight.com for details how to obtain an account
432 436
433 437 ## Appenlight integration enabled
434 438 appenlight = false
435 439
436 440 appenlight.server_url = https://api.appenlight.com
437 441 appenlight.api_key = YOUR_API_KEY
438 442 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
439 443
440 444 ## used for JS client
441 445 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
442 446
443 447 ## TWEAK AMOUNT OF INFO SENT HERE
444 448
445 449 ## enables 404 error logging (default False)
446 450 appenlight.report_404 = false
447 451
448 452 ## time in seconds after request is considered being slow (default 1)
449 453 appenlight.slow_request_time = 1
450 454
451 455 ## record slow requests in application
452 456 ## (needs to be enabled for slow datastore recording and time tracking)
453 457 appenlight.slow_requests = true
454 458
455 459 ## enable hooking to application loggers
456 460 appenlight.logging = true
457 461
458 462 ## minimum log level for log capture
459 463 appenlight.logging.level = WARNING
460 464
461 465 ## send logs only from erroneous/slow requests
462 466 ## (saves API quota for intensive logging)
463 467 appenlight.logging_on_error = false
464 468
465 469 ## list of additional keywords that should be grabbed from environ object
466 470 ## can be string with comma separated list of words in lowercase
467 471 ## (by default client will always send following info:
468 472 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
469 473 ## start with HTTP* this list be extended with additional keywords here
470 474 appenlight.environ_keys_whitelist =
471 475
472 476 ## list of keywords that should be blanked from request object
473 477 ## can be string with comma separated list of words in lowercase
474 478 ## (by default client will always blank keys that contain following words
475 479 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
476 480 ## this list be extended with additional keywords set here
477 481 appenlight.request_keys_blacklist =
478 482
479 483 ## list of namespaces that should be ignores when gathering log entries
480 484 ## can be string with comma separated list of namespaces
481 485 ## (by default the client ignores own entries: appenlight_client.client)
482 486 appenlight.log_namespace_blacklist =
483 487
484 488
485 489 ###########################################
486 490 ### MAIN RHODECODE DATABASE CONFIG ###
487 491 ###########################################
488 492 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
489 493 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
490 494 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8
491 495 # pymysql is an alternative driver for MySQL, use in case of problems with default one
492 496 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
493 497
494 498 sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
495 499
496 500 # see sqlalchemy docs for other advanced settings
497 501
498 502 ## print the sql statements to output
499 503 sqlalchemy.db1.echo = false
500 504 ## recycle the connections after this amount of seconds
501 505 sqlalchemy.db1.pool_recycle = 3600
502 506 sqlalchemy.db1.convert_unicode = true
503 507
504 508 ## the number of connections to keep open inside the connection pool.
505 509 ## 0 indicates no limit
506 510 #sqlalchemy.db1.pool_size = 5
507 511
508 512 ## the number of connections to allow in connection pool "overflow", that is
509 513 ## connections that can be opened above and beyond the pool_size setting,
510 514 ## which defaults to five.
511 515 #sqlalchemy.db1.max_overflow = 10
512 516
513 517 ## Connection check ping, used to detect broken database connections
514 518 ## could be enabled to better handle cases if MySQL has gone away errors
515 519 #sqlalchemy.db1.ping_connection = true
516 520
517 521 ##################
518 522 ### VCS CONFIG ###
519 523 ##################
520 524 vcs.server.enable = true
521 525 vcs.server = localhost:9900
522 526
523 527 ## Web server connectivity protocol, responsible for web based VCS operations
524 528 ## Available protocols are:
525 529 ## `http` - use http-rpc backend (default)
526 530 vcs.server.protocol = http
527 531
528 532 ## Push/Pull operations protocol, available options are:
529 533 ## `http` - use http-rpc backend (default)
530 534 vcs.scm_app_implementation = http
531 535
532 536 ## Push/Pull operations hooks protocol, available options are:
533 537 ## `http` - use http-rpc backend (default)
534 538 vcs.hooks.protocol = http
535 539
536 540 ## Host on which this instance is listening for hooks. If vcsserver is in other location
537 541 ## this should be adjusted.
538 542 vcs.hooks.host = 127.0.0.1
539 543
540 544 vcs.server.log_level = info
541 545 ## Start VCSServer with this instance as a subprocess, useful for development
542 546 vcs.start_server = false
543 547
544 548 ## List of enabled VCS backends, available options are:
545 549 ## `hg` - mercurial
546 550 ## `git` - git
547 551 ## `svn` - subversion
548 552 vcs.backends = hg, git, svn
549 553
550 554 vcs.connection_timeout = 3600
551 555 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
552 556 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
553 557 #vcs.svn.compatible_version = pre-1.8-compatible
554 558
555 559
556 560 ############################################################
557 561 ### Subversion proxy support (mod_dav_svn) ###
558 562 ### Maps RhodeCode repo groups into SVN paths for Apache ###
559 563 ############################################################
560 564 ## Enable or disable the config file generation.
561 565 svn.proxy.generate_config = false
562 566 ## Generate config file with `SVNListParentPath` set to `On`.
563 567 svn.proxy.list_parent_path = true
564 568 ## Set location and file name of generated config file.
565 569 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
566 570 ## alternative mod_dav config template. This needs to be a mako template
567 571 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
568 572 ## Used as a prefix to the `Location` block in the generated config file.
569 573 ## In most cases it should be set to `/`.
570 574 svn.proxy.location_root = /
571 575 ## Command to reload the mod dav svn configuration on change.
572 576 ## Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh
573 577 ## Make sure user who runs RhodeCode process is allowed to reload Apache
574 578 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
575 579 ## If the timeout expires before the reload command finishes, the command will
576 580 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
577 581 #svn.proxy.reload_timeout = 10
578 582
579 583 ############################################################
580 584 ### SSH Support Settings ###
581 585 ############################################################
582 586
583 587 ## Defines if a custom authorized_keys file should be created and written on
584 588 ## any change user ssh keys. Setting this to false also disables possibility
585 589 ## of adding SSH keys by users from web interface. Super admins can still
586 590 ## manage SSH Keys.
587 591 ssh.generate_authorized_keyfile = false
588 592
589 593 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
590 594 # ssh.authorized_keys_ssh_opts =
591 595
592 596 ## Path to the authorized_keys file where the generate entries are placed.
593 597 ## It is possible to have multiple key files specified in `sshd_config` e.g.
594 598 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
595 599 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
596 600
597 601 ## Command to execute the SSH wrapper. The binary is available in the
598 602 ## RhodeCode installation directory.
599 603 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
600 604 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
601 605
602 606 ## Allow shell when executing the ssh-wrapper command
603 607 ssh.wrapper_cmd_allow_shell = false
604 608
605 609 ## Enables logging, and detailed output send back to the client during SSH
606 610 ## operations. Useful for debugging, shouldn't be used in production.
607 611 ssh.enable_debug_logging = false
608 612
609 613 ## Paths to binary executable, by default they are the names, but we can
610 614 ## override them if we want to use a custom one
611 615 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
612 616 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
613 617 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
614 618
615 619 ## Enables SSH key generator web interface. Disabling this still allows users
616 620 ## to add their own keys.
617 621 ssh.enable_ui_key_generator = true
618 622
619 623
620 624 ## Dummy marker to add new entries after.
621 625 ## Add any custom entries below. Please don't remove.
622 626 custom.conf = 1
623 627
624 628
625 629 ################################
626 630 ### LOGGING CONFIGURATION ####
627 631 ################################
628 632 [loggers]
629 633 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
630 634
631 635 [handlers]
632 636 keys = console, console_sql
633 637
634 638 [formatters]
635 639 keys = generic, color_formatter, color_formatter_sql
636 640
637 641 #############
638 642 ## LOGGERS ##
639 643 #############
640 644 [logger_root]
641 645 level = NOTSET
642 646 handlers = console
643 647
644 648 [logger_sqlalchemy]
645 649 level = INFO
646 650 handlers = console_sql
647 651 qualname = sqlalchemy.engine
648 652 propagate = 0
649 653
650 654 [logger_beaker]
651 655 level = DEBUG
652 656 handlers =
653 657 qualname = beaker.container
654 658 propagate = 1
655 659
656 660 [logger_rhodecode]
657 661 level = DEBUG
658 662 handlers =
659 663 qualname = rhodecode
660 664 propagate = 1
661 665
662 666 [logger_ssh_wrapper]
663 667 level = DEBUG
664 668 handlers =
665 669 qualname = ssh_wrapper
666 670 propagate = 1
667 671
668 672 [logger_celery]
669 673 level = DEBUG
670 674 handlers =
671 675 qualname = celery
672 676
673 677
674 678 ##############
675 679 ## HANDLERS ##
676 680 ##############
677 681
678 682 [handler_console]
679 683 class = StreamHandler
680 684 args = (sys.stderr, )
681 685 level = INFO
682 686 formatter = generic
683 687
684 688 [handler_console_sql]
685 689 # "level = DEBUG" logs SQL queries and results.
686 690 # "level = INFO" logs SQL queries.
687 691 # "level = WARN" logs neither. (Recommended for production systems.)
688 692 class = StreamHandler
689 693 args = (sys.stderr, )
690 694 level = WARN
691 695 formatter = generic
692 696
693 697 ################
694 698 ## FORMATTERS ##
695 699 ################
696 700
697 701 [formatter_generic]
698 702 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
699 703 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
700 704 datefmt = %Y-%m-%d %H:%M:%S
701 705
702 706 [formatter_color_formatter]
703 707 class = rhodecode.lib.logging_formatter.ColorFormatter
704 708 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
705 709 datefmt = %Y-%m-%d %H:%M:%S
706 710
707 711 [formatter_color_formatter_sql]
708 712 class = rhodecode.lib.logging_formatter.ColorFormatterSql
709 713 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
710 714 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,223 +1,261 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2017-2019 RhodeCode GmbH
4 4 #
5 5 # This program is free software: you can redistribute it and/or modify
6 6 # it under the terms of the GNU Affero General Public License, version 3
7 7 # (only), as published by the Free Software Foundation.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU Affero General Public License
15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16 #
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import os
22 22 import re
23 23 import time
24 24 import datetime
25 25 import dateutil
26 import pickle
26 27
27 28 from rhodecode.model.db import DbSession, Session
28 29
29 30
30 31 class CleanupCommand(Exception):
31 32 pass
32 33
33 34
34 35 class BaseAuthSessions(object):
35 36 SESSION_TYPE = None
36 37 NOT_AVAILABLE = 'NOT AVAILABLE'
37 38
38 39 def __init__(self, config):
39 40 session_conf = {}
40 41 for k, v in config.items():
41 42 if k.startswith('beaker.session'):
42 43 session_conf[k] = v
43 44 self.config = session_conf
44 45
45 46 def get_count(self):
46 47 raise NotImplementedError
47 48
48 49 def get_expired_count(self, older_than_seconds=None):
49 50 raise NotImplementedError
50 51
51 52 def clean_sessions(self, older_than_seconds=None):
52 53 raise NotImplementedError
53 54
54 55 def _seconds_to_date(self, seconds):
55 56 return datetime.datetime.utcnow() - dateutil.relativedelta.relativedelta(
56 57 seconds=seconds)
57 58
58 59
59 60 class DbAuthSessions(BaseAuthSessions):
60 61 SESSION_TYPE = 'ext:database'
61 62
62 63 def get_count(self):
63 64 return DbSession.query().count()
64 65
65 66 def get_expired_count(self, older_than_seconds=None):
66 67 expiry_date = self._seconds_to_date(older_than_seconds)
67 68 return DbSession.query().filter(DbSession.accessed < expiry_date).count()
68 69
69 70 def clean_sessions(self, older_than_seconds=None):
70 71 expiry_date = self._seconds_to_date(older_than_seconds)
71 72 to_remove = DbSession.query().filter(DbSession.accessed < expiry_date).count()
72 73 DbSession.query().filter(DbSession.accessed < expiry_date).delete()
73 74 Session().commit()
74 75 return to_remove
75 76
76 77
77 78 class FileAuthSessions(BaseAuthSessions):
78 79 SESSION_TYPE = 'file sessions'
79 80
80 81 def _get_sessions_dir(self):
81 82 data_dir = self.config.get('beaker.session.data_dir')
82 83 return data_dir
83 84
84 85 def _count_on_filesystem(self, path, older_than=0, callback=None):
85 86 value = dict(percent=0, used=0, total=0, items=0, callbacks=0,
86 87 path=path, text='')
87 88 items_count = 0
88 89 used = 0
89 90 callbacks = 0
90 91 cur_time = time.time()
91 92 for root, dirs, files in os.walk(path):
92 93 for f in files:
93 94 final_path = os.path.join(root, f)
94 95 try:
95 96 mtime = os.stat(final_path).st_mtime
96 97 if (cur_time - mtime) > older_than:
97 98 items_count += 1
98 99 if callback:
99 100 callback_res = callback(final_path)
100 101 callbacks += 1
101 102 else:
102 103 used += os.path.getsize(final_path)
103 104 except OSError:
104 105 pass
105 106 value.update({
106 107 'percent': 100,
107 108 'used': used,
108 109 'total': used,
109 110 'items': items_count,
110 111 'callbacks': callbacks
111 112 })
112 113 return value
113 114
114 115 def get_count(self):
115 116 try:
116 117 sessions_dir = self._get_sessions_dir()
117 118 items_count = self._count_on_filesystem(sessions_dir)['items']
118 119 except Exception:
119 120 items_count = self.NOT_AVAILABLE
120 121 return items_count
121 122
122 123 def get_expired_count(self, older_than_seconds=0):
123 124 try:
124 125 sessions_dir = self._get_sessions_dir()
125 126 items_count = self._count_on_filesystem(
126 127 sessions_dir, older_than=older_than_seconds)['items']
127 128 except Exception:
128 129 items_count = self.NOT_AVAILABLE
129 130 return items_count
130 131
131 132 def clean_sessions(self, older_than_seconds=0):
132 133 # find . -mtime +60 -exec rm {} \;
133 134
134 135 sessions_dir = self._get_sessions_dir()
135 136
136 137 def remove_item(path):
137 138 os.remove(path)
138 139
139 140 stats = self._count_on_filesystem(
140 141 sessions_dir, older_than=older_than_seconds,
141 142 callback=remove_item)
142 143 return stats['callbacks']
143 144
144 145
145
146 146 class MemcachedAuthSessions(BaseAuthSessions):
147 147 SESSION_TYPE = 'ext:memcached'
148 148 _key_regex = re.compile(r'ITEM (.*_session) \[(.*); (.*)\]')
149 149
150 150 def _get_client(self):
151 151 import memcache
152 152 client = memcache.Client([self.config.get('beaker.session.url')])
153 153 return client
154 154
155 155 def _get_telnet_client(self, host, port):
156 156 import telnetlib
157 157 client = telnetlib.Telnet(host, port, None)
158 158 return client
159 159
160 160 def _run_telnet_cmd(self, client, cmd):
161 161 client.write("%s\n" % cmd)
162 162 return client.read_until('END')
163 163
164 164 def key_details(self, client, slab_ids, limit=100):
165 165 """ Return a list of tuples containing keys and details """
166 166 cmd = 'stats cachedump %s %s'
167 167 for slab_id in slab_ids:
168 168 for key in self._key_regex.finditer(
169 169 self._run_telnet_cmd(client, cmd % (slab_id, limit))):
170 170 yield key
171 171
172 172 def get_count(self):
173 173 client = self._get_client()
174 174 count = self.NOT_AVAILABLE
175 175 try:
176 176 slabs = []
177 177 for server, slabs_data in client.get_slabs():
178 178 slabs.extend(slabs_data.keys())
179 179
180 180 host, port = client.servers[0].address
181 181 telnet_client = self._get_telnet_client(host, port)
182 182 keys = self.key_details(telnet_client, slabs)
183 183 count = 0
184 184 for _k in keys:
185 185 count += 1
186 186 except Exception:
187 187 return count
188 188
189 189 return count
190 190
191 191 def get_expired_count(self, older_than_seconds=None):
192 192 return self.NOT_AVAILABLE
193 193
194 194 def clean_sessions(self, older_than_seconds=None):
195 195 raise CleanupCommand('Cleanup for this session type not yet available')
196 196
197 197
198 class RedisAuthSessions(BaseAuthSessions):
199 SESSION_TYPE = 'ext:redis'
200
201 def _get_client(self):
202 import redis
203 args = {
204 'socket_timeout': 60,
205 'url': self.config.get('beaker.session.url')
206 }
207
208 client = redis.StrictRedis.from_url(**args)
209 return client
210
211 def get_count(self):
212 client = self._get_client()
213 return len(client.keys('beaker_cache:*'))
214
215 def get_expired_count(self, older_than_seconds=None):
216 expiry_date = self._seconds_to_date(older_than_seconds)
217 return self.NOT_AVAILABLE
218
219 def clean_sessions(self, older_than_seconds=None):
220 client = self._get_client()
221 expiry_time = time.time() - older_than_seconds
222 deleted_keys = 0
223 for key in client.keys('beaker_cache:*'):
224 data = client.get(key)
225 if data:
226 json_data = pickle.loads(data)
227 accessed_time = json_data['_accessed_time']
228 if accessed_time < expiry_time:
229 client.delete(key)
230 deleted_keys += 1
231
232 return deleted_keys
233
234
198 235 class MemoryAuthSessions(BaseAuthSessions):
199 236 SESSION_TYPE = 'memory'
200 237
201 238 def get_count(self):
202 239 return self.NOT_AVAILABLE
203 240
204 241 def get_expired_count(self, older_than_seconds=None):
205 242 return self.NOT_AVAILABLE
206 243
207 244 def clean_sessions(self, older_than_seconds=None):
208 245 raise CleanupCommand('Cleanup for this session type not yet available')
209 246
210 247
211 248 def get_session_handler(session_type):
212 249 types = {
213 250 'file': FileAuthSessions,
214 251 'ext:memcached': MemcachedAuthSessions,
252 'ext:redis': RedisAuthSessions,
215 253 'ext:database': DbAuthSessions,
216 254 'memory': MemoryAuthSessions
217 255 }
218 256
219 257 try:
220 258 return types[session_type]
221 259 except KeyError:
222 260 raise ValueError(
223 261 'This type {} is not supported'.format(session_type))
General Comments 0
You need to be logged in to leave comments. Login now