Show More
@@ -1,874 +1,874 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | ; ######################################### |
|
3 | ; ######################################### | |
4 | ; RHODECODE COMMUNITY EDITION CONFIGURATION |
|
4 | ; RHODECODE COMMUNITY EDITION CONFIGURATION | |
5 | ; ######################################### |
|
5 | ; ######################################### | |
6 |
|
6 | |||
7 | [DEFAULT] |
|
7 | [DEFAULT] | |
8 | ; Debug flag sets all loggers to debug, and enables request tracking |
|
8 | ; Debug flag sets all loggers to debug, and enables request tracking | |
9 | debug = false |
|
9 | debug = false | |
10 |
|
10 | |||
11 | ; ######################################################################## |
|
11 | ; ######################################################################## | |
12 | ; EMAIL CONFIGURATION |
|
12 | ; EMAIL CONFIGURATION | |
13 | ; These settings will be used by the RhodeCode mailing system |
|
13 | ; These settings will be used by the RhodeCode mailing system | |
14 | ; ######################################################################## |
|
14 | ; ######################################################################## | |
15 |
|
15 | |||
16 | ; prefix all emails subjects with given prefix, helps filtering out emails |
|
16 | ; prefix all emails subjects with given prefix, helps filtering out emails | |
17 | #email_prefix = [RhodeCode] |
|
17 | #email_prefix = [RhodeCode] | |
18 |
|
18 | |||
19 | ; email FROM address all mails will be sent |
|
19 | ; email FROM address all mails will be sent | |
20 | #app_email_from = rhodecode-noreply@localhost |
|
20 | #app_email_from = rhodecode-noreply@localhost | |
21 |
|
21 | |||
22 | #smtp_server = mail.server.com |
|
22 | #smtp_server = mail.server.com | |
23 | #smtp_username = |
|
23 | #smtp_username = | |
24 | #smtp_password = |
|
24 | #smtp_password = | |
25 | #smtp_port = |
|
25 | #smtp_port = | |
26 | #smtp_use_tls = false |
|
26 | #smtp_use_tls = false | |
27 | #smtp_use_ssl = true |
|
27 | #smtp_use_ssl = true | |
28 |
|
28 | |||
29 | [server:main] |
|
29 | [server:main] | |
30 | ; COMMON HOST/IP CONFIG |
|
30 | ; COMMON HOST/IP CONFIG | |
31 | host = 127.0.0.1 |
|
31 | host = 127.0.0.1 | |
32 | port = 5000 |
|
32 | port = 5000 | |
33 |
|
33 | |||
34 |
|
34 | |||
35 | ; ########################### |
|
35 | ; ########################### | |
36 | ; GUNICORN APPLICATION SERVER |
|
36 | ; GUNICORN APPLICATION SERVER | |
37 | ; ########################### |
|
37 | ; ########################### | |
38 |
|
38 | |||
39 | ; run with gunicorn --paste rhodecode.ini |
|
39 | ; run with gunicorn --paste rhodecode.ini | |
40 |
|
40 | |||
41 | ; Module to use, this setting shouldn't be changed |
|
41 | ; Module to use, this setting shouldn't be changed | |
42 | use = egg:gunicorn#main |
|
42 | use = egg:gunicorn#main | |
43 |
|
43 | |||
44 | ; Sets the number of process workers. More workers means more concurrent connections |
|
44 | ; Sets the number of process workers. More workers means more concurrent connections | |
45 | ; RhodeCode can handle at the same time. Each additional worker also it increases |
|
45 | ; RhodeCode can handle at the same time. Each additional worker also it increases | |
46 | ; memory usage as each has it's own set of caches. |
|
46 | ; memory usage as each has it's own set of caches. | |
47 | ; Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more |
|
47 | ; Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more | |
48 | ; than 8-10 unless for really big deployments .e.g 700-1000 users. |
|
48 | ; than 8-10 unless for really big deployments .e.g 700-1000 users. | |
49 | ; `instance_id = *` must be set in the [app:main] section below (which is the default) |
|
49 | ; `instance_id = *` must be set in the [app:main] section below (which is the default) | |
50 | ; when using more than 1 worker. |
|
50 | ; when using more than 1 worker. | |
51 | workers = 2 |
|
51 | workers = 2 | |
52 |
|
52 | |||
53 | ; Gunicorn access log level |
|
53 | ; Gunicorn access log level | |
54 | loglevel = info |
|
54 | loglevel = info | |
55 |
|
55 | |||
56 | ; Process name visible in process list |
|
56 | ; Process name visible in process list | |
57 | proc_name = rhodecode |
|
57 | proc_name = rhodecode | |
58 |
|
58 | |||
59 | ; Type of worker class, one of `sync`, `gevent` |
|
59 | ; Type of worker class, one of `sync`, `gevent` | |
60 | ; Recommended type is `gevent` |
|
60 | ; Recommended type is `gevent` | |
61 | worker_class = gevent |
|
61 | worker_class = gevent | |
62 |
|
62 | |||
63 | ; The maximum number of simultaneous clients per worker. Valid only for gevent |
|
63 | ; The maximum number of simultaneous clients per worker. Valid only for gevent | |
64 | worker_connections = 10 |
|
64 | worker_connections = 10 | |
65 |
|
65 | |||
66 | ; Max number of requests that worker will handle before being gracefully restarted. |
|
66 | ; Max number of requests that worker will handle before being gracefully restarted. | |
67 | ; Prevents memory leaks, jitter adds variability so not all workers are restarted at once. |
|
67 | ; Prevents memory leaks, jitter adds variability so not all workers are restarted at once. | |
68 | max_requests = 1000 |
|
68 | max_requests = 1000 | |
69 | max_requests_jitter = 30 |
|
69 | max_requests_jitter = 30 | |
70 |
|
70 | |||
71 | ; Amount of time a worker can spend with handling a request before it |
|
71 | ; Amount of time a worker can spend with handling a request before it | |
72 | ; gets killed and restarted. By default set to 21600 (6hrs) |
|
72 | ; gets killed and restarted. By default set to 21600 (6hrs) | |
73 | ; Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h) |
|
73 | ; Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h) | |
74 | timeout = 21600 |
|
74 | timeout = 21600 | |
75 |
|
75 | |||
76 | ; The maximum size of HTTP request line in bytes. |
|
76 | ; The maximum size of HTTP request line in bytes. | |
77 | ; 0 for unlimited |
|
77 | ; 0 for unlimited | |
78 | limit_request_line = 0 |
|
78 | limit_request_line = 0 | |
79 |
|
79 | |||
80 | ; Limit the number of HTTP headers fields in a request. |
|
80 | ; Limit the number of HTTP headers fields in a request. | |
81 | ; By default this value is 100 and can't be larger than 32768. |
|
81 | ; By default this value is 100 and can't be larger than 32768. | |
82 | limit_request_fields = 32768 |
|
82 | limit_request_fields = 32768 | |
83 |
|
83 | |||
84 | ; Limit the allowed size of an HTTP request header field. |
|
84 | ; Limit the allowed size of an HTTP request header field. | |
85 | ; Value is a positive number or 0. |
|
85 | ; Value is a positive number or 0. | |
86 | ; Setting it to 0 will allow unlimited header field sizes. |
|
86 | ; Setting it to 0 will allow unlimited header field sizes. | |
87 | limit_request_field_size = 0 |
|
87 | limit_request_field_size = 0 | |
88 |
|
88 | |||
89 | ; Timeout for graceful workers restart. |
|
89 | ; Timeout for graceful workers restart. | |
90 | ; After receiving a restart signal, workers have this much time to finish |
|
90 | ; After receiving a restart signal, workers have this much time to finish | |
91 | ; serving requests. Workers still alive after the timeout (starting from the |
|
91 | ; serving requests. Workers still alive after the timeout (starting from the | |
92 | ; receipt of the restart signal) are force killed. |
|
92 | ; receipt of the restart signal) are force killed. | |
93 | ; Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h) |
|
93 | ; Examples: 1800 (30min), 3600 (1hr), 7200 (2hr), 43200 (12h) | |
94 | graceful_timeout = 3600 |
|
94 | graceful_timeout = 3600 | |
95 |
|
95 | |||
96 | # The number of seconds to wait for requests on a Keep-Alive connection. |
|
96 | # The number of seconds to wait for requests on a Keep-Alive connection. | |
97 | # Generally set in the 1-5 seconds range. |
|
97 | # Generally set in the 1-5 seconds range. | |
98 | keepalive = 2 |
|
98 | keepalive = 2 | |
99 |
|
99 | |||
100 | ; Maximum memory usage that each worker can use before it will receive a |
|
100 | ; Maximum memory usage that each worker can use before it will receive a | |
101 | ; graceful restart signal 0 = memory monitoring is disabled |
|
101 | ; graceful restart signal 0 = memory monitoring is disabled | |
102 | ; Examples: 268435456 (256MB), 536870912 (512MB) |
|
102 | ; Examples: 268435456 (256MB), 536870912 (512MB) | |
103 | ; 1073741824 (1GB), 2147483648 (2GB), 4294967296 (4GB) |
|
103 | ; 1073741824 (1GB), 2147483648 (2GB), 4294967296 (4GB) | |
104 | memory_max_usage = 0 |
|
104 | memory_max_usage = 0 | |
105 |
|
105 | |||
106 | ; How often in seconds to check for memory usage for each gunicorn worker |
|
106 | ; How often in seconds to check for memory usage for each gunicorn worker | |
107 | memory_usage_check_interval = 60 |
|
107 | memory_usage_check_interval = 60 | |
108 |
|
108 | |||
109 | ; Threshold value for which we don't recycle worker if GarbageCollection |
|
109 | ; Threshold value for which we don't recycle worker if GarbageCollection | |
110 | ; frees up enough resources. Before each restart we try to run GC on worker |
|
110 | ; frees up enough resources. Before each restart we try to run GC on worker | |
111 | ; in case we get enough free memory after that, restart will not happen. |
|
111 | ; in case we get enough free memory after that, restart will not happen. | |
112 | memory_usage_recovery_threshold = 0.8 |
|
112 | memory_usage_recovery_threshold = 0.8 | |
113 |
|
113 | |||
114 |
|
114 | |||
115 | ; Prefix middleware for RhodeCode. |
|
115 | ; Prefix middleware for RhodeCode. | |
116 | ; recommended when using proxy setup. |
|
116 | ; recommended when using proxy setup. | |
117 | ; allows to set RhodeCode under a prefix in server. |
|
117 | ; allows to set RhodeCode under a prefix in server. | |
118 | ; eg https://server.com/custom_prefix. Enable `filter-with =` option below as well. |
|
118 | ; eg https://server.com/custom_prefix. Enable `filter-with =` option below as well. | |
119 | ; And set your prefix like: `prefix = /custom_prefix` |
|
119 | ; And set your prefix like: `prefix = /custom_prefix` | |
120 | ; be sure to also set beaker.session.cookie_path = /custom_prefix if you need |
|
120 | ; be sure to also set beaker.session.cookie_path = /custom_prefix if you need | |
121 | ; to make your cookies only work on prefix url |
|
121 | ; to make your cookies only work on prefix url | |
122 | [filter:proxy-prefix] |
|
122 | [filter:proxy-prefix] | |
123 | use = egg:PasteDeploy#prefix |
|
123 | use = egg:PasteDeploy#prefix | |
124 | prefix = / |
|
124 | prefix = / | |
125 |
|
125 | |||
126 | [app:main] |
|
126 | [app:main] | |
127 | ; The %(here)s variable will be replaced with the absolute path of parent directory |
|
127 | ; The %(here)s variable will be replaced with the absolute path of parent directory | |
128 | ; of this file |
|
128 | ; of this file | |
129 | ; Each option in the app:main can be override by an environmental variable |
|
129 | ; Each option in the app:main can be override by an environmental variable | |
130 | ; |
|
130 | ; | |
131 | ;To override an option: |
|
131 | ;To override an option: | |
132 | ; |
|
132 | ; | |
133 | ;RC_<KeyName> |
|
133 | ;RC_<KeyName> | |
134 | ;Everything should be uppercase, . and - should be replaced by _. |
|
134 | ;Everything should be uppercase, . and - should be replaced by _. | |
135 | ;For example, if you have these configuration settings: |
|
135 | ;For example, if you have these configuration settings: | |
136 | ;rc_cache.repo_object.backend = foo |
|
136 | ;rc_cache.repo_object.backend = foo | |
137 | ;can be overridden by |
|
137 | ;can be overridden by | |
138 | ;export RC_CACHE_REPO_OBJECT_BACKEND=foo |
|
138 | ;export RC_CACHE_REPO_OBJECT_BACKEND=foo | |
139 |
|
139 | |||
140 | use = egg:rhodecode-enterprise-ce |
|
140 | use = egg:rhodecode-enterprise-ce | |
141 |
|
141 | |||
142 | ; enable proxy prefix middleware, defined above |
|
142 | ; enable proxy prefix middleware, defined above | |
143 | #filter-with = proxy-prefix |
|
143 | #filter-with = proxy-prefix | |
144 |
|
144 | |||
145 | ; encryption key used to encrypt social plugin tokens, |
|
145 | ; encryption key used to encrypt social plugin tokens, | |
146 | ; remote_urls with credentials etc, if not set it defaults to |
|
146 | ; remote_urls with credentials etc, if not set it defaults to | |
147 | ; `beaker.session.secret` |
|
147 | ; `beaker.session.secret` | |
148 | #rhodecode.encrypted_values.secret = |
|
148 | #rhodecode.encrypted_values.secret = | |
149 |
|
149 | |||
150 | ; decryption strict mode (enabled by default). It controls if decryption raises |
|
150 | ; decryption strict mode (enabled by default). It controls if decryption raises | |
151 | ; `SignatureVerificationError` in case of wrong key, or damaged encryption data. |
|
151 | ; `SignatureVerificationError` in case of wrong key, or damaged encryption data. | |
152 | #rhodecode.encrypted_values.strict = false |
|
152 | #rhodecode.encrypted_values.strict = false | |
153 |
|
153 | |||
154 | ; Pick algorithm for encryption. Either fernet (more secure) or aes (default) |
|
154 | ; Pick algorithm for encryption. Either fernet (more secure) or aes (default) | |
155 | ; fernet is safer, and we strongly recommend switching to it. |
|
155 | ; fernet is safer, and we strongly recommend switching to it. | |
156 | ; Due to backward compatibility aes is used as default. |
|
156 | ; Due to backward compatibility aes is used as default. | |
157 | #rhodecode.encrypted_values.algorithm = fernet |
|
157 | #rhodecode.encrypted_values.algorithm = fernet | |
158 |
|
158 | |||
159 | ; Return gzipped responses from RhodeCode (static files/application) |
|
159 | ; Return gzipped responses from RhodeCode (static files/application) | |
160 | gzip_responses = false |
|
160 | gzip_responses = false | |
161 |
|
161 | |||
162 | ; Auto-generate javascript routes file on startup |
|
162 | ; Auto-generate javascript routes file on startup | |
163 | generate_js_files = false |
|
163 | generate_js_files = false | |
164 |
|
164 | |||
165 | ; System global default language. |
|
165 | ; System global default language. | |
166 | ; All available languages: en (default), be, de, es, fr, it, ja, pl, pt, ru, zh |
|
166 | ; All available languages: en (default), be, de, es, fr, it, ja, pl, pt, ru, zh | |
167 | lang = en |
|
167 | lang = en | |
168 |
|
168 | |||
169 | ; Perform a full repository scan and import on each server start. |
|
169 | ; Perform a full repository scan and import on each server start. | |
170 | ; Settings this to true could lead to very long startup time. |
|
170 | ; Settings this to true could lead to very long startup time. | |
171 | startup.import_repos = false |
|
171 | startup.import_repos = false | |
172 |
|
172 | |||
173 | ; Uncomment and set this path to use archive download cache. |
|
173 | ; Uncomment and set this path to use archive download cache. | |
174 | ; Once enabled, generated archives will be cached at this location |
|
174 | ; Once enabled, generated archives will be cached at this location | |
175 | ; and served from the cache during subsequent requests for the same archive of |
|
175 | ; and served from the cache during subsequent requests for the same archive of | |
176 | ; the repository. |
|
176 | ; the repository. | |
177 | #archive_cache_dir = /tmp/tarballcache |
|
177 | #archive_cache_dir = /tmp/tarballcache | |
178 |
|
178 | |||
179 | ; URL at which the application is running. This is used for Bootstrapping |
|
179 | ; URL at which the application is running. This is used for Bootstrapping | |
180 | ; requests in context when no web request is available. Used in ishell, or |
|
180 | ; requests in context when no web request is available. Used in ishell, or | |
181 | ; SSH calls. Set this for events to receive proper url for SSH calls. |
|
181 | ; SSH calls. Set this for events to receive proper url for SSH calls. | |
182 | app.base_url = http://rhodecode.local |
|
182 | app.base_url = http://rhodecode.local | |
183 |
|
183 | |||
184 | ; Unique application ID. Should be a random unique string for security. |
|
184 | ; Unique application ID. Should be a random unique string for security. | |
185 | app_instance_uuid = rc-production |
|
185 | app_instance_uuid = rc-production | |
186 |
|
186 | |||
187 | ; Cut off limit for large diffs (size in bytes). If overall diff size on |
|
187 | ; Cut off limit for large diffs (size in bytes). If overall diff size on | |
188 | ; commit, or pull request exceeds this limit this diff will be displayed |
|
188 | ; commit, or pull request exceeds this limit this diff will be displayed | |
189 | ; partially. E.g 512000 == 512Kb |
|
189 | ; partially. E.g 512000 == 512Kb | |
190 | cut_off_limit_diff = 512000 |
|
190 | cut_off_limit_diff = 512000 | |
191 |
|
191 | |||
192 | ; Cut off limit for large files inside diffs (size in bytes). Each individual |
|
192 | ; Cut off limit for large files inside diffs (size in bytes). Each individual | |
193 | ; file inside diff which exceeds this limit will be displayed partially. |
|
193 | ; file inside diff which exceeds this limit will be displayed partially. | |
194 | ; E.g 128000 == 128Kb |
|
194 | ; E.g 128000 == 128Kb | |
195 | cut_off_limit_file = 128000 |
|
195 | cut_off_limit_file = 128000 | |
196 |
|
196 | |||
197 | ; Use cached version of vcs repositories everywhere. Recommended to be `true` |
|
197 | ; Use cached version of vcs repositories everywhere. Recommended to be `true` | |
198 | vcs_full_cache = true |
|
198 | vcs_full_cache = true | |
199 |
|
199 | |||
200 | ; Force https in RhodeCode, fixes https redirects, assumes it's always https. |
|
200 | ; Force https in RhodeCode, fixes https redirects, assumes it's always https. | |
201 | ; Normally this is controlled by proper flags sent from http server such as Nginx or Apache |
|
201 | ; Normally this is controlled by proper flags sent from http server such as Nginx or Apache | |
202 | force_https = false |
|
202 | force_https = false | |
203 |
|
203 | |||
204 | ; use Strict-Transport-Security headers |
|
204 | ; use Strict-Transport-Security headers | |
205 | use_htsts = false |
|
205 | use_htsts = false | |
206 |
|
206 | |||
207 | ; Set to true if your repos are exposed using the dumb protocol |
|
207 | ; Set to true if your repos are exposed using the dumb protocol | |
208 | git_update_server_info = false |
|
208 | git_update_server_info = false | |
209 |
|
209 | |||
210 | ; RSS/ATOM feed options |
|
210 | ; RSS/ATOM feed options | |
211 | rss_cut_off_limit = 256000 |
|
211 | rss_cut_off_limit = 256000 | |
212 | rss_items_per_page = 10 |
|
212 | rss_items_per_page = 10 | |
213 | rss_include_diff = false |
|
213 | rss_include_diff = false | |
214 |
|
214 | |||
215 | ; gist URL alias, used to create nicer urls for gist. This should be an |
|
215 | ; gist URL alias, used to create nicer urls for gist. This should be an | |
216 | ; url that does rewrites to _admin/gists/{gistid}. |
|
216 | ; url that does rewrites to _admin/gists/{gistid}. | |
217 | ; example: http://gist.rhodecode.org/{gistid}. Empty means use the internal |
|
217 | ; example: http://gist.rhodecode.org/{gistid}. Empty means use the internal | |
218 | ; RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid} |
|
218 | ; RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid} | |
219 | gist_alias_url = |
|
219 | gist_alias_url = | |
220 |
|
220 | |||
221 | ; List of views (using glob pattern syntax) that AUTH TOKENS could be |
|
221 | ; List of views (using glob pattern syntax) that AUTH TOKENS could be | |
222 | ; used for access. |
|
222 | ; used for access. | |
223 | ; Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it |
|
223 | ; Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it | |
224 | ; came from the the logged in user who own this authentication token. |
|
224 | ; came from the the logged in user who own this authentication token. | |
225 | ; Additionally @TOKEN syntax can be used to bound the view to specific |
|
225 | ; Additionally @TOKEN syntax can be used to bound the view to specific | |
226 | ; authentication token. Such view would be only accessible when used together |
|
226 | ; authentication token. Such view would be only accessible when used together | |
227 | ; with this authentication token |
|
227 | ; with this authentication token | |
228 | ; list of all views can be found under `/_admin/permissions/auth_token_access` |
|
228 | ; list of all views can be found under `/_admin/permissions/auth_token_access` | |
229 | ; The list should be "," separated and on a single line. |
|
229 | ; The list should be "," separated and on a single line. | |
230 | ; Most common views to enable: |
|
230 | ; Most common views to enable: | |
231 |
|
231 | |||
232 | # RepoCommitsView:repo_commit_download |
|
232 | # RepoCommitsView:repo_commit_download | |
233 | # RepoCommitsView:repo_commit_patch |
|
233 | # RepoCommitsView:repo_commit_patch | |
234 | # RepoCommitsView:repo_commit_raw |
|
234 | # RepoCommitsView:repo_commit_raw | |
235 | # RepoCommitsView:repo_commit_raw@TOKEN |
|
235 | # RepoCommitsView:repo_commit_raw@TOKEN | |
236 | # RepoFilesView:repo_files_diff |
|
236 | # RepoFilesView:repo_files_diff | |
237 | # RepoFilesView:repo_archivefile |
|
237 | # RepoFilesView:repo_archivefile | |
238 | # RepoFilesView:repo_file_raw |
|
238 | # RepoFilesView:repo_file_raw | |
239 | # GistView:* |
|
239 | # GistView:* | |
240 | api_access_controllers_whitelist = |
|
240 | api_access_controllers_whitelist = | |
241 |
|
241 | |||
242 | ; Default encoding used to convert from and to unicode |
|
242 | ; Default encoding used to convert from and to unicode | |
243 | ; can be also a comma separated list of encoding in case of mixed encodings |
|
243 | ; can be also a comma separated list of encoding in case of mixed encodings | |
244 | default_encoding = UTF-8 |
|
244 | default_encoding = UTF-8 | |
245 |
|
245 | |||
246 | ; instance-id prefix |
|
246 | ; instance-id prefix | |
247 | ; a prefix key for this instance used for cache invalidation when running |
|
247 | ; a prefix key for this instance used for cache invalidation when running | |
248 | ; multiple instances of RhodeCode, make sure it's globally unique for |
|
248 | ; multiple instances of RhodeCode, make sure it's globally unique for | |
249 | ; all running RhodeCode instances. Leave empty if you don't use it |
|
249 | ; all running RhodeCode instances. Leave empty if you don't use it | |
250 | instance_id = |
|
250 | instance_id = | |
251 |
|
251 | |||
252 | ; Fallback authentication plugin. Set this to a plugin ID to force the usage |
|
252 | ; Fallback authentication plugin. Set this to a plugin ID to force the usage | |
253 | ; of an authentication plugin also if it is disabled by it's settings. |
|
253 | ; of an authentication plugin also if it is disabled by it's settings. | |
254 | ; This could be useful if you are unable to log in to the system due to broken |
|
254 | ; This could be useful if you are unable to log in to the system due to broken | |
255 | ; authentication settings. Then you can enable e.g. the internal RhodeCode auth |
|
255 | ; authentication settings. Then you can enable e.g. the internal RhodeCode auth | |
256 | ; module to log in again and fix the settings. |
|
256 | ; module to log in again and fix the settings. | |
257 | ; Available builtin plugin IDs (hash is part of the ID): |
|
257 | ; Available builtin plugin IDs (hash is part of the ID): | |
258 | ; egg:rhodecode-enterprise-ce#rhodecode |
|
258 | ; egg:rhodecode-enterprise-ce#rhodecode | |
259 | ; egg:rhodecode-enterprise-ce#pam |
|
259 | ; egg:rhodecode-enterprise-ce#pam | |
260 | ; egg:rhodecode-enterprise-ce#ldap |
|
260 | ; egg:rhodecode-enterprise-ce#ldap | |
261 | ; egg:rhodecode-enterprise-ce#jasig_cas |
|
261 | ; egg:rhodecode-enterprise-ce#jasig_cas | |
262 | ; egg:rhodecode-enterprise-ce#headers |
|
262 | ; egg:rhodecode-enterprise-ce#headers | |
263 | ; egg:rhodecode-enterprise-ce#crowd |
|
263 | ; egg:rhodecode-enterprise-ce#crowd | |
264 |
|
264 | |||
265 | #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode |
|
265 | #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode | |
266 |
|
266 | |||
267 | ; Flag to control loading of legacy plugins in py:/path format |
|
267 | ; Flag to control loading of legacy plugins in py:/path format | |
268 | auth_plugin.import_legacy_plugins = true |
|
268 | auth_plugin.import_legacy_plugins = true | |
269 |
|
269 | |||
270 | ; alternative return HTTP header for failed authentication. Default HTTP |
|
270 | ; alternative return HTTP header for failed authentication. Default HTTP | |
271 | ; response is 401 HTTPUnauthorized. Currently HG clients have troubles with |
|
271 | ; response is 401 HTTPUnauthorized. Currently HG clients have troubles with | |
272 | ; handling that causing a series of failed authentication calls. |
|
272 | ; handling that causing a series of failed authentication calls. | |
273 | ; Set this variable to 403 to return HTTPForbidden, or any other HTTP code |
|
273 | ; Set this variable to 403 to return HTTPForbidden, or any other HTTP code | |
274 | ; This will be served instead of default 401 on bad authentication |
|
274 | ; This will be served instead of default 401 on bad authentication | |
275 | auth_ret_code = |
|
275 | auth_ret_code = | |
276 |
|
276 | |||
277 | ; use special detection method when serving auth_ret_code, instead of serving |
|
277 | ; use special detection method when serving auth_ret_code, instead of serving | |
278 | ; ret_code directly, use 401 initially (Which triggers credentials prompt) |
|
278 | ; ret_code directly, use 401 initially (Which triggers credentials prompt) | |
279 | ; and then serve auth_ret_code to clients |
|
279 | ; and then serve auth_ret_code to clients | |
280 | auth_ret_code_detection = false |
|
280 | auth_ret_code_detection = false | |
281 |
|
281 | |||
282 | ; locking return code. When repository is locked return this HTTP code. 2XX |
|
282 | ; locking return code. When repository is locked return this HTTP code. 2XX | |
283 | ; codes don't break the transactions while 4XX codes do |
|
283 | ; codes don't break the transactions while 4XX codes do | |
284 | lock_ret_code = 423 |
|
284 | lock_ret_code = 423 | |
285 |
|
285 | |||
286 | ; allows to change the repository location in settings page |
|
286 | ; allows to change the repository location in settings page | |
287 | allow_repo_location_change = true |
|
287 | allow_repo_location_change = true | |
288 |
|
288 | |||
289 | ; allows to setup custom hooks in settings page |
|
289 | ; allows to setup custom hooks in settings page | |
290 | allow_custom_hooks_settings = true |
|
290 | allow_custom_hooks_settings = true | |
291 |
|
291 | |||
292 | ; Generated license token required for EE edition license. |
|
292 | ; Generated license token required for EE edition license. | |
293 | ; New generated token value can be found in Admin > settings > license page. |
|
293 | ; New generated token value can be found in Admin > settings > license page. | |
294 | license_token = |
|
294 | license_token = | |
295 |
|
295 | |||
296 | ; This flag hides sensitive information on the license page such as token, and license data |
|
296 | ; This flag hides sensitive information on the license page such as token, and license data | |
297 | license.hide_license_info = false |
|
297 | license.hide_license_info = false | |
298 |
|
298 | |||
299 | ; supervisor connection uri, for managing supervisor and logs. |
|
299 | ; supervisor connection uri, for managing supervisor and logs. | |
300 | supervisor.uri = |
|
300 | supervisor.uri = | |
301 |
|
301 | |||
302 | ; supervisord group name/id we only want this RC instance to handle |
|
302 | ; supervisord group name/id we only want this RC instance to handle | |
303 | supervisor.group_id = prod |
|
303 | supervisor.group_id = prod | |
304 |
|
304 | |||
305 | ; Display extended labs settings |
|
305 | ; Display extended labs settings | |
306 | labs_settings_active = true |
|
306 | labs_settings_active = true | |
307 |
|
307 | |||
308 | ; Custom exception store path, defaults to TMPDIR |
|
308 | ; Custom exception store path, defaults to TMPDIR | |
309 | ; This is used to store exception from RhodeCode in shared directory |
|
309 | ; This is used to store exception from RhodeCode in shared directory | |
310 | #exception_tracker.store_path = |
|
310 | #exception_tracker.store_path = | |
311 |
|
311 | |||
312 | ; Send email with exception details when it happens |
|
312 | ; Send email with exception details when it happens | |
313 | #exception_tracker.send_email = false |
|
313 | #exception_tracker.send_email = false | |
314 |
|
314 | |||
315 | ; Comma separated list of recipients for exception emails, |
|
315 | ; Comma separated list of recipients for exception emails, | |
316 | ; e.g admin@rhodecode.com,devops@rhodecode.com |
|
316 | ; e.g admin@rhodecode.com,devops@rhodecode.com | |
317 | ; Can be left empty, then emails will be sent to ALL super-admins |
|
317 | ; Can be left empty, then emails will be sent to ALL super-admins | |
318 | #exception_tracker.send_email_recipients = |
|
318 | #exception_tracker.send_email_recipients = | |
319 |
|
319 | |||
320 | ; optional prefix to Add to email Subject |
|
320 | ; optional prefix to Add to email Subject | |
321 | #exception_tracker.email_prefix = [RHODECODE ERROR] |
|
321 | #exception_tracker.email_prefix = [RHODECODE ERROR] | |
322 |
|
322 | |||
323 | ; File store configuration. This is used to store and serve uploaded files |
|
323 | ; File store configuration. This is used to store and serve uploaded files | |
324 | file_store.enabled = true |
|
324 | file_store.enabled = true | |
325 |
|
325 | |||
326 | ; Storage backend, available options are: local |
|
326 | ; Storage backend, available options are: local | |
327 | file_store.backend = local |
|
327 | file_store.backend = local | |
328 |
|
328 | |||
329 | ; path to store the uploaded binaries |
|
329 | ; path to store the uploaded binaries | |
330 | file_store.storage_path = %(here)s/data/file_store |
|
330 | file_store.storage_path = %(here)s/data/file_store | |
331 |
|
331 | |||
332 |
|
332 | |||
333 | ; ############# |
|
333 | ; ############# | |
334 | ; CELERY CONFIG |
|
334 | ; CELERY CONFIG | |
335 | ; ############# |
|
335 | ; ############# | |
336 |
|
336 | |||
337 | ; manually run celery: /path/to/celery worker --task-events --beat --app rhodecode.lib.celerylib.loader --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler --loglevel DEBUG --ini /path/to/rhodecode.ini |
|
337 | ; manually run celery: /path/to/celery worker --task-events --beat --app rhodecode.lib.celerylib.loader --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler --loglevel DEBUG --ini /path/to/rhodecode.ini | |
338 |
|
338 | |||
339 | use_celery = false |
|
339 | use_celery = false | |
340 |
|
340 | |||
341 | ; path to store schedule database |
|
341 | ; path to store schedule database | |
342 | #celerybeat-schedule.path = |
|
342 | #celerybeat-schedule.path = | |
343 |
|
343 | |||
344 | ; connection url to the message broker (default redis) |
|
344 | ; connection url to the message broker (default redis) | |
345 | celery.broker_url = redis://localhost:6379/8 |
|
345 | celery.broker_url = redis://localhost:6379/8 | |
346 |
|
346 | |||
347 | ; rabbitmq example |
|
347 | ; rabbitmq example | |
348 | #celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost |
|
348 | #celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost | |
349 |
|
349 | |||
350 | ; maximum tasks to execute before worker restart |
|
350 | ; maximum tasks to execute before worker restart | |
351 | celery.max_tasks_per_child = 100 |
|
351 | celery.max_tasks_per_child = 100 | |
352 |
|
352 | |||
353 | ; tasks will never be sent to the queue, but executed locally instead. |
|
353 | ; tasks will never be sent to the queue, but executed locally instead. | |
354 | celery.task_always_eager = false |
|
354 | celery.task_always_eager = false | |
355 |
|
355 | |||
356 | ; ############# |
|
356 | ; ############# | |
357 | ; DOGPILE CACHE |
|
357 | ; DOGPILE CACHE | |
358 | ; ############# |
|
358 | ; ############# | |
359 |
|
359 | |||
360 | ; Default cache dir for caches. Putting this into a ramdisk can boost performance. |
|
360 | ; Default cache dir for caches. Putting this into a ramdisk can boost performance. | |
361 | ; eg. /tmpfs/data_ramdisk, however this directory might require large amount of space |
|
361 | ; eg. /tmpfs/data_ramdisk, however this directory might require large amount of space | |
362 | cache_dir = %(here)s/data |
|
362 | cache_dir = %(here)s/data | |
363 |
|
363 | |||
364 | ; ********************************************* |
|
364 | ; ********************************************* | |
365 | ; `sql_cache_short` cache for heavy SQL queries |
|
365 | ; `sql_cache_short` cache for heavy SQL queries | |
366 | ; Only supported backend is `memory_lru` |
|
366 | ; Only supported backend is `memory_lru` | |
367 | ; ********************************************* |
|
367 | ; ********************************************* | |
368 | rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru |
|
368 | rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru | |
369 | rc_cache.sql_cache_short.expiration_time = 30 |
|
369 | rc_cache.sql_cache_short.expiration_time = 30 | |
370 |
|
370 | |||
371 |
|
371 | |||
372 | ; ***************************************************** |
|
372 | ; ***************************************************** | |
373 | ; `cache_repo_longterm` cache for repo object instances |
|
373 | ; `cache_repo_longterm` cache for repo object instances | |
374 | ; Only supported backend is `memory_lru` |
|
374 | ; Only supported backend is `memory_lru` | |
375 | ; ***************************************************** |
|
375 | ; ***************************************************** | |
376 | rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru |
|
376 | rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru | |
377 | ; by default we use 30 Days, cache is still invalidated on push |
|
377 | ; by default we use 30 Days, cache is still invalidated on push | |
378 | rc_cache.cache_repo_longterm.expiration_time = 2592000 |
|
378 | rc_cache.cache_repo_longterm.expiration_time = 2592000 | |
379 | ; max items in LRU cache, set to smaller number to save memory, and expire last used caches |
|
379 | ; max items in LRU cache, set to smaller number to save memory, and expire last used caches | |
380 | rc_cache.cache_repo_longterm.max_size = 10000 |
|
380 | rc_cache.cache_repo_longterm.max_size = 10000 | |
381 |
|
381 | |||
382 |
|
382 | |||
383 | ; ********************************************* |
|
383 | ; ********************************************* | |
384 | ; `cache_general` cache for general purpose use |
|
384 | ; `cache_general` cache for general purpose use | |
385 | ; for simplicity use rc.file_namespace backend, |
|
385 | ; for simplicity use rc.file_namespace backend, | |
386 | ; for performance and scale use rc.redis |
|
386 | ; for performance and scale use rc.redis | |
387 | ; ********************************************* |
|
387 | ; ********************************************* | |
388 | rc_cache.cache_general.backend = dogpile.cache.rc.file_namespace |
|
388 | rc_cache.cache_general.backend = dogpile.cache.rc.file_namespace | |
389 | rc_cache.cache_general.expiration_time = 43200 |
|
389 | rc_cache.cache_general.expiration_time = 43200 | |
390 | ; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set |
|
390 | ; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set | |
391 | #rc_cache.cache_general.arguments.filename = /tmp/cache_general.db |
|
391 | #rc_cache.cache_general.arguments.filename = /tmp/cache_general.db | |
392 |
|
392 | |||
393 | ; alternative `cache_general` redis backend with distributed lock |
|
393 | ; alternative `cache_general` redis backend with distributed lock | |
394 | #rc_cache.cache_general.backend = dogpile.cache.rc.redis |
|
394 | #rc_cache.cache_general.backend = dogpile.cache.rc.redis | |
395 | #rc_cache.cache_general.expiration_time = 300 |
|
395 | #rc_cache.cache_general.expiration_time = 300 | |
396 |
|
396 | |||
397 | ; redis_expiration_time needs to be greater then expiration_time |
|
397 | ; redis_expiration_time needs to be greater then expiration_time | |
398 | #rc_cache.cache_general.arguments.redis_expiration_time = 7200 |
|
398 | #rc_cache.cache_general.arguments.redis_expiration_time = 7200 | |
399 |
|
399 | |||
400 | #rc_cache.cache_general.arguments.host = localhost |
|
400 | #rc_cache.cache_general.arguments.host = localhost | |
401 | #rc_cache.cache_general.arguments.port = 6379 |
|
401 | #rc_cache.cache_general.arguments.port = 6379 | |
402 | #rc_cache.cache_general.arguments.db = 0 |
|
402 | #rc_cache.cache_general.arguments.db = 0 | |
403 | #rc_cache.cache_general.arguments.socket_timeout = 30 |
|
403 | #rc_cache.cache_general.arguments.socket_timeout = 30 | |
404 | ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends |
|
404 | ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends | |
405 | #rc_cache.cache_general.arguments.distributed_lock = true |
|
405 | #rc_cache.cache_general.arguments.distributed_lock = true | |
406 |
|
406 | |||
407 | ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen |
|
407 | ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen | |
408 | #rc_cache.cache_general.arguments.lock_auto_renewal = true |
|
408 | #rc_cache.cache_general.arguments.lock_auto_renewal = true | |
409 |
|
409 | |||
410 | ; ************************************************* |
|
410 | ; ************************************************* | |
411 | ; `cache_perms` cache for permission tree, auth TTL |
|
411 | ; `cache_perms` cache for permission tree, auth TTL | |
412 | ; for simplicity use rc.file_namespace backend, |
|
412 | ; for simplicity use rc.file_namespace backend, | |
413 | ; for performance and scale use rc.redis |
|
413 | ; for performance and scale use rc.redis | |
414 | ; ************************************************* |
|
414 | ; ************************************************* | |
415 | rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace |
|
415 | rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace | |
416 | rc_cache.cache_perms.expiration_time = 3600 |
|
416 | rc_cache.cache_perms.expiration_time = 3600 | |
417 | ; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set |
|
417 | ; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set | |
418 | #rc_cache.cache_perms.arguments.filename = /tmp/cache_perms.db |
|
418 | #rc_cache.cache_perms.arguments.filename = /tmp/cache_perms.db | |
419 |
|
419 | |||
420 | ; alternative `cache_perms` redis backend with distributed lock |
|
420 | ; alternative `cache_perms` redis backend with distributed lock | |
421 | #rc_cache.cache_perms.backend = dogpile.cache.rc.redis |
|
421 | #rc_cache.cache_perms.backend = dogpile.cache.rc.redis | |
422 | #rc_cache.cache_perms.expiration_time = 300 |
|
422 | #rc_cache.cache_perms.expiration_time = 300 | |
423 |
|
423 | |||
424 | ; redis_expiration_time needs to be greater then expiration_time |
|
424 | ; redis_expiration_time needs to be greater then expiration_time | |
425 | #rc_cache.cache_perms.arguments.redis_expiration_time = 7200 |
|
425 | #rc_cache.cache_perms.arguments.redis_expiration_time = 7200 | |
426 |
|
426 | |||
427 | #rc_cache.cache_perms.arguments.host = localhost |
|
427 | #rc_cache.cache_perms.arguments.host = localhost | |
428 | #rc_cache.cache_perms.arguments.port = 6379 |
|
428 | #rc_cache.cache_perms.arguments.port = 6379 | |
429 | #rc_cache.cache_perms.arguments.db = 0 |
|
429 | #rc_cache.cache_perms.arguments.db = 0 | |
430 | #rc_cache.cache_perms.arguments.socket_timeout = 30 |
|
430 | #rc_cache.cache_perms.arguments.socket_timeout = 30 | |
431 | ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends |
|
431 | ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends | |
432 | #rc_cache.cache_perms.arguments.distributed_lock = true |
|
432 | #rc_cache.cache_perms.arguments.distributed_lock = true | |
433 |
|
433 | |||
434 | ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen |
|
434 | ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen | |
435 | #rc_cache.cache_perms.arguments.lock_auto_renewal = true |
|
435 | #rc_cache.cache_perms.arguments.lock_auto_renewal = true | |
436 |
|
436 | |||
437 | ; *************************************************** |
|
437 | ; *************************************************** | |
438 | ; `cache_repo` cache for file tree, Readme, RSS FEEDS |
|
438 | ; `cache_repo` cache for file tree, Readme, RSS FEEDS | |
439 | ; for simplicity use rc.file_namespace backend, |
|
439 | ; for simplicity use rc.file_namespace backend, | |
440 | ; for performance and scale use rc.redis |
|
440 | ; for performance and scale use rc.redis | |
441 | ; *************************************************** |
|
441 | ; *************************************************** | |
442 | rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace |
|
442 | rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace | |
443 | rc_cache.cache_repo.expiration_time = 2592000 |
|
443 | rc_cache.cache_repo.expiration_time = 2592000 | |
444 | ; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set |
|
444 | ; file cache store path. Defaults to `cache_dir =` value or tempdir if both values are not set | |
445 | #rc_cache.cache_repo.arguments.filename = /tmp/cache_repo.db |
|
445 | #rc_cache.cache_repo.arguments.filename = /tmp/cache_repo.db | |
446 |
|
446 | |||
447 | ; alternative `cache_repo` redis backend with distributed lock |
|
447 | ; alternative `cache_repo` redis backend with distributed lock | |
448 | #rc_cache.cache_repo.backend = dogpile.cache.rc.redis |
|
448 | #rc_cache.cache_repo.backend = dogpile.cache.rc.redis | |
449 | #rc_cache.cache_repo.expiration_time = 2592000 |
|
449 | #rc_cache.cache_repo.expiration_time = 2592000 | |
450 |
|
450 | |||
451 | ; redis_expiration_time needs to be greater then expiration_time |
|
451 | ; redis_expiration_time needs to be greater then expiration_time | |
452 | #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400 |
|
452 | #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400 | |
453 |
|
453 | |||
454 | #rc_cache.cache_repo.arguments.host = localhost |
|
454 | #rc_cache.cache_repo.arguments.host = localhost | |
455 | #rc_cache.cache_repo.arguments.port = 6379 |
|
455 | #rc_cache.cache_repo.arguments.port = 6379 | |
456 | #rc_cache.cache_repo.arguments.db = 1 |
|
456 | #rc_cache.cache_repo.arguments.db = 1 | |
457 | #rc_cache.cache_repo.arguments.socket_timeout = 30 |
|
457 | #rc_cache.cache_repo.arguments.socket_timeout = 30 | |
458 | ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends |
|
458 | ; more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends | |
459 | #rc_cache.cache_repo.arguments.distributed_lock = true |
|
459 | #rc_cache.cache_repo.arguments.distributed_lock = true | |
460 |
|
460 | |||
461 | ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen |
|
461 | ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen | |
462 | #rc_cache.cache_repo.arguments.lock_auto_renewal = true |
|
462 | #rc_cache.cache_repo.arguments.lock_auto_renewal = true | |
463 |
|
463 | |||
464 | ; ############## |
|
464 | ; ############## | |
465 | ; BEAKER SESSION |
|
465 | ; BEAKER SESSION | |
466 | ; ############## |
|
466 | ; ############## | |
467 |
|
467 | |||
468 | ; beaker.session.type is type of storage options for the logged users sessions. Current allowed |
|
468 | ; beaker.session.type is type of storage options for the logged users sessions. Current allowed | |
469 | ; types are file, ext:redis, ext:database, ext:memcached, and memory (default if not specified). |
|
469 | ; types are file, ext:redis, ext:database, ext:memcached, and memory (default if not specified). | |
470 | ; Fastest ones are Redis and ext:database |
|
470 | ; Fastest ones are Redis and ext:database | |
471 | beaker.session.type = file |
|
471 | beaker.session.type = file | |
472 | beaker.session.data_dir = %(here)s/data/sessions |
|
472 | beaker.session.data_dir = %(here)s/data/sessions | |
473 |
|
473 | |||
474 | ; Redis based sessions |
|
474 | ; Redis based sessions | |
475 | #beaker.session.type = ext:redis |
|
475 | #beaker.session.type = ext:redis | |
476 | #beaker.session.url = redis://127.0.0.1:6379/2 |
|
476 | #beaker.session.url = redis://127.0.0.1:6379/2 | |
477 |
|
477 | |||
478 | ; DB based session, fast, and allows easy management over logged in users |
|
478 | ; DB based session, fast, and allows easy management over logged in users | |
479 | #beaker.session.type = ext:database |
|
479 | #beaker.session.type = ext:database | |
480 | #beaker.session.table_name = db_session |
|
480 | #beaker.session.table_name = db_session | |
481 | #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode |
|
481 | #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode | |
482 | #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode |
|
482 | #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode | |
483 | #beaker.session.sa.pool_recycle = 3600 |
|
483 | #beaker.session.sa.pool_recycle = 3600 | |
484 | #beaker.session.sa.echo = false |
|
484 | #beaker.session.sa.echo = false | |
485 |
|
485 | |||
486 | beaker.session.key = rhodecode |
|
486 | beaker.session.key = rhodecode | |
487 | beaker.session.secret = production-rc-uytcxaz |
|
487 | beaker.session.secret = production-rc-uytcxaz | |
488 | beaker.session.lock_dir = %(here)s/data/sessions/lock |
|
488 | beaker.session.lock_dir = %(here)s/data/sessions/lock | |
489 |
|
489 | |||
490 | ; Secure encrypted cookie. Requires AES and AES python libraries |
|
490 | ; Secure encrypted cookie. Requires AES and AES python libraries | |
491 | ; you must disable beaker.session.secret to use this |
|
491 | ; you must disable beaker.session.secret to use this | |
492 | #beaker.session.encrypt_key = key_for_encryption |
|
492 | #beaker.session.encrypt_key = key_for_encryption | |
493 | #beaker.session.validate_key = validation_key |
|
493 | #beaker.session.validate_key = validation_key | |
494 |
|
494 | |||
495 | ; Sets session as invalid (also logging out user) if it haven not been |
|
495 | ; Sets session as invalid (also logging out user) if it haven not been | |
496 | ; accessed for given amount of time in seconds |
|
496 | ; accessed for given amount of time in seconds | |
497 | beaker.session.timeout = 2592000 |
|
497 | beaker.session.timeout = 2592000 | |
498 | beaker.session.httponly = true |
|
498 | beaker.session.httponly = true | |
499 |
|
499 | |||
500 | ; Path to use for the cookie. Set to prefix if you use prefix middleware |
|
500 | ; Path to use for the cookie. Set to prefix if you use prefix middleware | |
501 | #beaker.session.cookie_path = /custom_prefix |
|
501 | #beaker.session.cookie_path = /custom_prefix | |
502 |
|
502 | |||
503 | ; Set https secure cookie |
|
503 | ; Set https secure cookie | |
504 | beaker.session.secure = false |
|
504 | beaker.session.secure = false | |
505 |
|
505 | |||
506 | ; default cookie expiration time in seconds, set to `true` to set expire |
|
506 | ; default cookie expiration time in seconds, set to `true` to set expire | |
507 | ; at browser close |
|
507 | ; at browser close | |
508 | #beaker.session.cookie_expires = 3600 |
|
508 | #beaker.session.cookie_expires = 3600 | |
509 |
|
509 | |||
510 | ; ############################# |
|
510 | ; ############################# | |
511 | ; SEARCH INDEXING CONFIGURATION |
|
511 | ; SEARCH INDEXING CONFIGURATION | |
512 | ; ############################# |
|
512 | ; ############################# | |
513 |
|
513 | |||
514 | ; Full text search indexer is available in rhodecode-tools under |
|
514 | ; Full text search indexer is available in rhodecode-tools under | |
515 | ; `rhodecode-tools index` command |
|
515 | ; `rhodecode-tools index` command | |
516 |
|
516 | |||
517 | ; WHOOSH Backend, doesn't require additional services to run |
|
517 | ; WHOOSH Backend, doesn't require additional services to run | |
518 | ; it works good with few dozen repos |
|
518 | ; it works good with few dozen repos | |
519 | search.module = rhodecode.lib.index.whoosh |
|
519 | search.module = rhodecode.lib.index.whoosh | |
520 | search.location = %(here)s/data/index |
|
520 | search.location = %(here)s/data/index | |
521 |
|
521 | |||
522 | ; #################### |
|
522 | ; #################### | |
523 | ; CHANNELSTREAM CONFIG |
|
523 | ; CHANNELSTREAM CONFIG | |
524 | ; #################### |
|
524 | ; #################### | |
525 |
|
525 | |||
526 | ; channelstream enables persistent connections and live notification |
|
526 | ; channelstream enables persistent connections and live notification | |
527 | ; in the system. It's also used by the chat system |
|
527 | ; in the system. It's also used by the chat system | |
528 |
|
528 | |||
529 | channelstream.enabled = false |
|
529 | channelstream.enabled = false | |
530 |
|
530 | |||
531 | ; server address for channelstream server on the backend |
|
531 | ; server address for channelstream server on the backend | |
532 | channelstream.server = 127.0.0.1:9800 |
|
532 | channelstream.server = 127.0.0.1:9800 | |
533 |
|
533 | |||
534 | ; location of the channelstream server from outside world |
|
534 | ; location of the channelstream server from outside world | |
535 | ; use ws:// for http or wss:// for https. This address needs to be handled |
|
535 | ; use ws:// for http or wss:// for https. This address needs to be handled | |
536 | ; by external HTTP server such as Nginx or Apache |
|
536 | ; by external HTTP server such as Nginx or Apache | |
537 | ; see Nginx/Apache configuration examples in our docs |
|
537 | ; see Nginx/Apache configuration examples in our docs | |
538 | channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream |
|
538 | channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream | |
539 | channelstream.secret = secret |
|
539 | channelstream.secret = secret | |
540 | channelstream.history.location = %(here)s/channelstream_history |
|
540 | channelstream.history.location = %(here)s/channelstream_history | |
541 |
|
541 | |||
542 | ; Internal application path that Javascript uses to connect into. |
|
542 | ; Internal application path that Javascript uses to connect into. | |
543 | ; If you use proxy-prefix the prefix should be added before /_channelstream |
|
543 | ; If you use proxy-prefix the prefix should be added before /_channelstream | |
544 | channelstream.proxy_path = /_channelstream |
|
544 | channelstream.proxy_path = /_channelstream | |
545 |
|
545 | |||
546 |
|
546 | |||
547 | ; ############################## |
|
547 | ; ############################## | |
548 | ; MAIN RHODECODE DATABASE CONFIG |
|
548 | ; MAIN RHODECODE DATABASE CONFIG | |
549 | ; ############################## |
|
549 | ; ############################## | |
550 |
|
550 | |||
551 | #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30 |
|
551 | #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30 | |
552 | #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode |
|
552 | #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode | |
553 | #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8 |
|
553 | #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8 | |
554 | ; pymysql is an alternative driver for MySQL, use in case of problems with default one |
|
554 | ; pymysql is an alternative driver for MySQL, use in case of problems with default one | |
555 | #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode |
|
555 | #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode | |
556 |
|
556 | |||
557 | sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode |
|
557 | sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode | |
558 |
|
558 | |||
559 | ; see sqlalchemy docs for other advanced settings |
|
559 | ; see sqlalchemy docs for other advanced settings | |
560 | ; print the sql statements to output |
|
560 | ; print the sql statements to output | |
561 | sqlalchemy.db1.echo = false |
|
561 | sqlalchemy.db1.echo = false | |
562 |
|
562 | |||
563 | ; recycle the connections after this amount of seconds |
|
563 | ; recycle the connections after this amount of seconds | |
564 | sqlalchemy.db1.pool_recycle = 3600 |
|
564 | sqlalchemy.db1.pool_recycle = 3600 | |
565 | sqlalchemy.db1.convert_unicode = true |
|
565 | sqlalchemy.db1.convert_unicode = true | |
566 |
|
566 | |||
567 | ; the number of connections to keep open inside the connection pool. |
|
567 | ; the number of connections to keep open inside the connection pool. | |
568 | ; 0 indicates no limit |
|
568 | ; 0 indicates no limit | |
569 | #sqlalchemy.db1.pool_size = 5 |
|
569 | #sqlalchemy.db1.pool_size = 5 | |
570 |
|
570 | |||
571 | ; The number of connections to allow in connection pool "overflow", that is |
|
571 | ; The number of connections to allow in connection pool "overflow", that is | |
572 | ; connections that can be opened above and beyond the pool_size setting, |
|
572 | ; connections that can be opened above and beyond the pool_size setting, | |
573 | ; which defaults to five. |
|
573 | ; which defaults to five. | |
574 | #sqlalchemy.db1.max_overflow = 10 |
|
574 | #sqlalchemy.db1.max_overflow = 10 | |
575 |
|
575 | |||
576 | ; Connection check ping, used to detect broken database connections |
|
576 | ; Connection check ping, used to detect broken database connections | |
577 | ; could be enabled to better handle cases if MySQL has gone away errors |
|
577 | ; could be enabled to better handle cases if MySQL has gone away errors | |
578 | #sqlalchemy.db1.ping_connection = true |
|
578 | #sqlalchemy.db1.ping_connection = true | |
579 |
|
579 | |||
580 | ; ########## |
|
580 | ; ########## | |
581 | ; VCS CONFIG |
|
581 | ; VCS CONFIG | |
582 | ; ########## |
|
582 | ; ########## | |
583 | vcs.server.enable = true |
|
583 | vcs.server.enable = true | |
584 | vcs.server = localhost:9900 |
|
584 | vcs.server = localhost:9900 | |
585 |
|
585 | |||
586 | ; Web server connectivity protocol, responsible for web based VCS operations |
|
586 | ; Web server connectivity protocol, responsible for web based VCS operations | |
587 | ; Available protocols are: |
|
587 | ; Available protocols are: | |
588 | ; `http` - use http-rpc backend (default) |
|
588 | ; `http` - use http-rpc backend (default) | |
589 | vcs.server.protocol = http |
|
589 | vcs.server.protocol = http | |
590 |
|
590 | |||
591 | ; Push/Pull operations protocol, available options are: |
|
591 | ; Push/Pull operations protocol, available options are: | |
592 | ; `http` - use http-rpc backend (default) |
|
592 | ; `http` - use http-rpc backend (default) | |
593 | vcs.scm_app_implementation = http |
|
593 | vcs.scm_app_implementation = http | |
594 |
|
594 | |||
595 | ; Push/Pull operations hooks protocol, available options are: |
|
595 | ; Push/Pull operations hooks protocol, available options are: | |
596 | ; `http` - use http-rpc backend (default) |
|
596 | ; `http` - use http-rpc backend (default) | |
597 | vcs.hooks.protocol = http |
|
597 | vcs.hooks.protocol = http | |
598 |
|
598 | |||
599 | ; Host on which this instance is listening for hooks. vcsserver will call this host to pull/push hooks so it should be |
|
599 | ; Host on which this instance is listening for hooks. vcsserver will call this host to pull/push hooks so it should be | |
600 | ; accessible via network. |
|
600 | ; accessible via network. | |
601 | ; Use vcs.hooks.host = "*" to bind to current hostname (for Docker) |
|
601 | ; Use vcs.hooks.host = "*" to bind to current hostname (for Docker) | |
602 | vcs.hooks.host = * |
|
602 | vcs.hooks.host = * | |
603 |
|
603 | |||
604 | ; Start VCSServer with this instance as a subprocess, useful for development |
|
604 | ; Start VCSServer with this instance as a subprocess, useful for development | |
605 | vcs.start_server = false |
|
605 | vcs.start_server = false | |
606 |
|
606 | |||
607 | ; List of enabled VCS backends, available options are: |
|
607 | ; List of enabled VCS backends, available options are: | |
608 | ; `hg` - mercurial |
|
608 | ; `hg` - mercurial | |
609 | ; `git` - git |
|
609 | ; `git` - git | |
610 | ; `svn` - subversion |
|
610 | ; `svn` - subversion | |
611 | vcs.backends = hg, git, svn |
|
611 | vcs.backends = hg, git, svn | |
612 |
|
612 | |||
613 | ; Wait this number of seconds before killing connection to the vcsserver |
|
613 | ; Wait this number of seconds before killing connection to the vcsserver | |
614 | vcs.connection_timeout = 3600 |
|
614 | vcs.connection_timeout = 3600 | |
615 |
|
615 | |||
616 | ; Compatibility version when creating SVN repositories. Defaults to newest version when commented out. |
|
616 | ; Compatibility version when creating SVN repositories. Defaults to newest version when commented out. | |
617 | ; Set a numeric version for your current SVN e.g 1.8, or 1.12 |
|
617 | ; Set a numeric version for your current SVN e.g 1.8, or 1.12 | |
618 | ; Legacy available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible |
|
618 | ; Legacy available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible | |
619 | #vcs.svn.compatible_version = 1.8 |
|
619 | #vcs.svn.compatible_version = 1.8 | |
620 |
|
620 | |||
621 | ; Cache flag to cache vcsserver remote calls locally |
|
621 | ; Cache flag to cache vcsserver remote calls locally | |
622 | ; It uses cache_region `cache_repo` |
|
622 | ; It uses cache_region `cache_repo` | |
623 | vcs.methods.cache = true |
|
623 | vcs.methods.cache = true | |
624 |
|
624 | |||
625 | ; #################################################### |
|
625 | ; #################################################### | |
626 | ; Subversion proxy support (mod_dav_svn) |
|
626 | ; Subversion proxy support (mod_dav_svn) | |
627 | ; Maps RhodeCode repo groups into SVN paths for Apache |
|
627 | ; Maps RhodeCode repo groups into SVN paths for Apache | |
628 | ; #################################################### |
|
628 | ; #################################################### | |
629 |
|
629 | |||
630 | ; Enable or disable the config file generation. |
|
630 | ; Enable or disable the config file generation. | |
631 | svn.proxy.generate_config = false |
|
631 | svn.proxy.generate_config = false | |
632 |
|
632 | |||
633 | ; Generate config file with `SVNListParentPath` set to `On`. |
|
633 | ; Generate config file with `SVNListParentPath` set to `On`. | |
634 | svn.proxy.list_parent_path = true |
|
634 | svn.proxy.list_parent_path = true | |
635 |
|
635 | |||
636 | ; Set location and file name of generated config file. |
|
636 | ; Set location and file name of generated config file. | |
637 | svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf |
|
637 | svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf | |
638 |
|
638 | |||
639 | ; alternative mod_dav config template. This needs to be a valid mako template |
|
639 | ; alternative mod_dav config template. This needs to be a valid mako template | |
640 | ; Example template can be found in the source code: |
|
640 | ; Example template can be found in the source code: | |
641 | ; rhodecode/apps/svn_support/templates/mod-dav-svn.conf.mako |
|
641 | ; rhodecode/apps/svn_support/templates/mod-dav-svn.conf.mako | |
642 | #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako |
|
642 | #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako | |
643 |
|
643 | |||
644 | ; Used as a prefix to the `Location` block in the generated config file. |
|
644 | ; Used as a prefix to the `Location` block in the generated config file. | |
645 | ; In most cases it should be set to `/`. |
|
645 | ; In most cases it should be set to `/`. | |
646 | svn.proxy.location_root = / |
|
646 | svn.proxy.location_root = / | |
647 |
|
647 | |||
648 | ; Command to reload the mod dav svn configuration on change. |
|
648 | ; Command to reload the mod dav svn configuration on change. | |
649 | ; Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh |
|
649 | ; Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh | |
650 | ; Make sure user who runs RhodeCode process is allowed to reload Apache |
|
650 | ; Make sure user who runs RhodeCode process is allowed to reload Apache | |
651 | #svn.proxy.reload_cmd = /etc/init.d/apache2 reload |
|
651 | #svn.proxy.reload_cmd = /etc/init.d/apache2 reload | |
652 |
|
652 | |||
653 | ; If the timeout expires before the reload command finishes, the command will |
|
653 | ; If the timeout expires before the reload command finishes, the command will | |
654 | ; be killed. Setting it to zero means no timeout. Defaults to 10 seconds. |
|
654 | ; be killed. Setting it to zero means no timeout. Defaults to 10 seconds. | |
655 | #svn.proxy.reload_timeout = 10 |
|
655 | #svn.proxy.reload_timeout = 10 | |
656 |
|
656 | |||
657 | ; #################### |
|
657 | ; #################### | |
658 | ; SSH Support Settings |
|
658 | ; SSH Support Settings | |
659 | ; #################### |
|
659 | ; #################### | |
660 |
|
660 | |||
661 | ; Defines if a custom authorized_keys file should be created and written on |
|
661 | ; Defines if a custom authorized_keys file should be created and written on | |
662 | ; any change user ssh keys. Setting this to false also disables possibility |
|
662 | ; any change user ssh keys. Setting this to false also disables possibility | |
663 | ; of adding SSH keys by users from web interface. Super admins can still |
|
663 | ; of adding SSH keys by users from web interface. Super admins can still | |
664 | ; manage SSH Keys. |
|
664 | ; manage SSH Keys. | |
665 | ssh.generate_authorized_keyfile = false |
|
665 | ssh.generate_authorized_keyfile = false | |
666 |
|
666 | |||
667 | ; Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding` |
|
667 | ; Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding` | |
668 | # ssh.authorized_keys_ssh_opts = |
|
668 | # ssh.authorized_keys_ssh_opts = | |
669 |
|
669 | |||
670 | ; Path to the authorized_keys file where the generate entries are placed. |
|
670 | ; Path to the authorized_keys file where the generate entries are placed. | |
671 | ; It is possible to have multiple key files specified in `sshd_config` e.g. |
|
671 | ; It is possible to have multiple key files specified in `sshd_config` e.g. | |
672 | ; AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode |
|
672 | ; AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode | |
673 | ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode |
|
673 | ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode | |
674 |
|
674 | |||
675 | ; Command to execute the SSH wrapper. The binary is available in the |
|
675 | ; Command to execute the SSH wrapper. The binary is available in the | |
676 | ; RhodeCode installation directory. |
|
676 | ; RhodeCode installation directory. | |
677 | ; e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper |
|
677 | ; e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper | |
678 | ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper |
|
678 | ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper | |
679 |
|
679 | |||
680 | ; Allow shell when executing the ssh-wrapper command |
|
680 | ; Allow shell when executing the ssh-wrapper command | |
681 | ssh.wrapper_cmd_allow_shell = false |
|
681 | ssh.wrapper_cmd_allow_shell = false | |
682 |
|
682 | |||
683 | ; Enables logging, and detailed output send back to the client during SSH |
|
683 | ; Enables logging, and detailed output send back to the client during SSH | |
684 | ; operations. Useful for debugging, shouldn't be used in production. |
|
684 | ; operations. Useful for debugging, shouldn't be used in production. | |
685 | ssh.enable_debug_logging = false |
|
685 | ssh.enable_debug_logging = false | |
686 |
|
686 | |||
687 | ; Paths to binary executable, by default they are the names, but we can |
|
687 | ; Paths to binary executable, by default they are the names, but we can | |
688 | ; override them if we want to use a custom one |
|
688 | ; override them if we want to use a custom one | |
689 | ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg |
|
689 | ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg | |
690 | ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git |
|
690 | ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git | |
691 | ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve |
|
691 | ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve | |
692 |
|
692 | |||
693 | ; Enables SSH key generator web interface. Disabling this still allows users |
|
693 | ; Enables SSH key generator web interface. Disabling this still allows users | |
694 | ; to add their own keys. |
|
694 | ; to add their own keys. | |
695 | ssh.enable_ui_key_generator = true |
|
695 | ssh.enable_ui_key_generator = true | |
696 |
|
696 | |||
697 |
|
697 | |||
698 | ; ################# |
|
698 | ; ################# | |
699 | ; APPENLIGHT CONFIG |
|
699 | ; APPENLIGHT CONFIG | |
700 | ; ################# |
|
700 | ; ################# | |
701 |
|
701 | |||
702 | ; Appenlight is tailored to work with RhodeCode, see |
|
702 | ; Appenlight is tailored to work with RhodeCode, see | |
703 | ; http://appenlight.rhodecode.com for details how to obtain an account |
|
703 | ; http://appenlight.rhodecode.com for details how to obtain an account | |
704 |
|
704 | |||
705 | ; Appenlight integration enabled |
|
705 | ; Appenlight integration enabled | |
706 | #appenlight = false |
|
706 | #appenlight = false | |
707 |
|
707 | |||
708 | #appenlight.server_url = https://api.appenlight.com |
|
708 | #appenlight.server_url = https://api.appenlight.com | |
709 | #appenlight.api_key = YOUR_API_KEY |
|
709 | #appenlight.api_key = YOUR_API_KEY | |
710 | #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5 |
|
710 | #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5 | |
711 |
|
711 | |||
712 | ; used for JS client |
|
712 | ; used for JS client | |
713 | #appenlight.api_public_key = YOUR_API_PUBLIC_KEY |
|
713 | #appenlight.api_public_key = YOUR_API_PUBLIC_KEY | |
714 |
|
714 | |||
715 | ; TWEAK AMOUNT OF INFO SENT HERE |
|
715 | ; TWEAK AMOUNT OF INFO SENT HERE | |
716 |
|
716 | |||
717 | ; enables 404 error logging (default False) |
|
717 | ; enables 404 error logging (default False) | |
718 | #appenlight.report_404 = false |
|
718 | #appenlight.report_404 = false | |
719 |
|
719 | |||
720 | ; time in seconds after request is considered being slow (default 1) |
|
720 | ; time in seconds after request is considered being slow (default 1) | |
721 | #appenlight.slow_request_time = 1 |
|
721 | #appenlight.slow_request_time = 1 | |
722 |
|
722 | |||
723 | ; record slow requests in application |
|
723 | ; record slow requests in application | |
724 | ; (needs to be enabled for slow datastore recording and time tracking) |
|
724 | ; (needs to be enabled for slow datastore recording and time tracking) | |
725 | #appenlight.slow_requests = true |
|
725 | #appenlight.slow_requests = true | |
726 |
|
726 | |||
727 | ; enable hooking to application loggers |
|
727 | ; enable hooking to application loggers | |
728 | #appenlight.logging = true |
|
728 | #appenlight.logging = true | |
729 |
|
729 | |||
730 | ; minimum log level for log capture |
|
730 | ; minimum log level for log capture | |
731 | #ppenlight.logging.level = WARNING |
|
731 | #ppenlight.logging.level = WARNING | |
732 |
|
732 | |||
733 | ; send logs only from erroneous/slow requests |
|
733 | ; send logs only from erroneous/slow requests | |
734 | ; (saves API quota for intensive logging) |
|
734 | ; (saves API quota for intensive logging) | |
735 | #appenlight.logging_on_error = false |
|
735 | #appenlight.logging_on_error = false | |
736 |
|
736 | |||
737 | ; list of additional keywords that should be grabbed from environ object |
|
737 | ; list of additional keywords that should be grabbed from environ object | |
738 | ; can be string with comma separated list of words in lowercase |
|
738 | ; can be string with comma separated list of words in lowercase | |
739 | ; (by default client will always send following info: |
|
739 | ; (by default client will always send following info: | |
740 | ; 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that |
|
740 | ; 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that | |
741 | ; start with HTTP* this list be extended with additional keywords here |
|
741 | ; start with HTTP* this list be extended with additional keywords here | |
742 | #appenlight.environ_keys_whitelist = |
|
742 | #appenlight.environ_keys_whitelist = | |
743 |
|
743 | |||
744 | ; list of keywords that should be blanked from request object |
|
744 | ; list of keywords that should be blanked from request object | |
745 | ; can be string with comma separated list of words in lowercase |
|
745 | ; can be string with comma separated list of words in lowercase | |
746 | ; (by default client will always blank keys that contain following words |
|
746 | ; (by default client will always blank keys that contain following words | |
747 | ; 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf' |
|
747 | ; 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf' | |
748 | ; this list be extended with additional keywords set here |
|
748 | ; this list be extended with additional keywords set here | |
749 | #appenlight.request_keys_blacklist = |
|
749 | #appenlight.request_keys_blacklist = | |
750 |
|
750 | |||
751 | ; list of namespaces that should be ignores when gathering log entries |
|
751 | ; list of namespaces that should be ignores when gathering log entries | |
752 | ; can be string with comma separated list of namespaces |
|
752 | ; can be string with comma separated list of namespaces | |
753 | ; (by default the client ignores own entries: appenlight_client.client) |
|
753 | ; (by default the client ignores own entries: appenlight_client.client) | |
754 | #appenlight.log_namespace_blacklist = |
|
754 | #appenlight.log_namespace_blacklist = | |
755 |
|
755 | |||
756 | ; Statsd client config, this is used to send metrics to statsd |
|
756 | ; Statsd client config, this is used to send metrics to statsd | |
757 |
; We recommend setting statsd_exported and scrape them using Prometh |
|
757 | ; We recommend setting statsd_exported and scrape them using Prometheus | |
758 | #statsd.enabled = false |
|
758 | #statsd.enabled = false | |
759 | #statsd.statsd_host = 0.0.0.0 |
|
759 | #statsd.statsd_host = 0.0.0.0 | |
760 | #statsd.statsd_port = 8125 |
|
760 | #statsd.statsd_port = 8125 | |
761 | #statsd.statsd_prefix = |
|
761 | #statsd.statsd_prefix = | |
762 | #statsd.statsd_ipv6 = false |
|
762 | #statsd.statsd_ipv6 = false | |
763 |
|
763 | |||
764 | ; configure logging automatically at server startup set to false |
|
764 | ; configure logging automatically at server startup set to false | |
765 | ; to use the below custom logging config. |
|
765 | ; to use the below custom logging config. | |
766 | ; RC_LOGGING_FORMATTER |
|
766 | ; RC_LOGGING_FORMATTER | |
767 | ; RC_LOGGING_LEVEL |
|
767 | ; RC_LOGGING_LEVEL | |
768 | ; env variables can control the settings for logging in case of autoconfigure |
|
768 | ; env variables can control the settings for logging in case of autoconfigure | |
769 |
|
769 | |||
770 | #logging.autoconfigure = true |
|
770 | #logging.autoconfigure = true | |
771 |
|
771 | |||
772 | ; specify your own custom logging config file to configure logging |
|
772 | ; specify your own custom logging config file to configure logging | |
773 | #logging.logging_conf_file = /path/to/custom_logging.ini |
|
773 | #logging.logging_conf_file = /path/to/custom_logging.ini | |
774 |
|
774 | |||
775 | ; Dummy marker to add new entries after. |
|
775 | ; Dummy marker to add new entries after. | |
776 | ; Add any custom entries below. Please don't remove this marker. |
|
776 | ; Add any custom entries below. Please don't remove this marker. | |
777 | custom.conf = 1 |
|
777 | custom.conf = 1 | |
778 |
|
778 | |||
779 |
|
779 | |||
780 | ; ##################### |
|
780 | ; ##################### | |
781 | ; LOGGING CONFIGURATION |
|
781 | ; LOGGING CONFIGURATION | |
782 | ; ##################### |
|
782 | ; ##################### | |
783 |
|
783 | |||
784 | [loggers] |
|
784 | [loggers] | |
785 | keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper |
|
785 | keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper | |
786 |
|
786 | |||
787 | [handlers] |
|
787 | [handlers] | |
788 | keys = console, console_sql |
|
788 | keys = console, console_sql | |
789 |
|
789 | |||
790 | [formatters] |
|
790 | [formatters] | |
791 | keys = generic, json, color_formatter, color_formatter_sql |
|
791 | keys = generic, json, color_formatter, color_formatter_sql | |
792 |
|
792 | |||
793 | ; ####### |
|
793 | ; ####### | |
794 | ; LOGGERS |
|
794 | ; LOGGERS | |
795 | ; ####### |
|
795 | ; ####### | |
796 | [logger_root] |
|
796 | [logger_root] | |
797 | level = NOTSET |
|
797 | level = NOTSET | |
798 | handlers = console |
|
798 | handlers = console | |
799 |
|
799 | |||
800 | [logger_sqlalchemy] |
|
800 | [logger_sqlalchemy] | |
801 | level = INFO |
|
801 | level = INFO | |
802 | handlers = console_sql |
|
802 | handlers = console_sql | |
803 | qualname = sqlalchemy.engine |
|
803 | qualname = sqlalchemy.engine | |
804 | propagate = 0 |
|
804 | propagate = 0 | |
805 |
|
805 | |||
806 | [logger_beaker] |
|
806 | [logger_beaker] | |
807 | level = DEBUG |
|
807 | level = DEBUG | |
808 | handlers = |
|
808 | handlers = | |
809 | qualname = beaker.container |
|
809 | qualname = beaker.container | |
810 | propagate = 1 |
|
810 | propagate = 1 | |
811 |
|
811 | |||
812 | [logger_rhodecode] |
|
812 | [logger_rhodecode] | |
813 | level = DEBUG |
|
813 | level = DEBUG | |
814 | handlers = |
|
814 | handlers = | |
815 | qualname = rhodecode |
|
815 | qualname = rhodecode | |
816 | propagate = 1 |
|
816 | propagate = 1 | |
817 |
|
817 | |||
818 | [logger_ssh_wrapper] |
|
818 | [logger_ssh_wrapper] | |
819 | level = DEBUG |
|
819 | level = DEBUG | |
820 | handlers = |
|
820 | handlers = | |
821 | qualname = ssh_wrapper |
|
821 | qualname = ssh_wrapper | |
822 | propagate = 1 |
|
822 | propagate = 1 | |
823 |
|
823 | |||
824 | [logger_celery] |
|
824 | [logger_celery] | |
825 | level = DEBUG |
|
825 | level = DEBUG | |
826 | handlers = |
|
826 | handlers = | |
827 | qualname = celery |
|
827 | qualname = celery | |
828 |
|
828 | |||
829 |
|
829 | |||
830 | ; ######## |
|
830 | ; ######## | |
831 | ; HANDLERS |
|
831 | ; HANDLERS | |
832 | ; ######## |
|
832 | ; ######## | |
833 |
|
833 | |||
834 | [handler_console] |
|
834 | [handler_console] | |
835 | class = StreamHandler |
|
835 | class = StreamHandler | |
836 | args = (sys.stderr, ) |
|
836 | args = (sys.stderr, ) | |
837 | level = INFO |
|
837 | level = INFO | |
838 | ; To enable JSON formatted logs replace 'generic/color_formatter' with 'json' |
|
838 | ; To enable JSON formatted logs replace 'generic/color_formatter' with 'json' | |
839 | ; This allows sending properly formatted logs to grafana loki or elasticsearch |
|
839 | ; This allows sending properly formatted logs to grafana loki or elasticsearch | |
840 | formatter = generic |
|
840 | formatter = generic | |
841 |
|
841 | |||
842 | [handler_console_sql] |
|
842 | [handler_console_sql] | |
843 | ; "level = DEBUG" logs SQL queries and results. |
|
843 | ; "level = DEBUG" logs SQL queries and results. | |
844 | ; "level = INFO" logs SQL queries. |
|
844 | ; "level = INFO" logs SQL queries. | |
845 | ; "level = WARN" logs neither. (Recommended for production systems.) |
|
845 | ; "level = WARN" logs neither. (Recommended for production systems.) | |
846 | class = StreamHandler |
|
846 | class = StreamHandler | |
847 | args = (sys.stderr, ) |
|
847 | args = (sys.stderr, ) | |
848 | level = WARN |
|
848 | level = WARN | |
849 | ; To enable JSON formatted logs replace 'generic/color_formatter_sql' with 'json' |
|
849 | ; To enable JSON formatted logs replace 'generic/color_formatter_sql' with 'json' | |
850 | ; This allows sending properly formatted logs to grafana loki or elasticsearch |
|
850 | ; This allows sending properly formatted logs to grafana loki or elasticsearch | |
851 | formatter = generic |
|
851 | formatter = generic | |
852 |
|
852 | |||
853 | ; ########## |
|
853 | ; ########## | |
854 | ; FORMATTERS |
|
854 | ; FORMATTERS | |
855 | ; ########## |
|
855 | ; ########## | |
856 |
|
856 | |||
857 | [formatter_generic] |
|
857 | [formatter_generic] | |
858 | class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter |
|
858 | class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter | |
859 | format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s |
|
859 | format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s | |
860 | datefmt = %Y-%m-%d %H:%M:%S |
|
860 | datefmt = %Y-%m-%d %H:%M:%S | |
861 |
|
861 | |||
862 | [formatter_color_formatter] |
|
862 | [formatter_color_formatter] | |
863 | class = rhodecode.lib.logging_formatter.ColorFormatter |
|
863 | class = rhodecode.lib.logging_formatter.ColorFormatter | |
864 | format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s |
|
864 | format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s | |
865 | datefmt = %Y-%m-%d %H:%M:%S |
|
865 | datefmt = %Y-%m-%d %H:%M:%S | |
866 |
|
866 | |||
867 | [formatter_color_formatter_sql] |
|
867 | [formatter_color_formatter_sql] | |
868 | class = rhodecode.lib.logging_formatter.ColorFormatterSql |
|
868 | class = rhodecode.lib.logging_formatter.ColorFormatterSql | |
869 | format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s |
|
869 | format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s | |
870 | datefmt = %Y-%m-%d %H:%M:%S |
|
870 | datefmt = %Y-%m-%d %H:%M:%S | |
871 |
|
871 | |||
872 | [formatter_json] |
|
872 | [formatter_json] | |
873 | format = %(timestamp)s %(levelname)s %(name)s %(message)s %(req_id)s |
|
873 | format = %(timestamp)s %(levelname)s %(name)s %(message)s %(req_id)s | |
874 | class = rhodecode.lib._vendor.jsonlogger.JsonFormatter |
|
874 | class = rhodecode.lib._vendor.jsonlogger.JsonFormatter |
@@ -1,610 +1,610 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
3 | # Copyright (C) 2010-2020 RhodeCode GmbH | |
4 | # |
|
4 | # | |
5 | # This program is free software: you can redistribute it and/or modify |
|
5 | # This program is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |
7 | # (only), as published by the Free Software Foundation. |
|
7 | # (only), as published by the Free Software Foundation. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License |
|
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # |
|
16 | # | |
17 | # This program is dual-licensed. If you wish to learn more about the |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 | import os |
|
21 | import os | |
22 | import sys |
|
22 | import sys | |
23 | import collections |
|
23 | import collections | |
24 | import tempfile |
|
24 | import tempfile | |
25 | import time |
|
25 | import time | |
26 | import logging.config |
|
26 | import logging.config | |
27 |
|
27 | |||
28 | from paste.gzipper import make_gzip_middleware |
|
28 | from paste.gzipper import make_gzip_middleware | |
29 | import pyramid.events |
|
29 | import pyramid.events | |
30 | from pyramid.wsgi import wsgiapp |
|
30 | from pyramid.wsgi import wsgiapp | |
31 | from pyramid.authorization import ACLAuthorizationPolicy |
|
31 | from pyramid.authorization import ACLAuthorizationPolicy | |
32 | from pyramid.config import Configurator |
|
32 | from pyramid.config import Configurator | |
33 | from pyramid.settings import asbool, aslist |
|
33 | from pyramid.settings import asbool, aslist | |
34 | from pyramid.httpexceptions import ( |
|
34 | from pyramid.httpexceptions import ( | |
35 | HTTPException, HTTPError, HTTPInternalServerError, HTTPFound, HTTPNotFound) |
|
35 | HTTPException, HTTPError, HTTPInternalServerError, HTTPFound, HTTPNotFound) | |
36 | from pyramid.renderers import render_to_response |
|
36 | from pyramid.renderers import render_to_response | |
37 |
|
37 | |||
38 | from rhodecode.model import meta |
|
38 | from rhodecode.model import meta | |
39 | from rhodecode.config import patches |
|
39 | from rhodecode.config import patches | |
40 | from rhodecode.config import utils as config_utils |
|
40 | from rhodecode.config import utils as config_utils | |
41 | from rhodecode.config.settings_maker import SettingsMaker |
|
41 | from rhodecode.config.settings_maker import SettingsMaker | |
42 | from rhodecode.config.environment import load_pyramid_environment |
|
42 | from rhodecode.config.environment import load_pyramid_environment | |
43 |
|
43 | |||
44 | import rhodecode.events |
|
44 | import rhodecode.events | |
45 | from rhodecode.lib.middleware.vcs import VCSMiddleware |
|
45 | from rhodecode.lib.middleware.vcs import VCSMiddleware | |
46 | from rhodecode.lib.request import Request |
|
46 | from rhodecode.lib.request import Request | |
47 | from rhodecode.lib.vcs import VCSCommunicationError |
|
47 | from rhodecode.lib.vcs import VCSCommunicationError | |
48 | from rhodecode.lib.exceptions import VCSServerUnavailable |
|
48 | from rhodecode.lib.exceptions import VCSServerUnavailable | |
49 | from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled |
|
49 | from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled | |
50 | from rhodecode.lib.middleware.https_fixup import HttpsFixup |
|
50 | from rhodecode.lib.middleware.https_fixup import HttpsFixup | |
51 | from rhodecode.lib.plugins.utils import register_rhodecode_plugin |
|
51 | from rhodecode.lib.plugins.utils import register_rhodecode_plugin | |
52 | from rhodecode.lib.utils2 import AttributeDict |
|
52 | from rhodecode.lib.utils2 import AttributeDict | |
53 | from rhodecode.lib.exc_tracking import store_exception |
|
53 | from rhodecode.lib.exc_tracking import store_exception | |
54 | from rhodecode.subscribers import ( |
|
54 | from rhodecode.subscribers import ( | |
55 | scan_repositories_if_enabled, write_js_routes_if_enabled, |
|
55 | scan_repositories_if_enabled, write_js_routes_if_enabled, | |
56 | write_metadata_if_needed, write_usage_data) |
|
56 | write_metadata_if_needed, write_usage_data) | |
57 | from rhodecode.lib.statsd_client import StatsdClient |
|
57 | from rhodecode.lib.statsd_client import StatsdClient | |
58 |
|
58 | |||
59 | log = logging.getLogger(__name__) |
|
59 | log = logging.getLogger(__name__) | |
60 |
|
60 | |||
61 |
|
61 | |||
62 | def is_http_error(response): |
|
62 | def is_http_error(response): | |
63 | # error which should have traceback |
|
63 | # error which should have traceback | |
64 | return response.status_code > 499 |
|
64 | return response.status_code > 499 | |
65 |
|
65 | |||
66 |
|
66 | |||
67 | def should_load_all(): |
|
67 | def should_load_all(): | |
68 | """ |
|
68 | """ | |
69 | Returns if all application components should be loaded. In some cases it's |
|
69 | Returns if all application components should be loaded. In some cases it's | |
70 | desired to skip apps loading for faster shell script execution |
|
70 | desired to skip apps loading for faster shell script execution | |
71 | """ |
|
71 | """ | |
72 | ssh_cmd = os.environ.get('RC_CMD_SSH_WRAPPER') |
|
72 | ssh_cmd = os.environ.get('RC_CMD_SSH_WRAPPER') | |
73 | if ssh_cmd: |
|
73 | if ssh_cmd: | |
74 | return False |
|
74 | return False | |
75 |
|
75 | |||
76 | return True |
|
76 | return True | |
77 |
|
77 | |||
78 |
|
78 | |||
79 | def make_pyramid_app(global_config, **settings): |
|
79 | def make_pyramid_app(global_config, **settings): | |
80 | """ |
|
80 | """ | |
81 | Constructs the WSGI application based on Pyramid. |
|
81 | Constructs the WSGI application based on Pyramid. | |
82 |
|
82 | |||
83 | Specials: |
|
83 | Specials: | |
84 |
|
84 | |||
85 | * The application can also be integrated like a plugin via the call to |
|
85 | * The application can also be integrated like a plugin via the call to | |
86 | `includeme`. This is accompanied with the other utility functions which |
|
86 | `includeme`. This is accompanied with the other utility functions which | |
87 | are called. Changing this should be done with great care to not break |
|
87 | are called. Changing this should be done with great care to not break | |
88 | cases when these fragments are assembled from another place. |
|
88 | cases when these fragments are assembled from another place. | |
89 |
|
89 | |||
90 | """ |
|
90 | """ | |
91 | start_time = time.time() |
|
91 | start_time = time.time() | |
92 | log.info('Pyramid app config starting') |
|
92 | log.info('Pyramid app config starting') | |
93 |
|
93 | |||
94 | sanitize_settings_and_apply_defaults(global_config, settings) |
|
94 | sanitize_settings_and_apply_defaults(global_config, settings) | |
95 |
|
95 | |||
96 | # init and bootstrap StatsdClient |
|
96 | # init and bootstrap StatsdClient | |
97 | StatsdClient.setup(settings) |
|
97 | StatsdClient.setup(settings) | |
98 |
|
98 | |||
99 | config = Configurator(settings=settings) |
|
99 | config = Configurator(settings=settings) | |
100 | # Init our statsd at very start |
|
100 | # Init our statsd at very start | |
101 | config.registry.statsd = StatsdClient.statsd |
|
101 | config.registry.statsd = StatsdClient.statsd | |
102 |
|
102 | |||
103 | # Apply compatibility patches |
|
103 | # Apply compatibility patches | |
104 | patches.inspect_getargspec() |
|
104 | patches.inspect_getargspec() | |
105 |
|
105 | |||
106 | load_pyramid_environment(global_config, settings) |
|
106 | load_pyramid_environment(global_config, settings) | |
107 |
|
107 | |||
108 | # Static file view comes first |
|
108 | # Static file view comes first | |
109 | includeme_first(config) |
|
109 | includeme_first(config) | |
110 |
|
110 | |||
111 | includeme(config) |
|
111 | includeme(config) | |
112 |
|
112 | |||
113 | pyramid_app = config.make_wsgi_app() |
|
113 | pyramid_app = config.make_wsgi_app() | |
114 | pyramid_app = wrap_app_in_wsgi_middlewares(pyramid_app, config) |
|
114 | pyramid_app = wrap_app_in_wsgi_middlewares(pyramid_app, config) | |
115 | pyramid_app.config = config |
|
115 | pyramid_app.config = config | |
116 |
|
116 | |||
117 | celery_settings = get_celery_config(settings) |
|
117 | celery_settings = get_celery_config(settings) | |
118 | config.configure_celery(celery_settings) |
|
118 | config.configure_celery(celery_settings) | |
119 |
|
119 | |||
120 | # creating the app uses a connection - return it after we are done |
|
120 | # creating the app uses a connection - return it after we are done | |
121 | meta.Session.remove() |
|
121 | meta.Session.remove() | |
122 |
|
122 | |||
123 | total_time = time.time() - start_time |
|
123 | total_time = time.time() - start_time | |
124 | log.info('Pyramid app `%s` created and configured in %.2fs', |
|
124 | log.info('Pyramid app `%s` created and configured in %.2fs', | |
125 | getattr(pyramid_app, 'func_name', 'pyramid_app'), total_time) |
|
125 | getattr(pyramid_app, 'func_name', 'pyramid_app'), total_time) | |
126 | return pyramid_app |
|
126 | return pyramid_app | |
127 |
|
127 | |||
128 |
|
128 | |||
129 | def get_celery_config(settings): |
|
129 | def get_celery_config(settings): | |
130 | """ |
|
130 | """ | |
131 | Converts basic ini configuration into celery 4.X options |
|
131 | Converts basic ini configuration into celery 4.X options | |
132 | """ |
|
132 | """ | |
133 |
|
133 | |||
134 | def key_converter(key_name): |
|
134 | def key_converter(key_name): | |
135 | pref = 'celery.' |
|
135 | pref = 'celery.' | |
136 | if key_name.startswith(pref): |
|
136 | if key_name.startswith(pref): | |
137 | return key_name[len(pref):].replace('.', '_').lower() |
|
137 | return key_name[len(pref):].replace('.', '_').lower() | |
138 |
|
138 | |||
139 | def type_converter(parsed_key, value): |
|
139 | def type_converter(parsed_key, value): | |
140 | # cast to int |
|
140 | # cast to int | |
141 | if value.isdigit(): |
|
141 | if value.isdigit(): | |
142 | return int(value) |
|
142 | return int(value) | |
143 |
|
143 | |||
144 | # cast to bool |
|
144 | # cast to bool | |
145 | if value.lower() in ['true', 'false', 'True', 'False']: |
|
145 | if value.lower() in ['true', 'false', 'True', 'False']: | |
146 | return value.lower() == 'true' |
|
146 | return value.lower() == 'true' | |
147 | return value |
|
147 | return value | |
148 |
|
148 | |||
149 | celery_config = {} |
|
149 | celery_config = {} | |
150 | for k, v in settings.items(): |
|
150 | for k, v in settings.items(): | |
151 | pref = 'celery.' |
|
151 | pref = 'celery.' | |
152 | if k.startswith(pref): |
|
152 | if k.startswith(pref): | |
153 | celery_config[key_converter(k)] = type_converter(key_converter(k), v) |
|
153 | celery_config[key_converter(k)] = type_converter(key_converter(k), v) | |
154 |
|
154 | |||
155 | # TODO:rethink if we want to support celerybeat based file config, probably NOT |
|
155 | # TODO:rethink if we want to support celerybeat based file config, probably NOT | |
156 | # beat_config = {} |
|
156 | # beat_config = {} | |
157 | # for section in parser.sections(): |
|
157 | # for section in parser.sections(): | |
158 | # if section.startswith('celerybeat:'): |
|
158 | # if section.startswith('celerybeat:'): | |
159 | # name = section.split(':', 1)[1] |
|
159 | # name = section.split(':', 1)[1] | |
160 | # beat_config[name] = get_beat_config(parser, section) |
|
160 | # beat_config[name] = get_beat_config(parser, section) | |
161 |
|
161 | |||
162 | # final compose of settings |
|
162 | # final compose of settings | |
163 | celery_settings = {} |
|
163 | celery_settings = {} | |
164 |
|
164 | |||
165 | if celery_config: |
|
165 | if celery_config: | |
166 | celery_settings.update(celery_config) |
|
166 | celery_settings.update(celery_config) | |
167 | # if beat_config: |
|
167 | # if beat_config: | |
168 | # celery_settings.update({'beat_schedule': beat_config}) |
|
168 | # celery_settings.update({'beat_schedule': beat_config}) | |
169 |
|
169 | |||
170 | return celery_settings |
|
170 | return celery_settings | |
171 |
|
171 | |||
172 |
|
172 | |||
173 | def not_found_view(request): |
|
173 | def not_found_view(request): | |
174 | """ |
|
174 | """ | |
175 | This creates the view which should be registered as not-found-view to |
|
175 | This creates the view which should be registered as not-found-view to | |
176 | pyramid. |
|
176 | pyramid. | |
177 | """ |
|
177 | """ | |
178 |
|
178 | |||
179 | if not getattr(request, 'vcs_call', None): |
|
179 | if not getattr(request, 'vcs_call', None): | |
180 | # handle like regular case with our error_handler |
|
180 | # handle like regular case with our error_handler | |
181 | return error_handler(HTTPNotFound(), request) |
|
181 | return error_handler(HTTPNotFound(), request) | |
182 |
|
182 | |||
183 | # handle not found view as a vcs call |
|
183 | # handle not found view as a vcs call | |
184 | settings = request.registry.settings |
|
184 | settings = request.registry.settings | |
185 | ae_client = getattr(request, 'ae_client', None) |
|
185 | ae_client = getattr(request, 'ae_client', None) | |
186 | vcs_app = VCSMiddleware( |
|
186 | vcs_app = VCSMiddleware( | |
187 | HTTPNotFound(), request.registry, settings, |
|
187 | HTTPNotFound(), request.registry, settings, | |
188 | appenlight_client=ae_client) |
|
188 | appenlight_client=ae_client) | |
189 |
|
189 | |||
190 | return wsgiapp(vcs_app)(None, request) |
|
190 | return wsgiapp(vcs_app)(None, request) | |
191 |
|
191 | |||
192 |
|
192 | |||
193 | def error_handler(exception, request): |
|
193 | def error_handler(exception, request): | |
194 | import rhodecode |
|
194 | import rhodecode | |
195 | from rhodecode.lib import helpers |
|
195 | from rhodecode.lib import helpers | |
196 | from rhodecode.lib.utils2 import str2bool |
|
196 | from rhodecode.lib.utils2 import str2bool | |
197 |
|
197 | |||
198 | rhodecode_title = rhodecode.CONFIG.get('rhodecode_title') or 'RhodeCode' |
|
198 | rhodecode_title = rhodecode.CONFIG.get('rhodecode_title') or 'RhodeCode' | |
199 |
|
199 | |||
200 | base_response = HTTPInternalServerError() |
|
200 | base_response = HTTPInternalServerError() | |
201 | # prefer original exception for the response since it may have headers set |
|
201 | # prefer original exception for the response since it may have headers set | |
202 | if isinstance(exception, HTTPException): |
|
202 | if isinstance(exception, HTTPException): | |
203 | base_response = exception |
|
203 | base_response = exception | |
204 | elif isinstance(exception, VCSCommunicationError): |
|
204 | elif isinstance(exception, VCSCommunicationError): | |
205 | base_response = VCSServerUnavailable() |
|
205 | base_response = VCSServerUnavailable() | |
206 |
|
206 | |||
207 | if is_http_error(base_response): |
|
207 | if is_http_error(base_response): | |
208 | log.exception( |
|
208 | log.exception( | |
209 | 'error occurred handling this request for path: %s', request.path) |
|
209 | 'error occurred handling this request for path: %s', request.path) | |
210 |
|
210 | |||
211 | error_explanation = base_response.explanation or str(base_response) |
|
211 | error_explanation = base_response.explanation or str(base_response) | |
212 | if base_response.status_code == 404: |
|
212 | if base_response.status_code == 404: | |
213 | error_explanation += " Optionally you don't have permission to access this page." |
|
213 | error_explanation += " Optionally you don't have permission to access this page." | |
214 | c = AttributeDict() |
|
214 | c = AttributeDict() | |
215 | c.error_message = base_response.status |
|
215 | c.error_message = base_response.status | |
216 | c.error_explanation = error_explanation |
|
216 | c.error_explanation = error_explanation | |
217 | c.visual = AttributeDict() |
|
217 | c.visual = AttributeDict() | |
218 |
|
218 | |||
219 | c.visual.rhodecode_support_url = ( |
|
219 | c.visual.rhodecode_support_url = ( | |
220 | request.registry.settings.get('rhodecode_support_url') or |
|
220 | request.registry.settings.get('rhodecode_support_url') or | |
221 | request.route_url('rhodecode_support') |
|
221 | request.route_url('rhodecode_support') | |
222 | ) |
|
222 | ) | |
223 | c.redirect_time = 0 |
|
223 | c.redirect_time = 0 | |
224 | c.rhodecode_name = rhodecode_title |
|
224 | c.rhodecode_name = rhodecode_title | |
225 | if not c.rhodecode_name: |
|
225 | if not c.rhodecode_name: | |
226 | c.rhodecode_name = 'Rhodecode' |
|
226 | c.rhodecode_name = 'Rhodecode' | |
227 |
|
227 | |||
228 | c.causes = [] |
|
228 | c.causes = [] | |
229 | if is_http_error(base_response): |
|
229 | if is_http_error(base_response): | |
230 | c.causes.append('Server is overloaded.') |
|
230 | c.causes.append('Server is overloaded.') | |
231 | c.causes.append('Server database connection is lost.') |
|
231 | c.causes.append('Server database connection is lost.') | |
232 | c.causes.append('Server expected unhandled error.') |
|
232 | c.causes.append('Server expected unhandled error.') | |
233 |
|
233 | |||
234 | if hasattr(base_response, 'causes'): |
|
234 | if hasattr(base_response, 'causes'): | |
235 | c.causes = base_response.causes |
|
235 | c.causes = base_response.causes | |
236 |
|
236 | |||
237 | c.messages = helpers.flash.pop_messages(request=request) |
|
237 | c.messages = helpers.flash.pop_messages(request=request) | |
238 |
|
238 | |||
239 | exc_info = sys.exc_info() |
|
239 | exc_info = sys.exc_info() | |
240 | c.exception_id = id(exc_info) |
|
240 | c.exception_id = id(exc_info) | |
241 | c.show_exception_id = isinstance(base_response, VCSServerUnavailable) \ |
|
241 | c.show_exception_id = isinstance(base_response, VCSServerUnavailable) \ | |
242 | or base_response.status_code > 499 |
|
242 | or base_response.status_code > 499 | |
243 | c.exception_id_url = request.route_url( |
|
243 | c.exception_id_url = request.route_url( | |
244 | 'admin_settings_exception_tracker_show', exception_id=c.exception_id) |
|
244 | 'admin_settings_exception_tracker_show', exception_id=c.exception_id) | |
245 |
|
245 | |||
246 | if c.show_exception_id: |
|
246 | if c.show_exception_id: | |
247 | store_exception(c.exception_id, exc_info) |
|
247 | store_exception(c.exception_id, exc_info) | |
248 | c.exception_debug = str2bool(rhodecode.CONFIG.get('debug')) |
|
248 | c.exception_debug = str2bool(rhodecode.CONFIG.get('debug')) | |
249 | c.exception_config_ini = rhodecode.CONFIG.get('__file__') |
|
249 | c.exception_config_ini = rhodecode.CONFIG.get('__file__') | |
250 |
|
250 | |||
251 | response = render_to_response( |
|
251 | response = render_to_response( | |
252 | '/errors/error_document.mako', {'c': c, 'h': helpers}, request=request, |
|
252 | '/errors/error_document.mako', {'c': c, 'h': helpers}, request=request, | |
253 | response=base_response) |
|
253 | response=base_response) | |
254 |
|
254 | |||
255 | statsd = request.registry.statsd |
|
255 | statsd = request.registry.statsd | |
256 | if statsd and base_response.status_code > 499: |
|
256 | if statsd and base_response.status_code > 499: | |
257 | exc_type = "{}.{}".format(exception.__class__.__module__, exception.__class__.__name__) |
|
257 | exc_type = "{}.{}".format(exception.__class__.__module__, exception.__class__.__name__) | |
258 | statsd.incr('rhodecode_exception_total', |
|
258 | statsd.incr('rhodecode_exception_total', | |
259 | tags=["exc_source:web", |
|
259 | tags=["exc_source:web", | |
260 | "http_code:{}".format(base_response.status_code), |
|
260 | "http_code:{}".format(base_response.status_code), | |
261 | "type:{}".format(exc_type)]) |
|
261 | "type:{}".format(exc_type)]) | |
262 |
|
262 | |||
263 | return response |
|
263 | return response | |
264 |
|
264 | |||
265 |
|
265 | |||
266 | def includeme_first(config): |
|
266 | def includeme_first(config): | |
267 | # redirect automatic browser favicon.ico requests to correct place |
|
267 | # redirect automatic browser favicon.ico requests to correct place | |
268 | def favicon_redirect(context, request): |
|
268 | def favicon_redirect(context, request): | |
269 | return HTTPFound( |
|
269 | return HTTPFound( | |
270 | request.static_path('rhodecode:public/images/favicon.ico')) |
|
270 | request.static_path('rhodecode:public/images/favicon.ico')) | |
271 |
|
271 | |||
272 | config.add_view(favicon_redirect, route_name='favicon') |
|
272 | config.add_view(favicon_redirect, route_name='favicon') | |
273 | config.add_route('favicon', '/favicon.ico') |
|
273 | config.add_route('favicon', '/favicon.ico') | |
274 |
|
274 | |||
275 | def robots_redirect(context, request): |
|
275 | def robots_redirect(context, request): | |
276 | return HTTPFound( |
|
276 | return HTTPFound( | |
277 | request.static_path('rhodecode:public/robots.txt')) |
|
277 | request.static_path('rhodecode:public/robots.txt')) | |
278 |
|
278 | |||
279 | config.add_view(robots_redirect, route_name='robots') |
|
279 | config.add_view(robots_redirect, route_name='robots') | |
280 | config.add_route('robots', '/robots.txt') |
|
280 | config.add_route('robots', '/robots.txt') | |
281 |
|
281 | |||
282 | config.add_static_view( |
|
282 | config.add_static_view( | |
283 | '_static/deform', 'deform:static') |
|
283 | '_static/deform', 'deform:static') | |
284 | config.add_static_view( |
|
284 | config.add_static_view( | |
285 | '_static/rhodecode', path='rhodecode:public', cache_max_age=3600 * 24) |
|
285 | '_static/rhodecode', path='rhodecode:public', cache_max_age=3600 * 24) | |
286 |
|
286 | |||
287 |
|
287 | |||
288 | def includeme(config, auth_resources=None): |
|
288 | def includeme(config, auth_resources=None): | |
289 | from rhodecode.lib.celerylib.loader import configure_celery |
|
289 | from rhodecode.lib.celerylib.loader import configure_celery | |
290 | log.debug('Initializing main includeme from %s', os.path.basename(__file__)) |
|
290 | log.debug('Initializing main includeme from %s', os.path.basename(__file__)) | |
291 | settings = config.registry.settings |
|
291 | settings = config.registry.settings | |
292 | config.set_request_factory(Request) |
|
292 | config.set_request_factory(Request) | |
293 |
|
293 | |||
294 | # plugin information |
|
294 | # plugin information | |
295 | config.registry.rhodecode_plugins = collections.OrderedDict() |
|
295 | config.registry.rhodecode_plugins = collections.OrderedDict() | |
296 |
|
296 | |||
297 | config.add_directive( |
|
297 | config.add_directive( | |
298 | 'register_rhodecode_plugin', register_rhodecode_plugin) |
|
298 | 'register_rhodecode_plugin', register_rhodecode_plugin) | |
299 |
|
299 | |||
300 | config.add_directive('configure_celery', configure_celery) |
|
300 | config.add_directive('configure_celery', configure_celery) | |
301 |
|
301 | |||
302 | if settings.get('appenlight', False): |
|
302 | if settings.get('appenlight', False): | |
303 | config.include('appenlight_client.ext.pyramid_tween') |
|
303 | config.include('appenlight_client.ext.pyramid_tween') | |
304 |
|
304 | |||
305 | load_all = should_load_all() |
|
305 | load_all = should_load_all() | |
306 |
|
306 | |||
307 | # Includes which are required. The application would fail without them. |
|
307 | # Includes which are required. The application would fail without them. | |
308 | config.include('pyramid_mako') |
|
308 | config.include('pyramid_mako') | |
309 | config.include('rhodecode.lib.rc_beaker') |
|
309 | config.include('rhodecode.lib.rc_beaker') | |
310 | config.include('rhodecode.lib.rc_cache') |
|
310 | config.include('rhodecode.lib.rc_cache') | |
311 | config.include('rhodecode.apps._base.navigation') |
|
311 | config.include('rhodecode.apps._base.navigation') | |
312 | config.include('rhodecode.apps._base.subscribers') |
|
312 | config.include('rhodecode.apps._base.subscribers') | |
313 | config.include('rhodecode.tweens') |
|
313 | config.include('rhodecode.tweens') | |
314 | config.include('rhodecode.authentication') |
|
314 | config.include('rhodecode.authentication') | |
315 |
|
315 | |||
316 | if load_all: |
|
316 | if load_all: | |
317 | ce_auth_resources = [ |
|
317 | ce_auth_resources = [ | |
318 | 'rhodecode.authentication.plugins.auth_crowd', |
|
318 | 'rhodecode.authentication.plugins.auth_crowd', | |
319 | 'rhodecode.authentication.plugins.auth_headers', |
|
319 | 'rhodecode.authentication.plugins.auth_headers', | |
320 | 'rhodecode.authentication.plugins.auth_jasig_cas', |
|
320 | 'rhodecode.authentication.plugins.auth_jasig_cas', | |
321 | 'rhodecode.authentication.plugins.auth_ldap', |
|
321 | 'rhodecode.authentication.plugins.auth_ldap', | |
322 | 'rhodecode.authentication.plugins.auth_pam', |
|
322 | 'rhodecode.authentication.plugins.auth_pam', | |
323 | 'rhodecode.authentication.plugins.auth_rhodecode', |
|
323 | 'rhodecode.authentication.plugins.auth_rhodecode', | |
324 | 'rhodecode.authentication.plugins.auth_token', |
|
324 | 'rhodecode.authentication.plugins.auth_token', | |
325 | ] |
|
325 | ] | |
326 |
|
326 | |||
327 | # load CE authentication plugins |
|
327 | # load CE authentication plugins | |
328 |
|
328 | |||
329 | if auth_resources: |
|
329 | if auth_resources: | |
330 | ce_auth_resources.extend(auth_resources) |
|
330 | ce_auth_resources.extend(auth_resources) | |
331 |
|
331 | |||
332 | for resource in ce_auth_resources: |
|
332 | for resource in ce_auth_resources: | |
333 | config.include(resource) |
|
333 | config.include(resource) | |
334 |
|
334 | |||
335 | # Auto discover authentication plugins and include their configuration. |
|
335 | # Auto discover authentication plugins and include their configuration. | |
336 | if asbool(settings.get('auth_plugin.import_legacy_plugins', 'true')): |
|
336 | if asbool(settings.get('auth_plugin.import_legacy_plugins', 'true')): | |
337 | from rhodecode.authentication import discover_legacy_plugins |
|
337 | from rhodecode.authentication import discover_legacy_plugins | |
338 | discover_legacy_plugins(config) |
|
338 | discover_legacy_plugins(config) | |
339 |
|
339 | |||
340 | # apps |
|
340 | # apps | |
341 | if load_all: |
|
341 | if load_all: | |
342 | config.include('rhodecode.api') |
|
342 | config.include('rhodecode.api') | |
343 | config.include('rhodecode.apps._base') |
|
343 | config.include('rhodecode.apps._base') | |
344 | config.include('rhodecode.apps.hovercards') |
|
344 | config.include('rhodecode.apps.hovercards') | |
345 | config.include('rhodecode.apps.ops') |
|
345 | config.include('rhodecode.apps.ops') | |
346 | config.include('rhodecode.apps.channelstream') |
|
346 | config.include('rhodecode.apps.channelstream') | |
347 | config.include('rhodecode.apps.file_store') |
|
347 | config.include('rhodecode.apps.file_store') | |
348 | config.include('rhodecode.apps.admin') |
|
348 | config.include('rhodecode.apps.admin') | |
349 | config.include('rhodecode.apps.login') |
|
349 | config.include('rhodecode.apps.login') | |
350 | config.include('rhodecode.apps.home') |
|
350 | config.include('rhodecode.apps.home') | |
351 | config.include('rhodecode.apps.journal') |
|
351 | config.include('rhodecode.apps.journal') | |
352 |
|
352 | |||
353 | config.include('rhodecode.apps.repository') |
|
353 | config.include('rhodecode.apps.repository') | |
354 | config.include('rhodecode.apps.repo_group') |
|
354 | config.include('rhodecode.apps.repo_group') | |
355 | config.include('rhodecode.apps.user_group') |
|
355 | config.include('rhodecode.apps.user_group') | |
356 | config.include('rhodecode.apps.search') |
|
356 | config.include('rhodecode.apps.search') | |
357 | config.include('rhodecode.apps.user_profile') |
|
357 | config.include('rhodecode.apps.user_profile') | |
358 | config.include('rhodecode.apps.user_group_profile') |
|
358 | config.include('rhodecode.apps.user_group_profile') | |
359 | config.include('rhodecode.apps.my_account') |
|
359 | config.include('rhodecode.apps.my_account') | |
360 | config.include('rhodecode.apps.gist') |
|
360 | config.include('rhodecode.apps.gist') | |
361 |
|
361 | |||
362 | config.include('rhodecode.apps.svn_support') |
|
362 | config.include('rhodecode.apps.svn_support') | |
363 | config.include('rhodecode.apps.ssh_support') |
|
363 | config.include('rhodecode.apps.ssh_support') | |
364 | config.include('rhodecode.apps.debug_style') |
|
364 | config.include('rhodecode.apps.debug_style') | |
365 |
|
365 | |||
366 | if load_all: |
|
366 | if load_all: | |
367 | config.include('rhodecode.integrations') |
|
367 | config.include('rhodecode.integrations') | |
368 |
|
368 | |||
369 | config.add_route('rhodecode_support', 'https://rhodecode.com/help/', static=True) |
|
369 | config.add_route('rhodecode_support', 'https://rhodecode.com/help/', static=True) | |
370 | config.add_translation_dirs('rhodecode:i18n/') |
|
370 | config.add_translation_dirs('rhodecode:i18n/') | |
371 | settings['default_locale_name'] = settings.get('lang', 'en') |
|
371 | settings['default_locale_name'] = settings.get('lang', 'en') | |
372 |
|
372 | |||
373 | # Add subscribers. |
|
373 | # Add subscribers. | |
374 | if load_all: |
|
374 | if load_all: | |
375 | config.add_subscriber(scan_repositories_if_enabled, |
|
375 | config.add_subscriber(scan_repositories_if_enabled, | |
376 | pyramid.events.ApplicationCreated) |
|
376 | pyramid.events.ApplicationCreated) | |
377 | config.add_subscriber(write_metadata_if_needed, |
|
377 | config.add_subscriber(write_metadata_if_needed, | |
378 | pyramid.events.ApplicationCreated) |
|
378 | pyramid.events.ApplicationCreated) | |
379 | config.add_subscriber(write_usage_data, |
|
379 | config.add_subscriber(write_usage_data, | |
380 | pyramid.events.ApplicationCreated) |
|
380 | pyramid.events.ApplicationCreated) | |
381 | config.add_subscriber(write_js_routes_if_enabled, |
|
381 | config.add_subscriber(write_js_routes_if_enabled, | |
382 | pyramid.events.ApplicationCreated) |
|
382 | pyramid.events.ApplicationCreated) | |
383 |
|
383 | |||
384 | # Set the authorization policy. |
|
384 | # Set the authorization policy. | |
385 | authz_policy = ACLAuthorizationPolicy() |
|
385 | authz_policy = ACLAuthorizationPolicy() | |
386 | config.set_authorization_policy(authz_policy) |
|
386 | config.set_authorization_policy(authz_policy) | |
387 |
|
387 | |||
388 | # Set the default renderer for HTML templates to mako. |
|
388 | # Set the default renderer for HTML templates to mako. | |
389 | config.add_mako_renderer('.html') |
|
389 | config.add_mako_renderer('.html') | |
390 |
|
390 | |||
391 | config.add_renderer( |
|
391 | config.add_renderer( | |
392 | name='json_ext', |
|
392 | name='json_ext', | |
393 | factory='rhodecode.lib.ext_json_renderer.pyramid_ext_json') |
|
393 | factory='rhodecode.lib.ext_json_renderer.pyramid_ext_json') | |
394 |
|
394 | |||
395 | config.add_renderer( |
|
395 | config.add_renderer( | |
396 | name='string_html', |
|
396 | name='string_html', | |
397 | factory='rhodecode.lib.string_renderer.html') |
|
397 | factory='rhodecode.lib.string_renderer.html') | |
398 |
|
398 | |||
399 | # include RhodeCode plugins |
|
399 | # include RhodeCode plugins | |
400 | includes = aslist(settings.get('rhodecode.includes', [])) |
|
400 | includes = aslist(settings.get('rhodecode.includes', [])) | |
401 | for inc in includes: |
|
401 | for inc in includes: | |
402 | config.include(inc) |
|
402 | config.include(inc) | |
403 |
|
403 | |||
404 | # custom not found view, if our pyramid app doesn't know how to handle |
|
404 | # custom not found view, if our pyramid app doesn't know how to handle | |
405 | # the request pass it to potential VCS handling ap |
|
405 | # the request pass it to potential VCS handling ap | |
406 | config.add_notfound_view(not_found_view) |
|
406 | config.add_notfound_view(not_found_view) | |
407 | if not settings.get('debugtoolbar.enabled', False): |
|
407 | if not settings.get('debugtoolbar.enabled', False): | |
408 | # disabled debugtoolbar handle all exceptions via the error_handlers |
|
408 | # disabled debugtoolbar handle all exceptions via the error_handlers | |
409 | config.add_view(error_handler, context=Exception) |
|
409 | config.add_view(error_handler, context=Exception) | |
410 |
|
410 | |||
411 | # all errors including 403/404/50X |
|
411 | # all errors including 403/404/50X | |
412 | config.add_view(error_handler, context=HTTPError) |
|
412 | config.add_view(error_handler, context=HTTPError) | |
413 |
|
413 | |||
414 |
|
414 | |||
415 | def wrap_app_in_wsgi_middlewares(pyramid_app, config): |
|
415 | def wrap_app_in_wsgi_middlewares(pyramid_app, config): | |
416 | """ |
|
416 | """ | |
417 | Apply outer WSGI middlewares around the application. |
|
417 | Apply outer WSGI middlewares around the application. | |
418 | """ |
|
418 | """ | |
419 | registry = config.registry |
|
419 | registry = config.registry | |
420 | settings = registry.settings |
|
420 | settings = registry.settings | |
421 |
|
421 | |||
422 | # enable https redirects based on HTTP_X_URL_SCHEME set by proxy |
|
422 | # enable https redirects based on HTTP_X_URL_SCHEME set by proxy | |
423 | pyramid_app = HttpsFixup(pyramid_app, settings) |
|
423 | pyramid_app = HttpsFixup(pyramid_app, settings) | |
424 |
|
424 | |||
425 | pyramid_app, _ae_client = wrap_in_appenlight_if_enabled( |
|
425 | pyramid_app, _ae_client = wrap_in_appenlight_if_enabled( | |
426 | pyramid_app, settings) |
|
426 | pyramid_app, settings) | |
427 | registry.ae_client = _ae_client |
|
427 | registry.ae_client = _ae_client | |
428 |
|
428 | |||
429 | if settings['gzip_responses']: |
|
429 | if settings['gzip_responses']: | |
430 | pyramid_app = make_gzip_middleware( |
|
430 | pyramid_app = make_gzip_middleware( | |
431 | pyramid_app, settings, compress_level=1) |
|
431 | pyramid_app, settings, compress_level=1) | |
432 |
|
432 | |||
433 | # this should be the outer most middleware in the wsgi stack since |
|
433 | # this should be the outer most middleware in the wsgi stack since | |
434 | # middleware like Routes make database calls |
|
434 | # middleware like Routes make database calls | |
435 | def pyramid_app_with_cleanup(environ, start_response): |
|
435 | def pyramid_app_with_cleanup(environ, start_response): | |
436 | try: |
|
436 | try: | |
437 | return pyramid_app(environ, start_response) |
|
437 | return pyramid_app(environ, start_response) | |
438 | finally: |
|
438 | finally: | |
439 | # Dispose current database session and rollback uncommitted |
|
439 | # Dispose current database session and rollback uncommitted | |
440 | # transactions. |
|
440 | # transactions. | |
441 | meta.Session.remove() |
|
441 | meta.Session.remove() | |
442 |
|
442 | |||
443 | # In a single threaded mode server, on non sqlite db we should have |
|
443 | # In a single threaded mode server, on non sqlite db we should have | |
444 | # '0 Current Checked out connections' at the end of a request, |
|
444 | # '0 Current Checked out connections' at the end of a request, | |
445 | # if not, then something, somewhere is leaving a connection open |
|
445 | # if not, then something, somewhere is leaving a connection open | |
446 | pool = meta.Base.metadata.bind.engine.pool |
|
446 | pool = meta.Base.metadata.bind.engine.pool | |
447 | log.debug('sa pool status: %s', pool.status()) |
|
447 | log.debug('sa pool status: %s', pool.status()) | |
448 | log.debug('Request processing finalized') |
|
448 | log.debug('Request processing finalized') | |
449 |
|
449 | |||
450 | return pyramid_app_with_cleanup |
|
450 | return pyramid_app_with_cleanup | |
451 |
|
451 | |||
452 |
|
452 | |||
453 | def sanitize_settings_and_apply_defaults(global_config, settings): |
|
453 | def sanitize_settings_and_apply_defaults(global_config, settings): | |
454 | """ |
|
454 | """ | |
455 | Applies settings defaults and does all type conversion. |
|
455 | Applies settings defaults and does all type conversion. | |
456 |
|
456 | |||
457 | We would move all settings parsing and preparation into this place, so that |
|
457 | We would move all settings parsing and preparation into this place, so that | |
458 | we have only one place left which deals with this part. The remaining parts |
|
458 | we have only one place left which deals with this part. The remaining parts | |
459 | of the application would start to rely fully on well prepared settings. |
|
459 | of the application would start to rely fully on well prepared settings. | |
460 |
|
460 | |||
461 | This piece would later be split up per topic to avoid a big fat monster |
|
461 | This piece would later be split up per topic to avoid a big fat monster | |
462 | function. |
|
462 | function. | |
463 | """ |
|
463 | """ | |
464 |
|
464 | |||
465 | global_settings_maker = SettingsMaker(global_config) |
|
465 | global_settings_maker = SettingsMaker(global_config) | |
466 | global_settings_maker.make_setting('debug', default=False, parser='bool') |
|
466 | global_settings_maker.make_setting('debug', default=False, parser='bool') | |
467 | debug_enabled = asbool(global_config.get('debug')) |
|
467 | debug_enabled = asbool(global_config.get('debug')) | |
468 |
|
468 | |||
469 | settings_maker = SettingsMaker(settings) |
|
469 | settings_maker = SettingsMaker(settings) | |
470 |
|
470 | |||
471 | settings_maker.make_setting( |
|
471 | settings_maker.make_setting( | |
472 | 'logging.autoconfigure', |
|
472 | 'logging.autoconfigure', | |
473 | default=False, |
|
473 | default=False, | |
474 | parser='bool') |
|
474 | parser='bool') | |
475 |
|
475 | |||
476 | logging_conf = os.path.join(os.path.dirname(global_config.get('__file__')), 'logging.ini') |
|
476 | logging_conf = os.path.join(os.path.dirname(global_config.get('__file__')), 'logging.ini') | |
477 | settings_maker.enable_logging(logging_conf, level='INFO' if debug_enabled else 'DEBUG') |
|
477 | settings_maker.enable_logging(logging_conf, level='INFO' if debug_enabled else 'DEBUG') | |
478 |
|
478 | |||
479 | # Default includes, possible to change as a user |
|
479 | # Default includes, possible to change as a user | |
480 | pyramid_includes = settings_maker.make_setting('pyramid.includes', [], parser='list:newline') |
|
480 | pyramid_includes = settings_maker.make_setting('pyramid.includes', [], parser='list:newline') | |
481 | log.debug( |
|
481 | log.debug( | |
482 | "Using the following pyramid.includes: %s", |
|
482 | "Using the following pyramid.includes: %s", | |
483 | pyramid_includes) |
|
483 | pyramid_includes) | |
484 |
|
484 | |||
485 | settings_maker.make_setting('rhodecode.edition', 'Community Edition') |
|
485 | settings_maker.make_setting('rhodecode.edition', 'Community Edition') | |
486 | settings_maker.make_setting('rhodecode.edition_id', 'CE') |
|
486 | settings_maker.make_setting('rhodecode.edition_id', 'CE') | |
487 |
|
487 | |||
488 | if 'mako.default_filters' not in settings: |
|
488 | if 'mako.default_filters' not in settings: | |
489 | # set custom default filters if we don't have it defined |
|
489 | # set custom default filters if we don't have it defined | |
490 | settings['mako.imports'] = 'from rhodecode.lib.base import h_filter' |
|
490 | settings['mako.imports'] = 'from rhodecode.lib.base import h_filter' | |
491 | settings['mako.default_filters'] = 'h_filter' |
|
491 | settings['mako.default_filters'] = 'h_filter' | |
492 |
|
492 | |||
493 | if 'mako.directories' not in settings: |
|
493 | if 'mako.directories' not in settings: | |
494 | mako_directories = settings.setdefault('mako.directories', [ |
|
494 | mako_directories = settings.setdefault('mako.directories', [ | |
495 | # Base templates of the original application |
|
495 | # Base templates of the original application | |
496 | 'rhodecode:templates', |
|
496 | 'rhodecode:templates', | |
497 | ]) |
|
497 | ]) | |
498 | log.debug( |
|
498 | log.debug( | |
499 | "Using the following Mako template directories: %s", |
|
499 | "Using the following Mako template directories: %s", | |
500 | mako_directories) |
|
500 | mako_directories) | |
501 |
|
501 | |||
502 | # NOTE(marcink): fix redis requirement for schema of connection since 3.X |
|
502 | # NOTE(marcink): fix redis requirement for schema of connection since 3.X | |
503 | if 'beaker.session.type' in settings and settings['beaker.session.type'] == 'ext:redis': |
|
503 | if 'beaker.session.type' in settings and settings['beaker.session.type'] == 'ext:redis': | |
504 | raw_url = settings['beaker.session.url'] |
|
504 | raw_url = settings['beaker.session.url'] | |
505 | if not raw_url.startswith(('redis://', 'rediss://', 'unix://')): |
|
505 | if not raw_url.startswith(('redis://', 'rediss://', 'unix://')): | |
506 | settings['beaker.session.url'] = 'redis://' + raw_url |
|
506 | settings['beaker.session.url'] = 'redis://' + raw_url | |
507 |
|
507 | |||
508 | settings_maker.make_setting('__file__', global_config.get('__file__')) |
|
508 | settings_maker.make_setting('__file__', global_config.get('__file__')) | |
509 |
|
509 | |||
510 | # TODO: johbo: Re-think this, usually the call to config.include |
|
510 | # TODO: johbo: Re-think this, usually the call to config.include | |
511 | # should allow to pass in a prefix. |
|
511 | # should allow to pass in a prefix. | |
512 | settings_maker.make_setting('rhodecode.api.url', '/_admin/api') |
|
512 | settings_maker.make_setting('rhodecode.api.url', '/_admin/api') | |
513 |
|
513 | |||
514 | # Sanitize generic settings. |
|
514 | # Sanitize generic settings. | |
515 | settings_maker.make_setting('default_encoding', 'UTF-8', parser='list') |
|
515 | settings_maker.make_setting('default_encoding', 'UTF-8', parser='list') | |
516 | settings_maker.make_setting('is_test', False, parser='bool') |
|
516 | settings_maker.make_setting('is_test', False, parser='bool') | |
517 | settings_maker.make_setting('gzip_responses', False, parser='bool') |
|
517 | settings_maker.make_setting('gzip_responses', False, parser='bool') | |
518 |
|
518 | |||
519 | # statsd |
|
519 | # statsd | |
520 | settings_maker.make_setting('statsd.enabled', False, parser='bool') |
|
520 | settings_maker.make_setting('statsd.enabled', False, parser='bool') | |
521 | settings_maker.make_setting('statsd.statsd_host', 'statsd-exporter', parser='string') |
|
521 | settings_maker.make_setting('statsd.statsd_host', 'statsd-exporter', parser='string') | |
522 | settings_maker.make_setting('statsd.statsd_port', 9125, parser='int') |
|
522 | settings_maker.make_setting('statsd.statsd_port', 9125, parser='int') | |
523 | settings_maker.make_setting('statsd.statsd_prefix', '') |
|
523 | settings_maker.make_setting('statsd.statsd_prefix', '') | |
524 | settings_maker.make_setting('statsd.statsd_ipv6', False, parser='bool') |
|
524 | settings_maker.make_setting('statsd.statsd_ipv6', False, parser='bool') | |
525 |
|
525 | |||
526 | settings_maker.make_setting('vcs.svn.compatible_version', '') |
|
526 | settings_maker.make_setting('vcs.svn.compatible_version', '') | |
527 | settings_maker.make_setting('vcs.hooks.protocol', 'http') |
|
527 | settings_maker.make_setting('vcs.hooks.protocol', 'http') | |
528 | settings_maker.make_setting('vcs.hooks.host', '127.0.0.1') |
|
528 | settings_maker.make_setting('vcs.hooks.host', '127.0.0.1') | |
529 | settings_maker.make_setting('vcs.scm_app_implementation', 'http') |
|
529 | settings_maker.make_setting('vcs.scm_app_implementation', 'http') | |
530 | settings_maker.make_setting('vcs.server', '') |
|
530 | settings_maker.make_setting('vcs.server', '') | |
531 | settings_maker.make_setting('vcs.server.protocol', 'http') |
|
531 | settings_maker.make_setting('vcs.server.protocol', 'http') | |
532 | settings_maker.make_setting('startup.import_repos', 'false', parser='bool') |
|
532 | settings_maker.make_setting('startup.import_repos', 'false', parser='bool') | |
533 | settings_maker.make_setting('vcs.hooks.direct_calls', 'false', parser='bool') |
|
533 | settings_maker.make_setting('vcs.hooks.direct_calls', 'false', parser='bool') | |
534 | settings_maker.make_setting('vcs.server.enable', 'true', parser='bool') |
|
534 | settings_maker.make_setting('vcs.server.enable', 'true', parser='bool') | |
535 | settings_maker.make_setting('vcs.start_server', 'false', parser='bool') |
|
535 | settings_maker.make_setting('vcs.start_server', 'false', parser='bool') | |
536 | settings_maker.make_setting('vcs.backends', 'hg, git, svn', parser='list') |
|
536 | settings_maker.make_setting('vcs.backends', 'hg, git, svn', parser='list') | |
537 | settings_maker.make_setting('vcs.connection_timeout', 3600, parser='int') |
|
537 | settings_maker.make_setting('vcs.connection_timeout', 3600, parser='int') | |
538 |
|
538 | |||
539 | settings_maker.make_setting('vcs.methods.cache', True, parser='bool') |
|
539 | settings_maker.make_setting('vcs.methods.cache', True, parser='bool') | |
540 |
|
540 | |||
541 | # Support legacy values of vcs.scm_app_implementation. Legacy |
|
541 | # Support legacy values of vcs.scm_app_implementation. Legacy | |
542 | # configurations may use 'rhodecode.lib.middleware.utils.scm_app_http', or |
|
542 | # configurations may use 'rhodecode.lib.middleware.utils.scm_app_http', or | |
543 | # disabled since 4.13 'vcsserver.scm_app' which is now mapped to 'http'. |
|
543 | # disabled since 4.13 'vcsserver.scm_app' which is now mapped to 'http'. | |
544 | scm_app_impl = settings['vcs.scm_app_implementation'] |
|
544 | scm_app_impl = settings['vcs.scm_app_implementation'] | |
545 | if scm_app_impl in ['rhodecode.lib.middleware.utils.scm_app_http', 'vcsserver.scm_app']: |
|
545 | if scm_app_impl in ['rhodecode.lib.middleware.utils.scm_app_http', 'vcsserver.scm_app']: | |
546 | settings['vcs.scm_app_implementation'] = 'http' |
|
546 | settings['vcs.scm_app_implementation'] = 'http' | |
547 |
|
547 | |||
548 | settings_maker.make_setting('appenlight', False, parser='bool') |
|
548 | settings_maker.make_setting('appenlight', False, parser='bool') | |
549 |
|
549 | |||
550 | temp_store = tempfile.gettempdir() |
|
550 | temp_store = tempfile.gettempdir() | |
551 |
|
|
551 | tmp_cache_dir = os.path.join(temp_store, 'rc_cache') | |
552 |
|
552 | |||
553 | # save default, cache dir, and use it for all backends later. |
|
553 | # save default, cache dir, and use it for all backends later. | |
554 | default_cache_dir = settings_maker.make_setting( |
|
554 | default_cache_dir = settings_maker.make_setting( | |
555 | 'cache_dir', |
|
555 | 'cache_dir', | |
556 |
default= |
|
556 | default=tmp_cache_dir, default_when_empty=True, | |
557 | parser='dir:ensured') |
|
557 | parser='dir:ensured') | |
558 |
|
558 | |||
559 | # exception store cache |
|
559 | # exception store cache | |
560 | settings_maker.make_setting( |
|
560 | settings_maker.make_setting( | |
561 | 'exception_tracker.store_path', |
|
561 | 'exception_tracker.store_path', | |
562 | default=os.path.join(default_cache_dir, 'exc_store'), default_when_empty=True, |
|
562 | default=os.path.join(default_cache_dir, 'exc_store'), default_when_empty=True, | |
563 | parser='dir:ensured' |
|
563 | parser='dir:ensured' | |
564 | ) |
|
564 | ) | |
565 |
|
565 | |||
566 | settings_maker.make_setting( |
|
566 | settings_maker.make_setting( | |
567 | 'celerybeat-schedule.path', |
|
567 | 'celerybeat-schedule.path', | |
568 | default=os.path.join(default_cache_dir, 'celerybeat_schedule', 'celerybeat-schedule.db'), default_when_empty=True, |
|
568 | default=os.path.join(default_cache_dir, 'celerybeat_schedule', 'celerybeat-schedule.db'), default_when_empty=True, | |
569 | parser='file:ensured' |
|
569 | parser='file:ensured' | |
570 | ) |
|
570 | ) | |
571 |
|
571 | |||
572 | settings_maker.make_setting('exception_tracker.send_email', False, parser='bool') |
|
572 | settings_maker.make_setting('exception_tracker.send_email', False, parser='bool') | |
573 | settings_maker.make_setting('exception_tracker.email_prefix', '[RHODECODE ERROR]', default_when_empty=True) |
|
573 | settings_maker.make_setting('exception_tracker.email_prefix', '[RHODECODE ERROR]', default_when_empty=True) | |
574 |
|
574 | |||
575 | # cache_general |
|
575 | # cache_general | |
576 | settings_maker.make_setting('rc_cache.cache_general.backend', 'dogpile.cache.rc.file_namespace') |
|
576 | settings_maker.make_setting('rc_cache.cache_general.backend', 'dogpile.cache.rc.file_namespace') | |
577 | settings_maker.make_setting('rc_cache.cache_general.expiration_time', 60 * 60 * 12, parser='int') |
|
577 | settings_maker.make_setting('rc_cache.cache_general.expiration_time', 60 * 60 * 12, parser='int') | |
578 | settings_maker.make_setting('rc_cache.cache_general.arguments.filename', os.path.join(default_cache_dir, 'rhodecode_cache_general.db')) |
|
578 | settings_maker.make_setting('rc_cache.cache_general.arguments.filename', os.path.join(default_cache_dir, 'rhodecode_cache_general.db')) | |
579 |
|
579 | |||
580 | # cache_perms |
|
580 | # cache_perms | |
581 | settings_maker.make_setting('rc_cache.cache_perms.backend', 'dogpile.cache.rc.file_namespace') |
|
581 | settings_maker.make_setting('rc_cache.cache_perms.backend', 'dogpile.cache.rc.file_namespace') | |
582 | settings_maker.make_setting('rc_cache.cache_perms.expiration_time', 60 * 60, parser='int') |
|
582 | settings_maker.make_setting('rc_cache.cache_perms.expiration_time', 60 * 60, parser='int') | |
583 | settings_maker.make_setting('rc_cache.cache_perms.arguments.filename', os.path.join(default_cache_dir, 'rhodecode_cache_perms.db')) |
|
583 | settings_maker.make_setting('rc_cache.cache_perms.arguments.filename', os.path.join(default_cache_dir, 'rhodecode_cache_perms.db')) | |
584 |
|
584 | |||
585 | # cache_repo |
|
585 | # cache_repo | |
586 | settings_maker.make_setting('rc_cache.cache_repo.backend', 'dogpile.cache.rc.file_namespace') |
|
586 | settings_maker.make_setting('rc_cache.cache_repo.backend', 'dogpile.cache.rc.file_namespace') | |
587 | settings_maker.make_setting('rc_cache.cache_repo.expiration_time', 60 * 60 * 24 * 30, parser='int') |
|
587 | settings_maker.make_setting('rc_cache.cache_repo.expiration_time', 60 * 60 * 24 * 30, parser='int') | |
588 | settings_maker.make_setting('rc_cache.cache_repo.arguments.filename', os.path.join(default_cache_dir, 'rhodecode_cache_repo.db')) |
|
588 | settings_maker.make_setting('rc_cache.cache_repo.arguments.filename', os.path.join(default_cache_dir, 'rhodecode_cache_repo.db')) | |
589 |
|
589 | |||
590 | # cache_license |
|
590 | # cache_license | |
591 | settings_maker.make_setting('rc_cache.cache_license.backend', 'dogpile.cache.rc.file_namespace') |
|
591 | settings_maker.make_setting('rc_cache.cache_license.backend', 'dogpile.cache.rc.file_namespace') | |
592 | settings_maker.make_setting('rc_cache.cache_license.expiration_time', 60 * 5, parser='int') |
|
592 | settings_maker.make_setting('rc_cache.cache_license.expiration_time', 60 * 5, parser='int') | |
593 | settings_maker.make_setting('rc_cache.cache_license.arguments.filename', os.path.join(default_cache_dir, 'rhodecode_cache_license.db')) |
|
593 | settings_maker.make_setting('rc_cache.cache_license.arguments.filename', os.path.join(default_cache_dir, 'rhodecode_cache_license.db')) | |
594 |
|
594 | |||
595 | # cache_repo_longterm memory, 96H |
|
595 | # cache_repo_longterm memory, 96H | |
596 | settings_maker.make_setting('rc_cache.cache_repo_longterm.backend', 'dogpile.cache.rc.memory_lru') |
|
596 | settings_maker.make_setting('rc_cache.cache_repo_longterm.backend', 'dogpile.cache.rc.memory_lru') | |
597 | settings_maker.make_setting('rc_cache.cache_repo_longterm.expiration_time', 345600, parser='int') |
|
597 | settings_maker.make_setting('rc_cache.cache_repo_longterm.expiration_time', 345600, parser='int') | |
598 | settings_maker.make_setting('rc_cache.cache_repo_longterm.max_size', 10000, parser='int') |
|
598 | settings_maker.make_setting('rc_cache.cache_repo_longterm.max_size', 10000, parser='int') | |
599 |
|
599 | |||
600 | # sql_cache_short |
|
600 | # sql_cache_short | |
601 | settings_maker.make_setting('rc_cache.sql_cache_short.backend', 'dogpile.cache.rc.memory_lru') |
|
601 | settings_maker.make_setting('rc_cache.sql_cache_short.backend', 'dogpile.cache.rc.memory_lru') | |
602 | settings_maker.make_setting('rc_cache.sql_cache_short.expiration_time', 30, parser='int') |
|
602 | settings_maker.make_setting('rc_cache.sql_cache_short.expiration_time', 30, parser='int') | |
603 | settings_maker.make_setting('rc_cache.sql_cache_short.max_size', 10000, parser='int') |
|
603 | settings_maker.make_setting('rc_cache.sql_cache_short.max_size', 10000, parser='int') | |
604 |
|
604 | |||
605 | settings_maker.env_expand() |
|
605 | settings_maker.env_expand() | |
606 |
|
606 | |||
607 | # configure instance id |
|
607 | # configure instance id | |
608 | config_utils.set_instance_id(settings) |
|
608 | config_utils.set_instance_id(settings) | |
609 |
|
609 | |||
610 | return settings |
|
610 | return settings |
General Comments 0
You need to be logged in to leave comments.
Login now