Show More
@@ -1,91 +1,91 b'' | |||
|
1 | 1 | # Copyright (C) 2010-2023 RhodeCode GmbH |
|
2 | 2 | # |
|
3 | 3 | # This program is free software: you can redistribute it and/or modify |
|
4 | 4 | # it under the terms of the GNU Affero General Public License, version 3 |
|
5 | 5 | # (only), as published by the Free Software Foundation. |
|
6 | 6 | # |
|
7 | 7 | # This program is distributed in the hope that it will be useful, |
|
8 | 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9 | 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
10 | 10 | # GNU General Public License for more details. |
|
11 | 11 | # |
|
12 | 12 | # You should have received a copy of the GNU Affero General Public License |
|
13 | 13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
14 | 14 | # |
|
15 | 15 | # This program is dual-licensed. If you wish to learn more about the |
|
16 | 16 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
17 | 17 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
18 | 18 | |
|
19 | 19 | import os |
|
20 | 20 | import datetime |
|
21 | 21 | import collections |
|
22 | 22 | import logging |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | now = datetime.datetime.now() |
|
26 | 26 | now = now.strftime("%Y-%m-%d %H:%M:%S") + '.' + f"{int(now.microsecond/1000):03d}" |
|
27 | 27 | |
|
28 | 28 | log = logging.getLogger(__name__) |
|
29 | 29 | log.debug(f'{now} Starting RhodeCode imports...') |
|
30 | 30 | |
|
31 | 31 | |
|
32 | 32 | VERSION = tuple(open(os.path.join( |
|
33 | os.path.dirname(__file__), 'VERSION')).read().split('.')) | |
|
33 | os.path.dirname(__file__), 'VERSION')).read().strip().split('.')) | |
|
34 | 34 | |
|
35 | 35 | BACKENDS = collections.OrderedDict() |
|
36 | 36 | |
|
37 | 37 | BACKENDS['hg'] = 'Mercurial repository' |
|
38 | 38 | BACKENDS['git'] = 'Git repository' |
|
39 | 39 | BACKENDS['svn'] = 'Subversion repository' |
|
40 | 40 | |
|
41 | 41 | |
|
42 | 42 | CELERY_ENABLED = False |
|
43 | 43 | CELERY_EAGER = False |
|
44 | 44 | |
|
45 | 45 | # link to config for pyramid |
|
46 | 46 | CONFIG = {} |
|
47 | 47 | |
|
48 | 48 | |
|
49 | 49 | class ConfigGet: |
|
50 | 50 | NotGiven = object() |
|
51 | 51 | |
|
52 | 52 | def _get_val_or_missing(self, key, missing): |
|
53 | 53 | if key not in CONFIG: |
|
54 | 54 | if missing == self.NotGiven: |
|
55 | 55 | return missing |
|
56 | 56 | # we don't get key, we don't get missing value, return nothing similar as config.get(key) |
|
57 | 57 | return None |
|
58 | 58 | else: |
|
59 | 59 | val = CONFIG[key] |
|
60 | 60 | return val |
|
61 | 61 | |
|
62 | 62 | def get_str(self, key, missing=NotGiven): |
|
63 | 63 | from rhodecode.lib.str_utils import safe_str |
|
64 | 64 | val = self._get_val_or_missing(key, missing) |
|
65 | 65 | return safe_str(val) |
|
66 | 66 | |
|
67 | 67 | def get_int(self, key, missing=NotGiven): |
|
68 | 68 | from rhodecode.lib.str_utils import safe_int |
|
69 | 69 | val = self._get_val_or_missing(key, missing) |
|
70 | 70 | return safe_int(val) |
|
71 | 71 | |
|
72 | 72 | def get_bool(self, key, missing=NotGiven): |
|
73 | 73 | from rhodecode.lib.type_utils import str2bool |
|
74 | 74 | val = self._get_val_or_missing(key, missing) |
|
75 | 75 | return str2bool(val) |
|
76 | 76 | |
|
77 | 77 | # Populated with the settings dictionary from application init in |
|
78 | 78 | # rhodecode.conf.environment.load_pyramid_environment |
|
79 | 79 | PYRAMID_SETTINGS = {} |
|
80 | 80 | |
|
81 | 81 | # Linked module for extensions |
|
82 | 82 | EXTENSIONS = {} |
|
83 | 83 | |
|
84 | 84 | __version__ = ('.'.join((str(each) for each in VERSION[:3]))) |
|
85 | 85 | __dbversion__ = 115 # defines current db version for migrations |
|
86 | 86 | __license__ = 'AGPLv3, and Commercial License' |
|
87 | 87 | __author__ = 'RhodeCode GmbH' |
|
88 | 88 | __url__ = 'https://code.rhodecode.com' |
|
89 | 89 | |
|
90 | 90 | is_test = os.getenv('RC_TEST', '0') == '1' |
|
91 | 91 | disable_error_handler = False |
General Comments 0
You need to be logged in to leave comments.
Login now