maleo-foundation 0.1.37__tar.gz → 0.1.38__tar.gz
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-0.1.37 → maleo_foundation-0.1.38}/PKG-INFO +1 -1
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/service.py +13 -13
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/utils/__init__.py +2 -2
- maleo_foundation-0.1.38/maleo_foundation/utils/loaders/__init__.py +9 -0
- maleo_foundation-0.1.38/maleo_foundation/utils/loaders/json.py +14 -0
- maleo_foundation-0.1.37/maleo_foundation/utils/keyloader.py → maleo_foundation-0.1.38/maleo_foundation/utils/loaders/key.py +5 -5
- maleo_foundation-0.1.38/maleo_foundation/utils/loaders/yaml.py +14 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation.egg-info/PKG-INFO +1 -1
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation.egg-info/SOURCES.txt +5 -2
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/pyproject.toml +1 -1
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/README.md +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/authentication.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/constants.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/enums.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/expanded_types/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/expanded_types/client.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/expanded_types/general.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/expanded_types/query.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/expanded_types/service.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/expanded_types/token.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/extended_types.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/client/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/client/base.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/client/google/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/client/google/base.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/client/google/secret.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/client/google/storage.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/client/maleo.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/db.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/middleware.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/middlewares/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/middlewares/authentication.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/middlewares/base.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/middlewares/cors.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/responses.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/schemas/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/schemas/general.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/schemas/parameter.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/schemas/result.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/schemas/token.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/table.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/general/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/general/token.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/parameters/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/parameters/client.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/parameters/general.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/parameters/service.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/parameters/token.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/results/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/results/client/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/results/client/controllers/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/results/client/controllers/http.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/results/client/service.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/results/service/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/results/service/controllers/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/results/service/controllers/rest.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/results/service/general.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/results/service/query.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/results/token.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/services/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/services/token.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/types.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/utils/controller.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/utils/exceptions.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/utils/extractor.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/utils/formatter/__init__.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/utils/formatter/case.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/utils/logging.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/utils/query.py +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation.egg-info/dependency_links.txt +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation.egg-info/requires.txt +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation.egg-info/top_level.txt +0 -0
- {maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/setup.cfg +0 -0
@@ -20,7 +20,8 @@ from maleo_foundation.middlewares.base import RequestProcessor
|
|
20
20
|
from maleo_foundation.services.token import BaseTokenService
|
21
21
|
from maleo_foundation.types import BaseTypes
|
22
22
|
from maleo_foundation.utils.exceptions import BaseExceptions
|
23
|
-
from maleo_foundation.utils.
|
23
|
+
from maleo_foundation.utils.loaders.json import JSONLoader
|
24
|
+
from maleo_foundation.utils.loaders.key import KeyLoader
|
24
25
|
from maleo_foundation.utils.logging import GoogleCloudLogging, ServiceLogger, MiddlewareLogger
|
25
26
|
|
26
27
|
class LogConfig(BaseModel):
|
@@ -38,6 +39,7 @@ class Settings(BaseSettings):
|
|
38
39
|
PUBLIC_KEY_PATH:str = Field("/keys/maleo-public-key.pem", description="Maleo's public key path")
|
39
40
|
KEY_PASSWORD:str = Field(..., description="Maleo key's password")
|
40
41
|
CONFIGURATIONS_PATH:str = Field(..., description="Service's configuration file path")
|
42
|
+
DB_PASSWORD:str = Field(..., description="Database's password")
|
41
43
|
|
42
44
|
class Keys(BaseModel):
|
43
45
|
password:str = Field(..., description="Key's password")
|
@@ -78,7 +80,8 @@ class ServiceConfigurations(BaseModel):
|
|
78
80
|
|
79
81
|
class DatabaseConfigurations(BaseModel):
|
80
82
|
username:str = Field("postgres", description="Database user's username")
|
81
|
-
|
83
|
+
password_env:str = Field("DB_PASSWORD", description="Database user's password .env")
|
84
|
+
password:str = Field(os.getenv(password_env), description="Database user's password")
|
82
85
|
host:str = Field(..., description="Database's host")
|
83
86
|
port:int = Field(5432, description="Database's port")
|
84
87
|
database:str = Field(..., description="Database")
|
@@ -254,9 +257,8 @@ class ServiceManager:
|
|
254
257
|
return self._settings
|
255
258
|
|
256
259
|
def _load_configs(self) -> None:
|
257
|
-
|
258
|
-
|
259
|
-
self._configs = Configurations.model_validate(data)
|
260
|
+
data = JSONLoader.load(self._settings.CONFIGURATIONS_PATH)
|
261
|
+
self._configs = Configurations.model_validate(data)
|
260
262
|
|
261
263
|
@property
|
262
264
|
def configs(self) -> Configurations:
|
@@ -278,13 +280,11 @@ class ServiceManager:
|
|
278
280
|
|
279
281
|
def _load_credentials(self) -> None:
|
280
282
|
#* Load google credentials
|
281
|
-
|
282
|
-
|
283
|
-
google = GoogleCredentials.model_validate(data)
|
283
|
+
data = JSONLoader.load(self._settings.GOOGLE_CREDENTIALS_PATH)
|
284
|
+
google = GoogleCredentials.model_validate(data)
|
284
285
|
#* Load internal credentials
|
285
|
-
|
286
|
-
|
287
|
-
internal = InternalCredentials.model_validate(data)
|
286
|
+
data = JSONLoader.load(self._settings.INTERNAL_CREDENTIALS_PATH)
|
287
|
+
internal = InternalCredentials.model_validate(data)
|
288
288
|
self._credentials = Credentials(google=google, internal=internal)
|
289
289
|
|
290
290
|
@property
|
@@ -294,14 +294,14 @@ class ServiceManager:
|
|
294
294
|
def _parse_keys(self) -> None:
|
295
295
|
#* Parse private key
|
296
296
|
key_type = BaseEnums.KeyType.PRIVATE
|
297
|
-
private =
|
297
|
+
private = KeyLoader.load_rsa(
|
298
298
|
type=key_type,
|
299
299
|
path=self._settings.PRIVATE_KEY_PATH,
|
300
300
|
password=self._settings.KEY_PASSWORD
|
301
301
|
)
|
302
302
|
#* Parse public key
|
303
303
|
key_type = BaseEnums.KeyType.PUBLIC
|
304
|
-
public =
|
304
|
+
public = KeyLoader.load_rsa(
|
305
305
|
type=key_type,
|
306
306
|
path=self._settings.PUBLIC_KEY_PATH
|
307
307
|
)
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
2
2
|
from .formatter import BaseFormatter
|
3
3
|
from .exceptions import BaseExceptions
|
4
4
|
from .extractor import BaseExtractors
|
5
|
-
from .
|
5
|
+
from .loaders import BaseLoaders
|
6
6
|
from .controller import BaseControllerUtils
|
7
7
|
from .query import BaseQueryUtils
|
8
8
|
|
@@ -10,6 +10,6 @@ class BaseUtils:
|
|
10
10
|
Formatter = BaseFormatter
|
11
11
|
Exceptions = BaseExceptions
|
12
12
|
Extractors = BaseExtractors
|
13
|
-
|
13
|
+
Loaders = BaseLoaders
|
14
14
|
Controller = BaseControllerUtils
|
15
15
|
Query = BaseQueryUtils
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import json
|
2
|
+
from typing import Dict, List, Union, Any
|
3
|
+
from pathlib import Path
|
4
|
+
|
5
|
+
class JSONLoader:
|
6
|
+
@staticmethod
|
7
|
+
def load(path:Union[Path, str]) -> Union[Dict[str, Any], List[Any]]:
|
8
|
+
file_path = Path(path)
|
9
|
+
|
10
|
+
if not file_path.is_file():
|
11
|
+
raise FileNotFoundError(f"File not found: {file_path}")
|
12
|
+
|
13
|
+
with open(file_path, 'r') as f:
|
14
|
+
return json.load(f)
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import pathlib
|
2
1
|
from cryptography.hazmat.primitives import serialization
|
2
|
+
from pathlib import Path
|
3
3
|
from typing import Optional, Union
|
4
4
|
from maleo_foundation.enums import BaseEnums
|
5
5
|
|
6
|
-
class
|
6
|
+
class KeyLoader:
|
7
7
|
@staticmethod
|
8
8
|
def load_rsa(
|
9
9
|
type:BaseEnums.KeyType,
|
10
|
-
path: Union[str,
|
10
|
+
path: Union[str, Path],
|
11
11
|
password:Optional[Union[str, bytes]] = None,
|
12
12
|
format:BaseEnums.KeyFormatType = BaseEnums.KeyFormatType.STRING,
|
13
13
|
) -> Union[bytes, str]:
|
@@ -15,7 +15,7 @@ class BaseKeyLoaders:
|
|
15
15
|
Load an RSA private or public key strictly from a file.
|
16
16
|
|
17
17
|
Args:
|
18
|
-
path (str |
|
18
|
+
path (str | Path): Path to the PEM file.
|
19
19
|
password (str | bytes | None): Password for encrypted private keys (optional).
|
20
20
|
|
21
21
|
Returns:
|
@@ -24,7 +24,7 @@ class BaseKeyLoaders:
|
|
24
24
|
if not isinstance(type, BaseEnums.KeyType):
|
25
25
|
raise TypeError("Invalid key type")
|
26
26
|
|
27
|
-
file_path =
|
27
|
+
file_path = Path(path)
|
28
28
|
|
29
29
|
if not file_path.is_file():
|
30
30
|
raise FileNotFoundError(f"Key file not found: {file_path}")
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import yaml
|
2
|
+
from pathlib import Path
|
3
|
+
from typing import Dict, Union
|
4
|
+
|
5
|
+
class YAMLLoader:
|
6
|
+
@staticmethod
|
7
|
+
def load(path:Union[Path, str]) -> Dict:
|
8
|
+
file_path = Path(path)
|
9
|
+
|
10
|
+
if not file_path.is_file():
|
11
|
+
raise FileNotFoundError(f"File not found: {file_path}")
|
12
|
+
|
13
|
+
with file_path.open("r") as f:
|
14
|
+
return yaml.safe_load(f)
|
@@ -65,8 +65,11 @@ maleo_foundation/utils/__init__.py
|
|
65
65
|
maleo_foundation/utils/controller.py
|
66
66
|
maleo_foundation/utils/exceptions.py
|
67
67
|
maleo_foundation/utils/extractor.py
|
68
|
-
maleo_foundation/utils/keyloader.py
|
69
68
|
maleo_foundation/utils/logging.py
|
70
69
|
maleo_foundation/utils/query.py
|
71
70
|
maleo_foundation/utils/formatter/__init__.py
|
72
|
-
maleo_foundation/utils/formatter/case.py
|
71
|
+
maleo_foundation/utils/formatter/case.py
|
72
|
+
maleo_foundation/utils/loaders/__init__.py
|
73
|
+
maleo_foundation/utils/loaders/json.py
|
74
|
+
maleo_foundation/utils/loaders/key.py
|
75
|
+
maleo_foundation/utils/loaders/yaml.py
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/expanded_types/__init__.py
RENAMED
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/expanded_types/client.py
RENAMED
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/expanded_types/general.py
RENAMED
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/expanded_types/query.py
RENAMED
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/expanded_types/service.py
RENAMED
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/expanded_types/token.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/client/__init__.py
RENAMED
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/client/base.py
RENAMED
File without changes
|
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/client/google/base.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/managers/client/maleo.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/middlewares/__init__.py
RENAMED
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/middlewares/authentication.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/schemas/__init__.py
RENAMED
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/schemas/general.py
RENAMED
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/schemas/parameter.py
RENAMED
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/schemas/result.py
RENAMED
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/schemas/token.py
RENAMED
File without changes
|
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/models/transfers/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/utils/formatter/__init__.py
RENAMED
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation/utils/formatter/case.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{maleo_foundation-0.1.37 → maleo_foundation-0.1.38}/maleo_foundation.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|