dsw-config 4.8.1__py2.py3-none-any.whl → 4.9.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dsw/config/build_info.py +4 -4
- dsw/config/keys.py +11 -80
- dsw/config/model.py +11 -85
- dsw/config/parser.py +6 -18
- {dsw_config-4.8.1.dist-info → dsw_config-4.9.0.dist-info}/METADATA +1 -1
- dsw_config-4.9.0.dist-info/RECORD +12 -0
- {dsw_config-4.8.1.dist-info → dsw_config-4.9.0.dist-info}/WHEEL +1 -1
- dsw_config-4.8.1.dist-info/RECORD +0 -12
- {dsw_config-4.8.1.dist-info → dsw_config-4.9.0.dist-info}/LICENSE +0 -0
- {dsw_config-4.8.1.dist-info → dsw_config-4.9.0.dist-info}/top_level.txt +0 -0
dsw/config/build_info.py
CHANGED
|
@@ -9,9 +9,9 @@ BuildInfo = namedtuple(
|
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
BUILD_INFO = BuildInfo(
|
|
12
|
-
version='v4.
|
|
13
|
-
built_at='2024-
|
|
14
|
-
sha='
|
|
12
|
+
version='v4.9.0~dd58266',
|
|
13
|
+
built_at='2024-08-06 07:00:28Z',
|
|
14
|
+
sha='dd582663c8732a3ccb199981b0dbb3be3c2301c1',
|
|
15
15
|
branch='HEAD',
|
|
16
|
-
tag='v4.
|
|
16
|
+
tag='v4.9.0',
|
|
17
17
|
)
|
dsw/config/keys.py
CHANGED
|
@@ -232,99 +232,30 @@ class _S3Keys(ConfigKeysContainer):
|
|
|
232
232
|
)
|
|
233
233
|
|
|
234
234
|
|
|
235
|
-
class
|
|
236
|
-
|
|
237
|
-
yaml_path=['
|
|
238
|
-
var_names=['
|
|
239
|
-
default=True,
|
|
240
|
-
cast=cast_bool,
|
|
241
|
-
)
|
|
242
|
-
name = ConfigKey(
|
|
243
|
-
yaml_path=['mail', 'name'],
|
|
244
|
-
var_names=['MAIL_NAME'],
|
|
245
|
-
default='',
|
|
246
|
-
cast=cast_str,
|
|
247
|
-
)
|
|
248
|
-
email = ConfigKey(
|
|
249
|
-
yaml_path=['mail', 'email'],
|
|
250
|
-
var_names=['MAIL_EMAIL'],
|
|
251
|
-
default='',
|
|
252
|
-
cast=cast_str,
|
|
253
|
-
)
|
|
254
|
-
host = ConfigKey(
|
|
255
|
-
yaml_path=['mail', 'host'],
|
|
256
|
-
var_names=['MAIL_HOST'],
|
|
257
|
-
default='',
|
|
258
|
-
cast=cast_str,
|
|
259
|
-
)
|
|
260
|
-
port = ConfigKey(
|
|
261
|
-
yaml_path=['mail', 'port'],
|
|
262
|
-
var_names=['MAIL_PORT'],
|
|
263
|
-
cast=cast_str,
|
|
264
|
-
)
|
|
265
|
-
ssl = ConfigKey(
|
|
266
|
-
yaml_path=['mail', 'ssl'],
|
|
267
|
-
var_names=[],
|
|
268
|
-
cast=cast_optional_str,
|
|
269
|
-
)
|
|
270
|
-
security = ConfigKey(
|
|
271
|
-
yaml_path=['mail', 'security'],
|
|
272
|
-
var_names=['MAIL_SECURITY'],
|
|
235
|
+
class _AWSKeys(ConfigKeysContainer):
|
|
236
|
+
access_key_id = ConfigKey(
|
|
237
|
+
yaml_path=['aws', 'awsAccessKeyId'],
|
|
238
|
+
var_names=['AWS_AWS_ACCESS_KEY_ID'],
|
|
273
239
|
cast=cast_optional_str,
|
|
274
240
|
)
|
|
275
|
-
|
|
276
|
-
yaml_path=['
|
|
277
|
-
var_names=[],
|
|
278
|
-
cast=cast_optional_bool,
|
|
279
|
-
)
|
|
280
|
-
username = ConfigKey(
|
|
281
|
-
yaml_path=['mail', 'username'],
|
|
282
|
-
var_names=['MAIL_USERNAME'],
|
|
241
|
+
secret_access_key = ConfigKey(
|
|
242
|
+
yaml_path=['aws', 'awsSecretAccessKey'],
|
|
243
|
+
var_names=['AWS_AWS_SECRET_ACCESS_KEY'],
|
|
283
244
|
cast=cast_optional_str,
|
|
284
245
|
)
|
|
285
|
-
|
|
286
|
-
yaml_path=['
|
|
287
|
-
var_names=['
|
|
288
|
-
cast=cast_optional_str,
|
|
289
|
-
)
|
|
290
|
-
rate_limit_window = ConfigKey(
|
|
291
|
-
yaml_path=['mail', 'rateLimit', 'window'],
|
|
292
|
-
var_names=['MAIL_RATE_LIMIT_WINDOW'],
|
|
293
|
-
default=0,
|
|
294
|
-
cast=cast_int,
|
|
295
|
-
)
|
|
296
|
-
rate_limit_count = ConfigKey(
|
|
297
|
-
yaml_path=['mail', 'rateLimit', 'count'],
|
|
298
|
-
var_names=['MAIL_RATE_LIMIT_COUNT'],
|
|
299
|
-
default=0,
|
|
300
|
-
cast=cast_int,
|
|
301
|
-
)
|
|
302
|
-
timeout = ConfigKey(
|
|
303
|
-
yaml_path=['mail', 'timeout'],
|
|
304
|
-
var_names=['MAIL_TIMEOUT'],
|
|
305
|
-
default=10,
|
|
306
|
-
cast=cast_int,
|
|
307
|
-
)
|
|
308
|
-
dkim_selector = ConfigKey(
|
|
309
|
-
yaml_path=['mail', 'dkim', 'selector'],
|
|
310
|
-
var_names=['MAIL_DKIM_SELECTOR'],
|
|
311
|
-
default=None,
|
|
312
|
-
cast=cast_optional_str,
|
|
313
|
-
)
|
|
314
|
-
dkim_privkey_file = ConfigKey(
|
|
315
|
-
yaml_path=['mail', 'dkim', 'privkey_file'],
|
|
316
|
-
var_names=['MAIL_DKIM_PRIVKEY_FILE'],
|
|
317
|
-
default=None,
|
|
246
|
+
region = ConfigKey(
|
|
247
|
+
yaml_path=['aws', 'awsRegion'],
|
|
248
|
+
var_names=['AWS_AWS_REGION'],
|
|
318
249
|
cast=cast_optional_str,
|
|
319
250
|
)
|
|
320
251
|
|
|
321
252
|
|
|
322
253
|
class ConfigKeys(ConfigKeysContainer):
|
|
254
|
+
aws = _AWSKeys
|
|
323
255
|
cloud = _CloudKeys
|
|
324
256
|
database = _DatabaseKeys
|
|
325
257
|
general = _GeneralKeys
|
|
326
258
|
logging = _LoggingKeys
|
|
327
|
-
mail = _MailKeys
|
|
328
259
|
s3 = _S3Keys
|
|
329
260
|
sentry = _SentryKeys
|
|
330
261
|
|
dsw/config/model.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import pathlib
|
|
2
1
|
from typing import Optional
|
|
3
2
|
|
|
4
3
|
from .logging import prepare_logging, LOG_FILTER
|
|
@@ -74,93 +73,20 @@ class LoggingConfig(ConfigModel):
|
|
|
74
73
|
LOG_FILTER.set_extra(key, value)
|
|
75
74
|
|
|
76
75
|
|
|
77
|
-
class
|
|
78
|
-
|
|
79
|
-
def __init__(self, multi_tenant: bool):
|
|
80
|
-
self.multi_tenant = multi_tenant
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
class MailConfig(ConfigModel):
|
|
84
|
-
|
|
85
|
-
def __init__(self, enabled: bool, ssl: Optional[bool], name: str, email: str,
|
|
86
|
-
host: str, port: Optional[int], security: Optional[str],
|
|
87
|
-
auth_enabled: Optional[bool], username: Optional[str],
|
|
88
|
-
password: Optional[str], rate_limit_window: int,
|
|
89
|
-
rate_limit_count: int, timeout: int,
|
|
90
|
-
dkim_selector: Optional[str] = None,
|
|
91
|
-
dkim_privkey_file: Optional[str] = None):
|
|
92
|
-
self.enabled = enabled
|
|
93
|
-
self.name = name
|
|
94
|
-
self.email = email
|
|
95
|
-
self.host = host
|
|
96
|
-
self.security = 'plain'
|
|
97
|
-
if security is not None:
|
|
98
|
-
self.security = security.lower()
|
|
99
|
-
elif ssl is not None:
|
|
100
|
-
self.security = 'ssl' if ssl else 'plain'
|
|
101
|
-
self.port = port or self._default_port()
|
|
102
|
-
self.auth = auth_enabled
|
|
103
|
-
if self.auth is None:
|
|
104
|
-
self.auth = username is not None and password is not None
|
|
105
|
-
self.username = username
|
|
106
|
-
self.password = password
|
|
107
|
-
self.rate_limit_window = rate_limit_window
|
|
108
|
-
self.rate_limit_count = rate_limit_count
|
|
109
|
-
self.timeout = timeout
|
|
110
|
-
self.dkim_selector = dkim_selector
|
|
111
|
-
self.dkim_privkey_file = dkim_privkey_file
|
|
112
|
-
self.dkim_privkey = b''
|
|
113
|
-
|
|
114
|
-
def load_dkim_privkey(self):
|
|
115
|
-
if self.dkim_privkey_file is not None:
|
|
116
|
-
self.dkim_privkey = pathlib.Path(self.dkim_privkey_file).read_bytes()
|
|
117
|
-
self.dkim_privkey = self.dkim_privkey.replace(b'\r\n', b'\n')
|
|
118
|
-
|
|
119
|
-
@property
|
|
120
|
-
def use_dkim(self):
|
|
121
|
-
return self.dkim_selector is not None and len(self.dkim_privkey) > 0
|
|
122
|
-
|
|
123
|
-
@property
|
|
124
|
-
def login_user(self) -> str:
|
|
125
|
-
return self.username or ''
|
|
126
|
-
|
|
127
|
-
@property
|
|
128
|
-
def login_password(self) -> str:
|
|
129
|
-
return self.password or ''
|
|
76
|
+
class AWSConfig(ConfigModel):
|
|
130
77
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
def is_ssl(self):
|
|
137
|
-
return self.security == 'ssl'
|
|
78
|
+
def __init__(self, access_key_id: Optional[str], secret_access_key: Optional[str],
|
|
79
|
+
region: Optional[str]):
|
|
80
|
+
self.access_key_id = access_key_id
|
|
81
|
+
self.secret_access_key = secret_access_key
|
|
82
|
+
self.region = region
|
|
138
83
|
|
|
139
84
|
@property
|
|
140
|
-
def
|
|
141
|
-
return self.
|
|
85
|
+
def has_credentials(self) -> bool:
|
|
86
|
+
return self.access_key_id is not None and self.secret_access_key is not None
|
|
142
87
|
|
|
143
|
-
def _default_port(self) -> int:
|
|
144
|
-
if self.is_plain:
|
|
145
|
-
return 25
|
|
146
|
-
if self.is_ssl:
|
|
147
|
-
return 465
|
|
148
|
-
return 587
|
|
149
88
|
|
|
150
|
-
|
|
151
|
-
return self.username is not None and self.password is not None
|
|
89
|
+
class CloudConfig(ConfigModel):
|
|
152
90
|
|
|
153
|
-
def
|
|
154
|
-
|
|
155
|
-
f'- enabled = {self.enabled}\n' \
|
|
156
|
-
f'- name = {self.name}\n' \
|
|
157
|
-
f'- email = {self.email}\n' \
|
|
158
|
-
f'- host = {self.host}\n' \
|
|
159
|
-
f'- port = {self.port}\n' \
|
|
160
|
-
f'- security = {self.security}\n' \
|
|
161
|
-
f'- auth = {self.auth}\n' \
|
|
162
|
-
f'- rate_limit_window = {self.rate_limit_window}\n' \
|
|
163
|
-
f'- rate_limit_count = {self.rate_limit_count}\n' \
|
|
164
|
-
f'- timeout = {self.timeout}\n' \
|
|
165
|
-
f'- dkim_selector = {self.dkim_selector}\n' \
|
|
166
|
-
f'- dkim_privkey_file = {self.dkim_privkey_file}\n'
|
|
91
|
+
def __init__(self, multi_tenant: bool):
|
|
92
|
+
self.multi_tenant = multi_tenant
|
dsw/config/parser.py
CHANGED
|
@@ -5,7 +5,7 @@ from typing import List, Any, IO
|
|
|
5
5
|
|
|
6
6
|
from .keys import ConfigKey, ConfigKeys
|
|
7
7
|
from .model import GeneralConfig, SentryConfig, S3Config, \
|
|
8
|
-
DatabaseConfig, LoggingConfig, CloudConfig,
|
|
8
|
+
DatabaseConfig, LoggingConfig, CloudConfig, AWSConfig
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class MissingConfigurationError(Exception):
|
|
@@ -129,21 +129,9 @@ class DSWConfigParser:
|
|
|
129
129
|
)
|
|
130
130
|
|
|
131
131
|
@property
|
|
132
|
-
def
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
host=self.get(self.keys.mail.host),
|
|
138
|
-
ssl=self.get(self.keys.mail.ssl),
|
|
139
|
-
port=self.get(self.keys.mail.port),
|
|
140
|
-
security=self.get(self.keys.mail.security),
|
|
141
|
-
auth_enabled=self.get(self.keys.mail.auth_enabled),
|
|
142
|
-
username=self.get(self.keys.mail.username),
|
|
143
|
-
password=self.get(self.keys.mail.password),
|
|
144
|
-
rate_limit_window=int(self.get(self.keys.mail.rate_limit_window)),
|
|
145
|
-
rate_limit_count=int(self.get(self.keys.mail.rate_limit_count)),
|
|
146
|
-
timeout=int(self.get(self.keys.mail.timeout)),
|
|
147
|
-
dkim_selector=self.get(self.keys.mail.dkim_selector),
|
|
148
|
-
dkim_privkey_file=self.get(self.keys.mail.dkim_privkey_file),
|
|
132
|
+
def aws(self) -> AWSConfig:
|
|
133
|
+
return AWSConfig(
|
|
134
|
+
access_key_id=self.get(self.keys.aws.access_key_id),
|
|
135
|
+
secret_access_key=self.get(self.keys.aws.secret_access_key),
|
|
136
|
+
region=self.get(self.keys.aws.region),
|
|
149
137
|
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
dsw/config/__init__.py,sha256=2tf8kQHwcEpoGwUoXyczIFzkAUi112973KTccusrDmM,123
|
|
2
|
+
dsw/config/build_info.py,sha256=AAn_mxtL2OVwd3STjRDa2JSNoLy4Qwe628qJv-Wd1t0,379
|
|
3
|
+
dsw/config/keys.py,sha256=6X62tAr4ysFpI-ZCHsH9-0Eg0oh9szyjHqJihEQrQTQ,6691
|
|
4
|
+
dsw/config/logging.py,sha256=vCpt349vmvO08SNbp0K6aU9BPt_78op0QxKflDYmg7Q,1484
|
|
5
|
+
dsw/config/model.py,sha256=wDD9PwBCSCzaXCE979nv1J5zJz8TRNRzB2uVXt-4e-U,2664
|
|
6
|
+
dsw/config/parser.py,sha256=NCuSrjJBqmjox1nUN9DjyLHN8w_dasPS2sWICJ9hrHY,4450
|
|
7
|
+
dsw/config/sentry.py,sha256=Em1d72DGhLmrM5nUIuOwkG_98cjX4NeiYbQluTjRisg,1181
|
|
8
|
+
dsw_config-4.9.0.dist-info/LICENSE,sha256=rDtJ4LdsXvf_euOpGD0Q86P78K4JyM5m4yfYz9wZ750,11346
|
|
9
|
+
dsw_config-4.9.0.dist-info/METADATA,sha256=nSbnhBfqyqdx-uqA_cCevKW-mPnscXF-Iem9CABAAqc,1795
|
|
10
|
+
dsw_config-4.9.0.dist-info/WHEEL,sha256=XRxW4r1PNiVhMpP4bT9oWtu3HyndxpJ84SkubFgzp_Y,109
|
|
11
|
+
dsw_config-4.9.0.dist-info/top_level.txt,sha256=7SfbsHFoJ_vlAgG6C-xzETETwYO71dBrGnod8uMFnjw,4
|
|
12
|
+
dsw_config-4.9.0.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
dsw/config/__init__.py,sha256=2tf8kQHwcEpoGwUoXyczIFzkAUi112973KTccusrDmM,123
|
|
2
|
-
dsw/config/build_info.py,sha256=8bcgwPtQm9MpJIvIFfuezfHhPVBeRwlrLSMsGpel_Xc,379
|
|
3
|
-
dsw/config/keys.py,sha256=mB2IttdnMdzihdQsnebh6X0cg1k6azpg2KJDrS1er0I,8472
|
|
4
|
-
dsw/config/logging.py,sha256=vCpt349vmvO08SNbp0K6aU9BPt_78op0QxKflDYmg7Q,1484
|
|
5
|
-
dsw/config/model.py,sha256=nNCzR9FghhrtkM0O9ZsEKV-TYoqn2k1iOpnJ4_VwGM8,5290
|
|
6
|
-
dsw/config/parser.py,sha256=IPJBssEn8sxxTsY-dmacJVQBoMsc8IH3HlxVa5WpaNc,5132
|
|
7
|
-
dsw/config/sentry.py,sha256=Em1d72DGhLmrM5nUIuOwkG_98cjX4NeiYbQluTjRisg,1181
|
|
8
|
-
dsw_config-4.8.1.dist-info/LICENSE,sha256=rDtJ4LdsXvf_euOpGD0Q86P78K4JyM5m4yfYz9wZ750,11346
|
|
9
|
-
dsw_config-4.8.1.dist-info/METADATA,sha256=49M5MVEWtPcGhQu5v7Fn1BhMwXcTNv2dJdONCUyfE4Y,1795
|
|
10
|
-
dsw_config-4.8.1.dist-info/WHEEL,sha256=0XQbNV6JE5ziJsWjIU8TRRv0N6SohNonLWgP86g5fiI,109
|
|
11
|
-
dsw_config-4.8.1.dist-info/top_level.txt,sha256=7SfbsHFoJ_vlAgG6C-xzETETwYO71dBrGnod8uMFnjw,4
|
|
12
|
-
dsw_config-4.8.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|