maleo-foundation 0.3.10__py3-none-any.whl → 0.3.11__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.
- maleo_foundation/managers/configuration.py +42 -32
- maleo_foundation/managers/credential.py +1 -1
- maleo_foundation/types.py +4 -0
- {maleo_foundation-0.3.10.dist-info → maleo_foundation-0.3.11.dist-info}/METADATA +1 -1
- {maleo_foundation-0.3.10.dist-info → maleo_foundation-0.3.11.dist-info}/RECORD +7 -7
- {maleo_foundation-0.3.10.dist-info → maleo_foundation-0.3.11.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.3.10.dist-info → maleo_foundation-0.3.11.dist-info}/top_level.txt +0 -0
@@ -5,8 +5,6 @@ from maleo_foundation.models.transfers.general.configurations.cache.redis import
|
|
5
5
|
)
|
6
6
|
from maleo_foundation.models.transfers.general.configurations.cache \
|
7
7
|
import CacheConfigurations
|
8
|
-
from maleo_foundation.models.transfers.general.configurations.database \
|
9
|
-
import DatabaseConfigurations
|
10
8
|
from maleo_foundation.models.transfers.general.configurations import (
|
11
9
|
RuntimeConfigurations,
|
12
10
|
StaticConfigurations,
|
@@ -23,44 +21,56 @@ class ConfigurationManager:
|
|
23
21
|
settings: Settings,
|
24
22
|
credential_manager: CredentialManager
|
25
23
|
):
|
26
|
-
self.
|
27
|
-
self.
|
24
|
+
self._settings = settings
|
25
|
+
self._credential_manager = credential_manager
|
28
26
|
|
29
27
|
self._load_configurations()
|
30
28
|
|
31
29
|
def _load_static_configurations(self) -> StaticConfigurations:
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
30
|
+
use_local = self._settings.USE_LOCAL_STATIC_CONFIGURATIONS
|
31
|
+
config_path = self._settings.STATIC_CONFIGURATIONS_PATH
|
32
|
+
|
33
|
+
if use_local and config_path is not None and isinstance(config_path, str):
|
34
|
+
config_path = Path(config_path)
|
35
|
+
if config_path.exists() and config_path.is_file():
|
36
|
+
data = YAMLLoader.load_from_path(config_path)
|
37
|
+
return StaticConfigurations.model_validate(data)
|
38
|
+
|
39
|
+
secret_data = (
|
40
|
+
self
|
41
|
+
._credential_manager
|
42
|
+
.secret_manager
|
43
|
+
.get(f"maleo-static-configurations-{self._settings.ENVIRONMENT}")
|
44
|
+
)
|
45
|
+
data = YAMLLoader.load_from_string(secret_data)
|
42
46
|
return StaticConfigurations.model_validate(data)
|
43
|
-
|
47
|
+
|
44
48
|
def _load_runtime_configurations(self) -> RuntimeConfigurations:
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
use_local = self._settings.USE_LOCAL_STATIC_CONFIGURATIONS
|
50
|
+
config_path = self._settings.RUNTIME_CONFIGURATIONS_PATH
|
51
|
+
|
52
|
+
if use_local and config_path is not None and isinstance(config_path, str):
|
53
|
+
config_path = Path(config_path)
|
54
|
+
if config_path.exists() and config_path.is_file():
|
55
|
+
data = YAMLLoader.load_from_path(config_path)
|
56
|
+
return RuntimeConfigurations.model_validate(data)
|
57
|
+
|
58
|
+
secret_data = (
|
59
|
+
self
|
60
|
+
._credential_manager
|
61
|
+
.secret_manager
|
62
|
+
.get(f"{self._settings.SERVICE_KEY}-runtime-configurations-{self._settings.ENVIRONMENT}")
|
63
|
+
)
|
64
|
+
data = YAMLLoader.load_from_string(secret_data)
|
55
65
|
return RuntimeConfigurations.model_validate(data)
|
56
|
-
|
66
|
+
|
57
67
|
def _load_cache_configurations(self) -> CacheConfigurations:
|
58
|
-
namespaces = RedisCacheNamespaces(base=self.
|
59
|
-
host = self.
|
60
|
-
f"maleo-redis-host-{self.
|
68
|
+
namespaces = RedisCacheNamespaces(base=self._settings.SERVICE_KEY)
|
69
|
+
host = self._credential_manager.secret_manager.get(
|
70
|
+
f"maleo-redis-host-{self._settings.ENVIRONMENT}"
|
61
71
|
)
|
62
|
-
password = self.
|
63
|
-
f"maleo-redis-password-{self.
|
72
|
+
password = self._credential_manager.secret_manager.get(
|
73
|
+
f"maleo-redis-password-{self._settings.ENVIRONMENT}"
|
64
74
|
)
|
65
75
|
redis = RedisCacheConfigurations(
|
66
76
|
namespaces=namespaces,
|
@@ -79,7 +89,7 @@ class ConfigurationManager:
|
|
79
89
|
runtime_configurations.model_dump(),
|
80
90
|
{"cache": cache_configurations.model_dump()}
|
81
91
|
)
|
82
|
-
|
92
|
+
|
83
93
|
self._configurations = Configurations.model_validate(merged_configurations)
|
84
94
|
|
85
95
|
@property
|
@@ -46,7 +46,7 @@ class CredentialManager:
|
|
46
46
|
|
47
47
|
def _load_maleo_credentials(self) -> None:
|
48
48
|
environment = self._get_environment_for_credentials()
|
49
|
-
|
49
|
+
|
50
50
|
try:
|
51
51
|
id = int(self._secret_manager.get(f"maleo-service-account-id-{environment}"))
|
52
52
|
uuid = UUID(self._secret_manager.get(f"maleo-service-account-uuid-{environment}"))
|
maleo_foundation/types.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
from datetime import date, datetime
|
2
|
+
from pathlib import Path
|
2
3
|
from typing import Dict, Optional, Union, Literal, List, Any
|
3
4
|
from uuid import UUID
|
4
5
|
from maleo_foundation.enums import BaseEnums
|
@@ -24,6 +25,9 @@ class BaseTypes:
|
|
24
25
|
OptionalInteger = Optional[int]
|
25
26
|
OptionalListOfIntegers = Optional[List[int]]
|
26
27
|
|
28
|
+
#* Path-related types
|
29
|
+
OptionalPath = Optional[Path]
|
30
|
+
|
27
31
|
#* String-related types
|
28
32
|
ListOfStrings = List[str]
|
29
33
|
OptionalString = Optional[str]
|
@@ -5,7 +5,7 @@ maleo_foundation/constants.py,sha256=LjMIy_Fcr6HLuhIuXs5lCtkyScZXXHOtBMPYx5lwg00
|
|
5
5
|
maleo_foundation/enums.py,sha256=08rkuG3Y4-8kvd5BOBhhIS0UhzBT4kAPQX4L95GqnWQ,5316
|
6
6
|
maleo_foundation/extended_types.py,sha256=pIKt-_9tby4rmune3fmWcCW_mohaNRh_1lywBmdc-L4,301
|
7
7
|
maleo_foundation/rest_controller_result.py,sha256=4KbCmk70IEHj1L1bNJfFg1Y3ifnRSnmvK6dYyVJddok,2014
|
8
|
-
maleo_foundation/types.py,sha256=
|
8
|
+
maleo_foundation/types.py,sha256=VFdnBuEh5QW_ytaZ4sNBqb6XxALU5g0RtzP0fR4svNY,2537
|
9
9
|
maleo_foundation/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
maleo_foundation/client/manager.py,sha256=zI6LCRQmBynK3LYU8tfd9RXE2QIzaOTzl12B24tpAxw,2720
|
11
11
|
maleo_foundation/client/services/__init__.py,sha256=uIBnAeQ9a2otQbUAbKBQfYrkEUugXjxXoV8W5QYHuic,1051
|
@@ -33,8 +33,8 @@ maleo_foundation/expanded_types/encryption/aes.py,sha256=1rj43qjIO0TePpr1mErT_NJ
|
|
33
33
|
maleo_foundation/expanded_types/encryption/rsa.py,sha256=Esf_H8nMz2kOLAWa3M7dlD-sFdFIZylNjB_qB20Yaww,488
|
34
34
|
maleo_foundation/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
35
|
maleo_foundation/managers/cache.py,sha256=91IvQGCXC3QkhB61m6qLDMaRykmMYOwzMgrSOodfY1A,257
|
36
|
-
maleo_foundation/managers/configuration.py,sha256=
|
37
|
-
maleo_foundation/managers/credential.py,sha256=
|
36
|
+
maleo_foundation/managers/configuration.py,sha256=IyefI1GDDRYf5FRjxpJ2LfYiRL1fuzIOwrO1aAy5zy0,3814
|
37
|
+
maleo_foundation/managers/credential.py,sha256=i1w9bVozf7FYG8NGfLgJYRdLWBQBf35yyzVOEDgdXSA,3108
|
38
38
|
maleo_foundation/managers/db.py,sha256=y5oP3bTXKeXYKqng-E_HZ-3wC0ZPtl5bls0AEEej6zM,6050
|
39
39
|
maleo_foundation/managers/middleware.py,sha256=ecTNloglV67xoC_hqIEMIxhfQwzXRKHLI3ThJdd-lbY,2480
|
40
40
|
maleo_foundation/managers/service.py,sha256=1rqxXMJ9E-pla0LuhKZ83JS4boTnUhiXxn1EbzYQlWA,10859
|
@@ -134,7 +134,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg
|
|
134
134
|
maleo_foundation/utils/loaders/credential/google.py,sha256=vmVObdAyXehb3L6ASOuUJ63mNvGPb9fiXSpdRndN-4A,6528
|
135
135
|
maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
|
136
136
|
maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
|
137
|
-
maleo_foundation-0.3.
|
138
|
-
maleo_foundation-0.3.
|
139
|
-
maleo_foundation-0.3.
|
140
|
-
maleo_foundation-0.3.
|
137
|
+
maleo_foundation-0.3.11.dist-info/METADATA,sha256=0efeufEkkOaSp-OM15QCtvvQqXLVX_iqbyueWEBM-og,3740
|
138
|
+
maleo_foundation-0.3.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
139
|
+
maleo_foundation-0.3.11.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
140
|
+
maleo_foundation-0.3.11.dist-info/RECORD,,
|
File without changes
|
File without changes
|