maleo-foundation 0.1.92__py3-none-any.whl → 0.1.94__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/service.py +13 -4
- maleo_foundation/utils/loaders/json.py +6 -2
- maleo_foundation/utils/loaders/yaml.py +6 -2
- {maleo_foundation-0.1.92.dist-info → maleo_foundation-0.1.94.dist-info}/METADATA +1 -1
- {maleo_foundation-0.1.92.dist-info → maleo_foundation-0.1.94.dist-info}/RECORD +7 -7
- {maleo_foundation-0.1.92.dist-info → maleo_foundation-0.1.94.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.1.92.dist-info → maleo_foundation-0.1.94.dist-info}/top_level.txt +0 -0
@@ -177,21 +177,30 @@ class ServiceManager:
|
|
177
177
|
return self._maleo_credentials
|
178
178
|
|
179
179
|
def _load_configs(self) -> None:
|
180
|
+
#* Load static configurations
|
180
181
|
static_configurations_path = Path(self._settings.STATIC_CONFIGURATIONS_PATH)
|
181
182
|
if static_configurations_path.exists() and static_configurations_path.is_file():
|
182
|
-
static_configurations = YAMLLoader.
|
183
|
+
static_configurations = YAMLLoader.load_from_path(self._settings.STATIC_CONFIGURATIONS_PATH)
|
183
184
|
else:
|
184
|
-
|
185
|
+
data = self._secret_manager.get(f"maleo-static-config-{self._settings.ENVIRONMENT}")
|
186
|
+
static_configurations = YAMLLoader.load_from_string(data)
|
185
187
|
static_configs = StaticConfigurations.model_validate(static_configurations)
|
188
|
+
|
189
|
+
#* Load runtime configurations
|
186
190
|
runtime_configurations_path = Path(self._settings.RUNTIME_CONFIGURATIONS_PATH)
|
187
191
|
if runtime_configurations_path.exists() and runtime_configurations_path.is_file():
|
188
|
-
runtime_configurations = YAMLLoader.
|
192
|
+
runtime_configurations = YAMLLoader.load_from_path(self._settings.RUNTIME_CONFIGURATIONS_PATH)
|
189
193
|
else:
|
190
|
-
|
194
|
+
data = self._secret_manager.get(f"{self._settings.SERVICE_KEY}-runtime-config-{self._settings.ENVIRONMENT}")
|
195
|
+
runtime_configurations = YAMLLoader.load_from_string(data)
|
191
196
|
runtime_configs = RuntimeConfigurations.model_validate(runtime_configurations)
|
197
|
+
|
198
|
+
#* Load database configurations
|
192
199
|
password = self._secret_manager.get(name=f"maleo-db-password-{self._settings.ENVIRONMENT}")
|
193
200
|
host = self._secret_manager.get(name=f"maleo-db-host-{self._settings.ENVIRONMENT}")
|
194
201
|
database = DatabaseConfigurations(password=password, host=host, database=runtime_configs.database)
|
202
|
+
|
203
|
+
#* Load whole configurations
|
195
204
|
merged_configs = BaseMergers.deep_merge(static_configs.model_dump(), runtime_configs.model_dump(exclude={"database"}), {"database": database.model_dump()})
|
196
205
|
self._configs = Configurations.model_validate(merged_configs)
|
197
206
|
|
@@ -4,11 +4,15 @@ from pathlib import Path
|
|
4
4
|
|
5
5
|
class JSONLoader:
|
6
6
|
@staticmethod
|
7
|
-
def
|
7
|
+
def load_from_path(path:Union[Path, str]) -> Union[Dict[str, Any], List[Any]]:
|
8
8
|
file_path = Path(path)
|
9
9
|
|
10
10
|
if not file_path.is_file():
|
11
11
|
raise FileNotFoundError(f"File not found: {file_path}")
|
12
12
|
|
13
13
|
with open(file_path, 'r') as f:
|
14
|
-
return json.load(f)
|
14
|
+
return json.load(f)
|
15
|
+
|
16
|
+
@staticmethod
|
17
|
+
def load_from_string(string:str) -> Dict:
|
18
|
+
return json.loads(string)
|
@@ -4,11 +4,15 @@ from typing import Dict, Union
|
|
4
4
|
|
5
5
|
class YAMLLoader:
|
6
6
|
@staticmethod
|
7
|
-
def
|
7
|
+
def load_from_path(path:Union[Path, str]) -> Dict:
|
8
8
|
file_path = Path(path)
|
9
9
|
|
10
10
|
if not file_path.exists() or not file_path.is_file():
|
11
11
|
raise FileNotFoundError(f"File not found: {file_path}")
|
12
12
|
|
13
13
|
with file_path.open("r") as f:
|
14
|
-
return yaml.safe_load(f)
|
14
|
+
return yaml.safe_load(f)
|
15
|
+
|
16
|
+
@staticmethod
|
17
|
+
def load_from_string(string:str) -> Dict:
|
18
|
+
return yaml.safe_load(string)
|
@@ -32,7 +32,7 @@ maleo_foundation/expanded_types/encryption/rsa.py,sha256=MuhB_DGrjnsl4t96W4pKuCt
|
|
32
32
|
maleo_foundation/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
33
|
maleo_foundation/managers/db.py,sha256=Pn5EZ-c1Hy6-BihN7KokHJWmBIt3Ty96fZ0zF-srtF4,5208
|
34
34
|
maleo_foundation/managers/middleware.py,sha256=ODIQU1Hpu-Xempjjo_VRbVtxiD5oi74mNuoWuDawRh0,4250
|
35
|
-
maleo_foundation/managers/service.py,sha256=
|
35
|
+
maleo_foundation/managers/service.py,sha256=uw9ec4nI1r3ehYZaRSvWSQx8KCc515UFGkGyDbe0hx4,15702
|
36
36
|
maleo_foundation/managers/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
maleo_foundation/managers/client/base.py,sha256=5z9l2GN4QASF0-Lft8o5QQ3SRPXqeNZNT1S1CgaE764,4384
|
38
38
|
maleo_foundation/managers/client/maleo.py,sha256=iCM47TLL-RSQ2FkTmHVPdsb2JCd1LebMx6OJvIr4vCQ,2035
|
@@ -101,13 +101,13 @@ maleo_foundation/utils/query.py,sha256=ODQ3adOYQNj5E2cRW9ytbjBz56nEDcnfq8mQ6YZbC
|
|
101
101
|
maleo_foundation/utils/formatter/__init__.py,sha256=iKf5YCbEdg1qKnFHyKqqcQbqAqEeRUf8mhI3v3dQoj8,78
|
102
102
|
maleo_foundation/utils/formatter/case.py,sha256=TmvvlfzGdC_omMTB5vAa40TZBxQ3hnr-SYeo0M52Rlg,1352
|
103
103
|
maleo_foundation/utils/loaders/__init__.py,sha256=P_3ycGfeDXFjAi8bE4iLWHxBveqUIdpHgGv-klRWM3s,282
|
104
|
-
maleo_foundation/utils/loaders/json.py,sha256=
|
105
|
-
maleo_foundation/utils/loaders/yaml.py,sha256=
|
104
|
+
maleo_foundation/utils/loaders/json.py,sha256=8e3qe1TyL-jaJVuiQJpVHKDBS2n_CGJPGv8Ci6cK42Y,506
|
105
|
+
maleo_foundation/utils/loaders/yaml.py,sha256=8cZWOYuDTAFNrLsUlz7IGyOrtR4oL-tk-jc7q_7nq8Q,501
|
106
106
|
maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg7rejnG4I684FjUwh70tvhtVM,141
|
107
107
|
maleo_foundation/utils/loaders/credential/google.py,sha256=deksZXT5wPhEsSMHbZ3x05WHXxCjLDt76Ns-1Tmhp7g,948
|
108
108
|
maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
|
109
109
|
maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
|
110
|
-
maleo_foundation-0.1.
|
111
|
-
maleo_foundation-0.1.
|
112
|
-
maleo_foundation-0.1.
|
113
|
-
maleo_foundation-0.1.
|
110
|
+
maleo_foundation-0.1.94.dist-info/METADATA,sha256=pluqhekNm5UlR_v9rZBzlv90rRCCGp__eNWSz8ph3Lk,3419
|
111
|
+
maleo_foundation-0.1.94.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
112
|
+
maleo_foundation-0.1.94.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
113
|
+
maleo_foundation-0.1.94.dist-info/RECORD,,
|
File without changes
|
File without changes
|