Show More
@@ -1,87 +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 | import logging | |
|
23 | ||
|
22 | 24 | |
|
23 | 25 | now = datetime.datetime.now() |
|
24 | 26 | now = now.strftime("%Y-%m-%d %H:%M:%S") + '.' + f"{int(now.microsecond/1000):03d}" |
|
25 | 27 | |
|
26 | print(f'{now} Starting RhodeCode imports...') | |
|
28 | log = logging.getLogger(__name__) | |
|
29 | log.debug(f'{now} Starting RhodeCode imports...') | |
|
30 | ||
|
27 | 31 | |
|
28 | 32 | VERSION = tuple(open(os.path.join( |
|
29 | 33 | os.path.dirname(__file__), 'VERSION')).read().split('.')) |
|
30 | 34 | |
|
31 | 35 | BACKENDS = collections.OrderedDict() |
|
32 | 36 | |
|
33 | 37 | BACKENDS['hg'] = 'Mercurial repository' |
|
34 | 38 | BACKENDS['git'] = 'Git repository' |
|
35 | 39 | BACKENDS['svn'] = 'Subversion repository' |
|
36 | 40 | |
|
37 | 41 | |
|
38 | 42 | CELERY_ENABLED = False |
|
39 | 43 | CELERY_EAGER = False |
|
40 | 44 | |
|
41 | 45 | # link to config for pyramid |
|
42 | 46 | CONFIG = {} |
|
43 | 47 | |
|
44 | 48 | |
|
45 | 49 | class ConfigGet: |
|
46 | 50 | NotGiven = object() |
|
47 | 51 | |
|
48 | 52 | def _get_val_or_missing(self, key, missing): |
|
49 | 53 | if key not in CONFIG: |
|
50 | 54 | if missing == self.NotGiven: |
|
51 | 55 | return missing |
|
52 | 56 | # we don't get key, we don't get missing value, return nothing similar as config.get(key) |
|
53 | 57 | return None |
|
54 | 58 | else: |
|
55 | 59 | val = CONFIG[key] |
|
56 | 60 | return val |
|
57 | 61 | |
|
58 | 62 | def get_str(self, key, missing=NotGiven): |
|
59 | 63 | from rhodecode.lib.str_utils import safe_str |
|
60 | 64 | val = self._get_val_or_missing(key, missing) |
|
61 | 65 | return safe_str(val) |
|
62 | 66 | |
|
63 | 67 | def get_int(self, key, missing=NotGiven): |
|
64 | 68 | from rhodecode.lib.str_utils import safe_int |
|
65 | 69 | val = self._get_val_or_missing(key, missing) |
|
66 | 70 | return safe_int(val) |
|
67 | 71 | |
|
68 | 72 | def get_bool(self, key, missing=NotGiven): |
|
69 | 73 | from rhodecode.lib.type_utils import str2bool |
|
70 | 74 | val = self._get_val_or_missing(key, missing) |
|
71 | 75 | return str2bool(val) |
|
72 | 76 | |
|
73 | 77 | # Populated with the settings dictionary from application init in |
|
74 | 78 | # rhodecode.conf.environment.load_pyramid_environment |
|
75 | 79 | PYRAMID_SETTINGS = {} |
|
76 | 80 | |
|
77 | 81 | # Linked module for extensions |
|
78 | 82 | EXTENSIONS = {} |
|
79 | 83 | |
|
80 | 84 | __version__ = ('.'.join((str(each) for each in VERSION[:3]))) |
|
81 | 85 | __dbversion__ = 114 # defines current db version for migrations |
|
82 | 86 | __license__ = 'AGPLv3, and Commercial License' |
|
83 | 87 | __author__ = 'RhodeCode GmbH' |
|
84 | 88 | __url__ = 'https://code.rhodecode.com' |
|
85 | 89 | |
|
86 | 90 | is_test = False |
|
87 | 91 | disable_error_handler = False |
General Comments 0
You need to be logged in to leave comments.
Login now