Show More
@@ -1,237 +1,237 b'' | |||||
1 | # Copyright (C) 2010-2023 RhodeCode GmbH |
|
1 | # Copyright (C) 2010-2023 RhodeCode GmbH | |
2 | # |
|
2 | # | |
3 | # This program is free software: you can redistribute it and/or modify |
|
3 | # This program is free software: you can redistribute it and/or modify | |
4 | # it under the terms of the GNU Affero General Public License, version 3 |
|
4 | # it under the terms of the GNU Affero General Public License, version 3 | |
5 | # (only), as published by the Free Software Foundation. |
|
5 | # (only), as published by the Free Software Foundation. | |
6 | # |
|
6 | # | |
7 | # This program is distributed in the hope that it will be useful, |
|
7 | # This program is distributed in the hope that it will be useful, | |
8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 | # GNU General Public License for more details. |
|
10 | # GNU General Public License for more details. | |
11 | # |
|
11 | # | |
12 | # You should have received a copy of the GNU Affero General Public License |
|
12 | # You should have received a copy of the GNU Affero General Public License | |
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
14 | # |
|
14 | # | |
15 | # This program is dual-licensed. If you wish to learn more about the |
|
15 | # This program is dual-licensed. If you wish to learn more about the | |
16 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
16 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
17 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
17 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
18 |
|
18 | |||
19 | import os |
|
19 | import os | |
20 | import tempfile |
|
20 | import tempfile | |
21 | import logging |
|
21 | import logging | |
22 |
|
22 | |||
23 | from pyramid.settings import asbool |
|
23 | from pyramid.settings import asbool | |
24 |
|
24 | |||
25 | from rhodecode.config.settings_maker import SettingsMaker |
|
25 | from rhodecode.config.settings_maker import SettingsMaker | |
26 | from rhodecode.config import utils as config_utils |
|
26 | from rhodecode.config import utils as config_utils | |
27 |
|
27 | |||
28 | log = logging.getLogger(__name__) |
|
28 | log = logging.getLogger(__name__) | |
29 |
|
29 | |||
30 |
|
30 | |||
31 | def sanitize_settings_and_apply_defaults(global_config, settings): |
|
31 | def sanitize_settings_and_apply_defaults(global_config, settings): | |
32 | """ |
|
32 | """ | |
33 | Applies settings defaults and does all type conversion. |
|
33 | Applies settings defaults and does all type conversion. | |
34 |
|
34 | |||
35 | We would move all settings parsing and preparation into this place, so that |
|
35 | We would move all settings parsing and preparation into this place, so that | |
36 | we have only one place left which deals with this part. The remaining parts |
|
36 | we have only one place left which deals with this part. The remaining parts | |
37 | of the application would start to rely fully on well-prepared settings. |
|
37 | of the application would start to rely fully on well-prepared settings. | |
38 |
|
38 | |||
39 | This piece would later be split up per topic to avoid a big fat monster |
|
39 | This piece would later be split up per topic to avoid a big fat monster | |
40 | function. |
|
40 | function. | |
41 | """ |
|
41 | """ | |
42 | jn = os.path.join |
|
42 | jn = os.path.join | |
43 |
|
43 | |||
44 | global_settings_maker = SettingsMaker(global_config) |
|
44 | global_settings_maker = SettingsMaker(global_config) | |
45 | global_settings_maker.make_setting('debug', default=False, parser='bool') |
|
45 | global_settings_maker.make_setting('debug', default=False, parser='bool') | |
46 | debug_enabled = asbool(global_config.get('debug')) |
|
46 | debug_enabled = asbool(global_config.get('debug')) | |
47 |
|
47 | |||
48 | settings_maker = SettingsMaker(settings) |
|
48 | settings_maker = SettingsMaker(settings) | |
49 |
|
49 | |||
50 | settings_maker.make_setting( |
|
50 | settings_maker.make_setting( | |
51 | 'logging.autoconfigure', |
|
51 | 'logging.autoconfigure', | |
52 | default=False, |
|
52 | default=False, | |
53 | parser='bool') |
|
53 | parser='bool') | |
54 |
|
54 | |||
55 | ini_loc = os.path.dirname(global_config.get('__file__')) |
|
55 | ini_loc = os.path.dirname(global_config.get('__file__')) | |
56 | logging_conf = jn(ini_loc, 'logging.ini') |
|
56 | logging_conf = jn(ini_loc, 'logging.ini') | |
57 | settings_maker.enable_logging(logging_conf, level='INFO' if debug_enabled else 'DEBUG') |
|
57 | settings_maker.enable_logging(logging_conf, level='INFO' if debug_enabled else 'DEBUG') | |
58 |
|
58 | |||
59 | # Default includes, possible to change as a user |
|
59 | # Default includes, possible to change as a user | |
60 | pyramid_includes = settings_maker.make_setting('pyramid.includes', [], parser='list:newline') |
|
60 | pyramid_includes = settings_maker.make_setting('pyramid.includes', [], parser='list:newline') | |
61 | log.debug( |
|
61 | log.debug( | |
62 | "Using the following pyramid.includes: %s", |
|
62 | "Using the following pyramid.includes: %s", | |
63 | pyramid_includes) |
|
63 | pyramid_includes) | |
64 |
|
64 | |||
65 | settings_maker.make_setting('rhodecode.edition', 'Community Edition') |
|
65 | settings_maker.make_setting('rhodecode.edition', 'Community Edition') | |
66 | settings_maker.make_setting('rhodecode.edition_id', 'CE') |
|
66 | settings_maker.make_setting('rhodecode.edition_id', 'CE') | |
67 |
|
67 | |||
68 | if 'mako.default_filters' not in settings: |
|
68 | if 'mako.default_filters' not in settings: | |
69 | # set custom default filters if we don't have it defined |
|
69 | # set custom default filters if we don't have it defined | |
70 | settings['mako.imports'] = 'from rhodecode.lib.base import h_filter' |
|
70 | settings['mako.imports'] = 'from rhodecode.lib.base import h_filter' | |
71 | settings['mako.default_filters'] = 'h_filter' |
|
71 | settings['mako.default_filters'] = 'h_filter' | |
72 |
|
72 | |||
73 | if 'mako.directories' not in settings: |
|
73 | if 'mako.directories' not in settings: | |
74 | mako_directories = settings.setdefault('mako.directories', [ |
|
74 | mako_directories = settings.setdefault('mako.directories', [ | |
75 | # Base templates of the original application |
|
75 | # Base templates of the original application | |
76 | 'rhodecode:templates', |
|
76 | 'rhodecode:templates', | |
77 | ]) |
|
77 | ]) | |
78 | log.debug( |
|
78 | log.debug( | |
79 | "Using the following Mako template directories: %s", |
|
79 | "Using the following Mako template directories: %s", | |
80 | mako_directories) |
|
80 | mako_directories) | |
81 |
|
81 | |||
82 | # NOTE(marcink): fix redis requirement for schema of connection since 3.X |
|
82 | # NOTE(marcink): fix redis requirement for schema of connection since 3.X | |
83 | if 'beaker.session.type' in settings and settings['beaker.session.type'] == 'ext:redis': |
|
83 | if 'beaker.session.type' in settings and settings['beaker.session.type'] == 'ext:redis': | |
84 | raw_url = settings['beaker.session.url'] |
|
84 | raw_url = settings['beaker.session.url'] | |
85 | if not raw_url.startswith(('redis://', 'rediss://', 'unix://')): |
|
85 | if not raw_url.startswith(('redis://', 'rediss://', 'unix://')): | |
86 | settings['beaker.session.url'] = 'redis://' + raw_url |
|
86 | settings['beaker.session.url'] = 'redis://' + raw_url | |
87 |
|
87 | |||
88 | settings_maker.make_setting('__file__', global_config.get('__file__')) |
|
88 | settings_maker.make_setting('__file__', global_config.get('__file__')) | |
89 |
|
89 | |||
90 | # TODO: johbo: Re-think this, usually the call to config.include |
|
90 | # TODO: johbo: Re-think this, usually the call to config.include | |
91 | # should allow to pass in a prefix. |
|
91 | # should allow to pass in a prefix. | |
92 | settings_maker.make_setting('rhodecode.api.url', '/_admin/api') |
|
92 | settings_maker.make_setting('rhodecode.api.url', '/_admin/api') | |
93 |
|
93 | |||
94 | # Sanitize generic settings. |
|
94 | # Sanitize generic settings. | |
95 | settings_maker.make_setting('default_encoding', 'UTF-8', parser='list') |
|
95 | settings_maker.make_setting('default_encoding', 'UTF-8', parser='list') | |
96 | settings_maker.make_setting('gzip_responses', False, parser='bool') |
|
96 | settings_maker.make_setting('gzip_responses', False, parser='bool') | |
97 | settings_maker.make_setting('startup.import_repos', 'false', parser='bool') |
|
97 | settings_maker.make_setting('startup.import_repos', 'false', parser='bool') | |
98 |
|
98 | |||
99 | # License settings. |
|
99 | # License settings. | |
100 | settings_maker.make_setting('license.hide_license_info', False, parser='bool') |
|
100 | settings_maker.make_setting('license.hide_license_info', False, parser='bool') | |
101 |
settings_maker.make_setting('license.import_path', |
|
101 | settings_maker.make_setting('license.import_path', '') | |
102 | settings_maker.make_setting('license.import_path_mode', 'if-missing') |
|
102 | settings_maker.make_setting('license.import_path_mode', 'if-missing') | |
103 |
|
103 | |||
104 | # statsd |
|
104 | # statsd | |
105 | settings_maker.make_setting('statsd.enabled', False, parser='bool') |
|
105 | settings_maker.make_setting('statsd.enabled', False, parser='bool') | |
106 | settings_maker.make_setting('statsd.statsd_host', 'statsd-exporter', parser='string') |
|
106 | settings_maker.make_setting('statsd.statsd_host', 'statsd-exporter', parser='string') | |
107 | settings_maker.make_setting('statsd.statsd_port', 9125, parser='int') |
|
107 | settings_maker.make_setting('statsd.statsd_port', 9125, parser='int') | |
108 | settings_maker.make_setting('statsd.statsd_prefix', '') |
|
108 | settings_maker.make_setting('statsd.statsd_prefix', '') | |
109 | settings_maker.make_setting('statsd.statsd_ipv6', False, parser='bool') |
|
109 | settings_maker.make_setting('statsd.statsd_ipv6', False, parser='bool') | |
110 |
|
110 | |||
111 | settings_maker.make_setting('vcs.svn.compatible_version', '') |
|
111 | settings_maker.make_setting('vcs.svn.compatible_version', '') | |
112 | settings_maker.make_setting('vcs.svn.redis_conn', 'redis://redis:6379/0') |
|
112 | settings_maker.make_setting('vcs.svn.redis_conn', 'redis://redis:6379/0') | |
113 | settings_maker.make_setting('vcs.svn.proxy.enabled', True, parser='bool') |
|
113 | settings_maker.make_setting('vcs.svn.proxy.enabled', True, parser='bool') | |
114 | settings_maker.make_setting('vcs.svn.proxy.host', 'http://svn:8090', parser='string') |
|
114 | settings_maker.make_setting('vcs.svn.proxy.host', 'http://svn:8090', parser='string') | |
115 | settings_maker.make_setting('vcs.hooks.protocol.v2', 'celery') |
|
115 | settings_maker.make_setting('vcs.hooks.protocol.v2', 'celery') | |
116 | settings_maker.make_setting('vcs.hooks.host', '*') |
|
116 | settings_maker.make_setting('vcs.hooks.host', '*') | |
117 | settings_maker.make_setting('vcs.scm_app_implementation', 'http') |
|
117 | settings_maker.make_setting('vcs.scm_app_implementation', 'http') | |
118 | settings_maker.make_setting('vcs.server', '') |
|
118 | settings_maker.make_setting('vcs.server', '') | |
119 | settings_maker.make_setting('vcs.server.protocol', 'http') |
|
119 | settings_maker.make_setting('vcs.server.protocol', 'http') | |
120 | settings_maker.make_setting('vcs.server.enable', 'true', parser='bool') |
|
120 | settings_maker.make_setting('vcs.server.enable', 'true', parser='bool') | |
121 | settings_maker.make_setting('vcs.hooks.direct_calls', 'false', parser='bool') |
|
121 | settings_maker.make_setting('vcs.hooks.direct_calls', 'false', parser='bool') | |
122 | settings_maker.make_setting('vcs.start_server', 'false', parser='bool') |
|
122 | settings_maker.make_setting('vcs.start_server', 'false', parser='bool') | |
123 | settings_maker.make_setting('vcs.backends', 'hg, git, svn', parser='list') |
|
123 | settings_maker.make_setting('vcs.backends', 'hg, git, svn', parser='list') | |
124 | settings_maker.make_setting('vcs.connection_timeout', 3600, parser='int') |
|
124 | settings_maker.make_setting('vcs.connection_timeout', 3600, parser='int') | |
125 | settings_maker.make_setting('vcs.git.lfs.storage_location', '/var/opt/rhodecode_repo_store/.cache/git_lfs_store') |
|
125 | settings_maker.make_setting('vcs.git.lfs.storage_location', '/var/opt/rhodecode_repo_store/.cache/git_lfs_store') | |
126 | settings_maker.make_setting('vcs.hg.largefiles.storage_location', |
|
126 | settings_maker.make_setting('vcs.hg.largefiles.storage_location', | |
127 | '/var/opt/rhodecode_repo_store/.cache/hg_largefiles_store') |
|
127 | '/var/opt/rhodecode_repo_store/.cache/hg_largefiles_store') | |
128 |
|
128 | |||
129 | settings_maker.make_setting('vcs.methods.cache', True, parser='bool') |
|
129 | settings_maker.make_setting('vcs.methods.cache', True, parser='bool') | |
130 |
|
130 | |||
131 | # repo_store path |
|
131 | # repo_store path | |
132 | settings_maker.make_setting('repo_store.path', '/var/opt/rhodecode_repo_store') |
|
132 | settings_maker.make_setting('repo_store.path', '/var/opt/rhodecode_repo_store') | |
133 | # Support legacy values of vcs.scm_app_implementation. Legacy |
|
133 | # Support legacy values of vcs.scm_app_implementation. Legacy | |
134 | # configurations may use 'rhodecode.lib.middleware.utils.scm_app_http', or |
|
134 | # configurations may use 'rhodecode.lib.middleware.utils.scm_app_http', or | |
135 | # disabled since 4.13 'vcsserver.scm_app' which is now mapped to 'http'. |
|
135 | # disabled since 4.13 'vcsserver.scm_app' which is now mapped to 'http'. | |
136 | scm_app_impl = settings['vcs.scm_app_implementation'] |
|
136 | scm_app_impl = settings['vcs.scm_app_implementation'] | |
137 | if scm_app_impl in ['rhodecode.lib.middleware.utils.scm_app_http', 'vcsserver.scm_app']: |
|
137 | if scm_app_impl in ['rhodecode.lib.middleware.utils.scm_app_http', 'vcsserver.scm_app']: | |
138 | settings['vcs.scm_app_implementation'] = 'http' |
|
138 | settings['vcs.scm_app_implementation'] = 'http' | |
139 |
|
139 | |||
140 | settings_maker.make_setting('appenlight', False, parser='bool') |
|
140 | settings_maker.make_setting('appenlight', False, parser='bool') | |
141 |
|
141 | |||
142 | temp_store = tempfile.gettempdir() |
|
142 | temp_store = tempfile.gettempdir() | |
143 | tmp_cache_dir = jn(temp_store, 'rc_cache') |
|
143 | tmp_cache_dir = jn(temp_store, 'rc_cache') | |
144 |
|
144 | |||
145 | # save default, cache dir, and use it for all backends later. |
|
145 | # save default, cache dir, and use it for all backends later. | |
146 | default_cache_dir = settings_maker.make_setting( |
|
146 | default_cache_dir = settings_maker.make_setting( | |
147 | 'cache_dir', |
|
147 | 'cache_dir', | |
148 | default=tmp_cache_dir, default_when_empty=True, |
|
148 | default=tmp_cache_dir, default_when_empty=True, | |
149 | parser='dir:ensured') |
|
149 | parser='dir:ensured') | |
150 |
|
150 | |||
151 | # exception store cache |
|
151 | # exception store cache | |
152 | settings_maker.make_setting( |
|
152 | settings_maker.make_setting( | |
153 | 'exception_tracker.store_path', |
|
153 | 'exception_tracker.store_path', | |
154 | default=jn(default_cache_dir, 'exc_store'), default_when_empty=True, |
|
154 | default=jn(default_cache_dir, 'exc_store'), default_when_empty=True, | |
155 | parser='dir:ensured' |
|
155 | parser='dir:ensured' | |
156 | ) |
|
156 | ) | |
157 |
|
157 | |||
158 | settings_maker.make_setting( |
|
158 | settings_maker.make_setting( | |
159 | 'celerybeat-schedule.path', |
|
159 | 'celerybeat-schedule.path', | |
160 | default=jn(default_cache_dir, 'celerybeat_schedule', 'celerybeat-schedule.db'), default_when_empty=True, |
|
160 | default=jn(default_cache_dir, 'celerybeat_schedule', 'celerybeat-schedule.db'), default_when_empty=True, | |
161 | parser='file:ensured' |
|
161 | parser='file:ensured' | |
162 | ) |
|
162 | ) | |
163 |
|
163 | |||
164 | # celery |
|
164 | # celery | |
165 | broker_url = settings_maker.make_setting('celery.broker_url', 'redis://redis:6379/8') |
|
165 | broker_url = settings_maker.make_setting('celery.broker_url', 'redis://redis:6379/8') | |
166 | settings_maker.make_setting('celery.result_backend', broker_url) |
|
166 | settings_maker.make_setting('celery.result_backend', broker_url) | |
167 |
|
167 | |||
168 | settings_maker.make_setting('exception_tracker.send_email', False, parser='bool') |
|
168 | settings_maker.make_setting('exception_tracker.send_email', False, parser='bool') | |
169 | settings_maker.make_setting('exception_tracker.email_prefix', '[RHODECODE ERROR]', default_when_empty=True) |
|
169 | settings_maker.make_setting('exception_tracker.email_prefix', '[RHODECODE ERROR]', default_when_empty=True) | |
170 |
|
170 | |||
171 | # sessions, ensure file since no-value is memory |
|
171 | # sessions, ensure file since no-value is memory | |
172 | settings_maker.make_setting('beaker.session.type', 'file') |
|
172 | settings_maker.make_setting('beaker.session.type', 'file') | |
173 | settings_maker.make_setting('beaker.session.data_dir', jn(default_cache_dir, 'session_data')) |
|
173 | settings_maker.make_setting('beaker.session.data_dir', jn(default_cache_dir, 'session_data')) | |
174 |
|
174 | |||
175 | # cache_general |
|
175 | # cache_general | |
176 | settings_maker.make_setting('rc_cache.cache_general.backend', 'dogpile.cache.rc.file_namespace') |
|
176 | settings_maker.make_setting('rc_cache.cache_general.backend', 'dogpile.cache.rc.file_namespace') | |
177 | settings_maker.make_setting('rc_cache.cache_general.expiration_time', 60 * 60 * 12, parser='int') |
|
177 | settings_maker.make_setting('rc_cache.cache_general.expiration_time', 60 * 60 * 12, parser='int') | |
178 | settings_maker.make_setting('rc_cache.cache_general.arguments.filename', jn(default_cache_dir, 'rhodecode_cache_general.db')) |
|
178 | settings_maker.make_setting('rc_cache.cache_general.arguments.filename', jn(default_cache_dir, 'rhodecode_cache_general.db')) | |
179 |
|
179 | |||
180 | # cache_perms |
|
180 | # cache_perms | |
181 | settings_maker.make_setting('rc_cache.cache_perms.backend', 'dogpile.cache.rc.file_namespace') |
|
181 | settings_maker.make_setting('rc_cache.cache_perms.backend', 'dogpile.cache.rc.file_namespace') | |
182 | settings_maker.make_setting('rc_cache.cache_perms.expiration_time', 60 * 60, parser='int') |
|
182 | settings_maker.make_setting('rc_cache.cache_perms.expiration_time', 60 * 60, parser='int') | |
183 | settings_maker.make_setting('rc_cache.cache_perms.arguments.filename', jn(default_cache_dir, 'rhodecode_cache_perms_db')) |
|
183 | settings_maker.make_setting('rc_cache.cache_perms.arguments.filename', jn(default_cache_dir, 'rhodecode_cache_perms_db')) | |
184 |
|
184 | |||
185 | # cache_repo |
|
185 | # cache_repo | |
186 | settings_maker.make_setting('rc_cache.cache_repo.backend', 'dogpile.cache.rc.file_namespace') |
|
186 | settings_maker.make_setting('rc_cache.cache_repo.backend', 'dogpile.cache.rc.file_namespace') | |
187 | settings_maker.make_setting('rc_cache.cache_repo.expiration_time', 60 * 60 * 24 * 30, parser='int') |
|
187 | settings_maker.make_setting('rc_cache.cache_repo.expiration_time', 60 * 60 * 24 * 30, parser='int') | |
188 | settings_maker.make_setting('rc_cache.cache_repo.arguments.filename', jn(default_cache_dir, 'rhodecode_cache_repo_db')) |
|
188 | settings_maker.make_setting('rc_cache.cache_repo.arguments.filename', jn(default_cache_dir, 'rhodecode_cache_repo_db')) | |
189 |
|
189 | |||
190 | # cache_license |
|
190 | # cache_license | |
191 | settings_maker.make_setting('rc_cache.cache_license.backend', 'dogpile.cache.rc.file_namespace') |
|
191 | settings_maker.make_setting('rc_cache.cache_license.backend', 'dogpile.cache.rc.file_namespace') | |
192 | settings_maker.make_setting('rc_cache.cache_license.expiration_time', 60 * 5, parser='int') |
|
192 | settings_maker.make_setting('rc_cache.cache_license.expiration_time', 60 * 5, parser='int') | |
193 | settings_maker.make_setting('rc_cache.cache_license.arguments.filename', jn(default_cache_dir, 'rhodecode_cache_license_db')) |
|
193 | settings_maker.make_setting('rc_cache.cache_license.arguments.filename', jn(default_cache_dir, 'rhodecode_cache_license_db')) | |
194 |
|
194 | |||
195 | # cache_repo_longterm memory, 96H |
|
195 | # cache_repo_longterm memory, 96H | |
196 | settings_maker.make_setting('rc_cache.cache_repo_longterm.backend', 'dogpile.cache.rc.memory_lru') |
|
196 | settings_maker.make_setting('rc_cache.cache_repo_longterm.backend', 'dogpile.cache.rc.memory_lru') | |
197 | settings_maker.make_setting('rc_cache.cache_repo_longterm.expiration_time', 345600, parser='int') |
|
197 | settings_maker.make_setting('rc_cache.cache_repo_longterm.expiration_time', 345600, parser='int') | |
198 | settings_maker.make_setting('rc_cache.cache_repo_longterm.max_size', 10000, parser='int') |
|
198 | settings_maker.make_setting('rc_cache.cache_repo_longterm.max_size', 10000, parser='int') | |
199 |
|
199 | |||
200 | # sql_cache_short |
|
200 | # sql_cache_short | |
201 | settings_maker.make_setting('rc_cache.sql_cache_short.backend', 'dogpile.cache.rc.memory_lru') |
|
201 | settings_maker.make_setting('rc_cache.sql_cache_short.backend', 'dogpile.cache.rc.memory_lru') | |
202 | settings_maker.make_setting('rc_cache.sql_cache_short.expiration_time', 30, parser='int') |
|
202 | settings_maker.make_setting('rc_cache.sql_cache_short.expiration_time', 30, parser='int') | |
203 | settings_maker.make_setting('rc_cache.sql_cache_short.max_size', 10000, parser='int') |
|
203 | settings_maker.make_setting('rc_cache.sql_cache_short.max_size', 10000, parser='int') | |
204 |
|
204 | |||
205 | # archive_cache |
|
205 | # archive_cache | |
206 | settings_maker.make_setting('archive_cache.locking.url', 'redis://redis:6379/1') |
|
206 | settings_maker.make_setting('archive_cache.locking.url', 'redis://redis:6379/1') | |
207 | settings_maker.make_setting('archive_cache.backend.type', 'filesystem') |
|
207 | settings_maker.make_setting('archive_cache.backend.type', 'filesystem') | |
208 |
|
208 | |||
209 | settings_maker.make_setting('archive_cache.filesystem.store_dir', jn(default_cache_dir, 'archive_cache'), default_when_empty=True,) |
|
209 | settings_maker.make_setting('archive_cache.filesystem.store_dir', jn(default_cache_dir, 'archive_cache'), default_when_empty=True,) | |
210 | settings_maker.make_setting('archive_cache.filesystem.cache_shards', 8, parser='int') |
|
210 | settings_maker.make_setting('archive_cache.filesystem.cache_shards', 8, parser='int') | |
211 | settings_maker.make_setting('archive_cache.filesystem.cache_size_gb', 10, parser='float') |
|
211 | settings_maker.make_setting('archive_cache.filesystem.cache_size_gb', 10, parser='float') | |
212 | settings_maker.make_setting('archive_cache.filesystem.eviction_policy', 'least-recently-stored') |
|
212 | settings_maker.make_setting('archive_cache.filesystem.eviction_policy', 'least-recently-stored') | |
213 |
|
213 | |||
214 | settings_maker.make_setting('archive_cache.filesystem.retry', False, parser='bool') |
|
214 | settings_maker.make_setting('archive_cache.filesystem.retry', False, parser='bool') | |
215 | settings_maker.make_setting('archive_cache.filesystem.retry_backoff', 1, parser='int') |
|
215 | settings_maker.make_setting('archive_cache.filesystem.retry_backoff', 1, parser='int') | |
216 | settings_maker.make_setting('archive_cache.filesystem.retry_attempts', 10, parser='int') |
|
216 | settings_maker.make_setting('archive_cache.filesystem.retry_attempts', 10, parser='int') | |
217 |
|
217 | |||
218 | settings_maker.make_setting('archive_cache.objectstore.url', 'http://s3-minio:9000', default_when_empty=True,) |
|
218 | settings_maker.make_setting('archive_cache.objectstore.url', 'http://s3-minio:9000', default_when_empty=True,) | |
219 | settings_maker.make_setting('archive_cache.objectstore.key', '') |
|
219 | settings_maker.make_setting('archive_cache.objectstore.key', '') | |
220 | settings_maker.make_setting('archive_cache.objectstore.secret', '') |
|
220 | settings_maker.make_setting('archive_cache.objectstore.secret', '') | |
221 | settings_maker.make_setting('archive_cache.objectstore.region', 'eu-central-1') |
|
221 | settings_maker.make_setting('archive_cache.objectstore.region', 'eu-central-1') | |
222 | settings_maker.make_setting('archive_cache.objectstore.bucket', 'rhodecode-archive-cache', default_when_empty=True,) |
|
222 | settings_maker.make_setting('archive_cache.objectstore.bucket', 'rhodecode-archive-cache', default_when_empty=True,) | |
223 | settings_maker.make_setting('archive_cache.objectstore.bucket_shards', 8, parser='int') |
|
223 | settings_maker.make_setting('archive_cache.objectstore.bucket_shards', 8, parser='int') | |
224 |
|
224 | |||
225 | settings_maker.make_setting('archive_cache.objectstore.cache_size_gb', 10, parser='float') |
|
225 | settings_maker.make_setting('archive_cache.objectstore.cache_size_gb', 10, parser='float') | |
226 | settings_maker.make_setting('archive_cache.objectstore.eviction_policy', 'least-recently-stored') |
|
226 | settings_maker.make_setting('archive_cache.objectstore.eviction_policy', 'least-recently-stored') | |
227 |
|
227 | |||
228 | settings_maker.make_setting('archive_cache.objectstore.retry', False, parser='bool') |
|
228 | settings_maker.make_setting('archive_cache.objectstore.retry', False, parser='bool') | |
229 | settings_maker.make_setting('archive_cache.objectstore.retry_backoff', 1, parser='int') |
|
229 | settings_maker.make_setting('archive_cache.objectstore.retry_backoff', 1, parser='int') | |
230 | settings_maker.make_setting('archive_cache.objectstore.retry_attempts', 10, parser='int') |
|
230 | settings_maker.make_setting('archive_cache.objectstore.retry_attempts', 10, parser='int') | |
231 |
|
231 | |||
232 | settings_maker.env_expand() |
|
232 | settings_maker.env_expand() | |
233 |
|
233 | |||
234 | # configure instance id |
|
234 | # configure instance id | |
235 | config_utils.set_instance_id(settings) |
|
235 | config_utils.set_instance_id(settings) | |
236 |
|
236 | |||
237 | return settings |
|
237 | return settings |
General Comments 0
You need to be logged in to leave comments.
Login now