maleo-foundation 0.3.25__tar.gz → 0.3.29__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.
Files changed (147) hide show
  1. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/PKG-INFO +1 -1
  2. maleo_foundation-0.3.29/maleo_foundation/managers/configuration.py +37 -0
  3. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/configurations/__init__.py +4 -21
  4. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/configurations/client/__init__.py +1 -1
  5. maleo_foundation-0.3.29/maleo_foundation/models/transfers/general/configurations/client/maleo.py +23 -0
  6. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/configurations/middleware.py +1 -12
  7. maleo_foundation-0.3.29/maleo_foundation/models/transfers/general/settings.py +46 -0
  8. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation.egg-info/PKG-INFO +1 -1
  9. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/pyproject.toml +1 -1
  10. maleo_foundation-0.3.25/maleo_foundation/managers/configuration.py +0 -97
  11. maleo_foundation-0.3.25/maleo_foundation/models/transfers/general/configurations/client/maleo.py +0 -22
  12. maleo_foundation-0.3.25/maleo_foundation/models/transfers/general/settings.py +0 -62
  13. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/README.md +0 -0
  14. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/__init__.py +0 -0
  15. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/authentication.py +0 -0
  16. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/authorization.py +0 -0
  17. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/__init__.py +0 -0
  18. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/manager.py +0 -0
  19. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/services/__init__.py +0 -0
  20. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/services/encryption/__init__.py +0 -0
  21. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/services/encryption/aes.py +0 -0
  22. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/services/encryption/rsa.py +0 -0
  23. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/services/hash/__init__.py +0 -0
  24. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/services/hash/bcrypt.py +0 -0
  25. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/services/hash/hmac.py +0 -0
  26. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/services/hash/sha256.py +0 -0
  27. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/services/key.py +0 -0
  28. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/services/signature.py +0 -0
  29. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/client/services/token.py +0 -0
  30. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/constants.py +0 -0
  31. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/enums.py +0 -0
  32. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/expanded_types/__init__.py +0 -0
  33. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/expanded_types/client.py +0 -0
  34. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/expanded_types/encryption/__init__.py +0 -0
  35. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/expanded_types/encryption/aes.py +0 -0
  36. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/expanded_types/encryption/rsa.py +0 -0
  37. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/expanded_types/general.py +0 -0
  38. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/expanded_types/hash.py +0 -0
  39. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/expanded_types/key.py +0 -0
  40. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/expanded_types/repository.py +0 -0
  41. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/expanded_types/service.py +0 -0
  42. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/expanded_types/signature.py +0 -0
  43. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/expanded_types/token.py +0 -0
  44. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/extended_types.py +0 -0
  45. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/__init__.py +0 -0
  46. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/cache.py +0 -0
  47. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/client/__init__.py +0 -0
  48. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/client/base.py +0 -0
  49. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/client/google/__init__.py +0 -0
  50. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/client/google/base.py +0 -0
  51. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/client/google/parameter.py +0 -0
  52. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/client/google/secret.py +0 -0
  53. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/client/google/storage.py +0 -0
  54. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/client/google/subscription.py +0 -0
  55. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/client/maleo.py +0 -0
  56. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/credential.py +0 -0
  57. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/db.py +0 -0
  58. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/middleware.py +0 -0
  59. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/managers/service.py +0 -0
  60. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/middlewares/authentication.py +0 -0
  61. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/middlewares/base.py +0 -0
  62. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/middlewares/cors.py +0 -0
  63. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/__init__.py +0 -0
  64. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/responses.py +0 -0
  65. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/schemas/__init__.py +0 -0
  66. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/schemas/encryption.py +0 -0
  67. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/schemas/general.py +0 -0
  68. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/schemas/hash.py +0 -0
  69. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/schemas/key.py +0 -0
  70. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/schemas/parameter.py +0 -0
  71. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/schemas/result.py +0 -0
  72. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/schemas/signature.py +0 -0
  73. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/schemas/token.py +0 -0
  74. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/table.py +0 -0
  75. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/__init__.py +0 -0
  76. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/__init__.py +0 -0
  77. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/configurations/cache/__init__.py +0 -0
  78. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/configurations/cache/redis.py +0 -0
  79. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/configurations/database.py +0 -0
  80. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/configurations/service.py +0 -0
  81. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/credentials.py +0 -0
  82. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/database.py +0 -0
  83. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/key.py +0 -0
  84. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/request.py +0 -0
  85. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/signature.py +0 -0
  86. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/general/token.py +0 -0
  87. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/__init__.py +0 -0
  88. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/client.py +0 -0
  89. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/encryption/__init__.py +0 -0
  90. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/encryption/aes.py +0 -0
  91. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/encryption/rsa.py +0 -0
  92. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/general.py +0 -0
  93. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/hash/__init__.py +0 -0
  94. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/hash/bcrypt.py +0 -0
  95. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/hash/hmac.py +0 -0
  96. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/hash/sha256.py +0 -0
  97. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/key.py +0 -0
  98. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/service.py +0 -0
  99. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/signature.py +0 -0
  100. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/parameters/token.py +0 -0
  101. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/__init__.py +0 -0
  102. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/client/__init__.py +0 -0
  103. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/client/controllers/__init__.py +0 -0
  104. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/client/controllers/http.py +0 -0
  105. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/client/service.py +0 -0
  106. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/encryption/__init__.py +0 -0
  107. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/encryption/aes.py +0 -0
  108. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/encryption/rsa.py +0 -0
  109. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/hash.py +0 -0
  110. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/key.py +0 -0
  111. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/service/__init__.py +0 -0
  112. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/service/controllers/__init__.py +0 -0
  113. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/service/controllers/rest.py +0 -0
  114. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/service/general.py +0 -0
  115. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/service/repository.py +0 -0
  116. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/signature.py +0 -0
  117. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/models/transfers/results/token.py +0 -0
  118. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/rest_controller_result.py +0 -0
  119. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/types.py +0 -0
  120. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/__init__.py +0 -0
  121. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/cache.py +0 -0
  122. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/client.py +0 -0
  123. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/controller.py +0 -0
  124. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/dependencies/__init__.py +0 -0
  125. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/dependencies/auth.py +0 -0
  126. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/dependencies/context.py +0 -0
  127. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/exceptions.py +0 -0
  128. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/extractor.py +0 -0
  129. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/formatter/__init__.py +0 -0
  130. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/formatter/case.py +0 -0
  131. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/loaders/__init__.py +0 -0
  132. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/loaders/credential/__init__.py +0 -0
  133. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/loaders/credential/google.py +0 -0
  134. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/loaders/json.py +0 -0
  135. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/loaders/key/__init__.py +0 -0
  136. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/loaders/key/rsa.py +0 -0
  137. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/loaders/yaml.py +0 -0
  138. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/logging.py +0 -0
  139. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/merger.py +0 -0
  140. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/query.py +0 -0
  141. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/repository.py +0 -0
  142. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation/utils/searcher.py +0 -0
  143. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation.egg-info/SOURCES.txt +0 -0
  144. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation.egg-info/dependency_links.txt +0 -0
  145. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation.egg-info/requires.txt +0 -0
  146. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/maleo_foundation.egg-info/top_level.txt +0 -0
  147. {maleo_foundation-0.3.25 → maleo_foundation-0.3.29}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.3.25
3
+ Version: 0.3.29
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -0,0 +1,37 @@
1
+ from pathlib import Path
2
+ from maleo_foundation.models.transfers.general.configurations import Configurations
3
+ from maleo_foundation.models.transfers.general.settings import Settings
4
+ from maleo_foundation.utils.loaders.yaml import YAMLLoader
5
+ from .credential import CredentialManager
6
+
7
+ class ConfigurationManager:
8
+ def __init__(
9
+ self,
10
+ settings: Settings,
11
+ credential_manager: CredentialManager
12
+ ) -> None:
13
+ self._settings = settings
14
+ self._credential_manager = credential_manager
15
+
16
+ use_local = self._settings.USE_LOCAL_CONFIGURATIONS
17
+ config_path = self._settings.CONFIGURATIONS_PATH
18
+
19
+ if use_local and config_path is not None and isinstance(config_path, str):
20
+ config_path = Path(config_path)
21
+ if config_path.exists() and config_path.is_file():
22
+ data = YAMLLoader.load_from_path(config_path)
23
+ self._configurations = Configurations.model_validate(data)
24
+ return
25
+
26
+ secret_data = (
27
+ self
28
+ ._credential_manager
29
+ .secret_manager
30
+ .get(f"{self._settings.SERVICE_KEY}-configurations-{self._settings.ENVIRONMENT}")
31
+ )
32
+ data = YAMLLoader.load_from_string(secret_data)
33
+ self._configurations = Configurations.model_validate(data)
34
+
35
+ @property
36
+ def configurations(self) -> Configurations:
37
+ return self._configurations
@@ -3,34 +3,17 @@ from maleo_foundation.utils.logging import MiddlewareLogger, ServiceLogger
3
3
  from .cache import CacheConfigurations
4
4
  from .client import ClientConfigurations
5
5
  from .database import DatabaseConfigurations
6
- from .middleware import (
7
- MiddlewareRuntimeConfigurations,
8
- MiddlewareStaticConfigurations,
9
- MiddlewareConfigurations
10
- )
6
+ from .middleware import MiddlewareConfigurations
11
7
  from .service import ServiceConfigurations
12
8
 
13
- class RuntimeConfigurations(BaseModel):
14
- model_config = ConfigDict(arbitrary_types_allowed=True)
15
-
16
- service: ServiceConfigurations = Field(..., description="Service's configurations")
17
- middleware: MiddlewareRuntimeConfigurations = Field(..., description="Middleware's runtime configurations")
18
- database: DatabaseConfigurations = Field(..., description="Database's configurations")
19
-
20
- class StaticConfigurations(BaseModel):
21
- model_config = ConfigDict(arbitrary_types_allowed=True)
22
-
23
- middleware: MiddlewareStaticConfigurations = Field(..., description="Middleware's static configurations")
24
- client: ClientConfigurations = Field(..., description="Client's configurations")
25
-
26
9
  class Configurations(BaseModel):
27
10
  model_config = ConfigDict(arbitrary_types_allowed=True)
28
11
 
29
- service: ServiceConfigurations = Field(..., description="Service's configurations")
30
- middleware: MiddlewareConfigurations = Field(..., description="Middleware's configurations")
31
12
  cache: CacheConfigurations = Field(..., description="Cache's configurations")
32
- database: DatabaseConfigurations = Field(..., description="Database's configurations")
33
13
  client: ClientConfigurations = Field(..., description="Client's configurations")
14
+ database: DatabaseConfigurations = Field(..., description="Database's configurations")
15
+ middleware: MiddlewareConfigurations = Field(..., description="Middleware's configurations")
16
+ service: ServiceConfigurations = Field(..., description="Service's configurations")
34
17
 
35
18
  class Loggers(BaseModel):
36
19
  model_config = ConfigDict(arbitrary_types_allowed=True)
@@ -4,4 +4,4 @@ from .maleo import MaleoClientsConfigurations
4
4
  class ClientConfigurations(BaseModel):
5
5
  model_config = ConfigDict(arbitrary_types_allowed=True)
6
6
 
7
- maleo: MaleoClientsConfigurations = Field(..., description="Maleo client's configurations")
7
+ maleo: MaleoClientsConfigurations = Field(default_factory=MaleoClientsConfigurations, description="Maleo client's configurations")
@@ -0,0 +1,23 @@
1
+ from pydantic import BaseModel, ConfigDict, Field
2
+ from typing import Optional
3
+
4
+ class MaleoClientConfigurations(BaseModel):
5
+ key: str = Field(..., description="Client's key")
6
+ name: str = Field(..., description="Client's name")
7
+ url: str = Field(..., description="Client's URL")
8
+
9
+ class MaleoClientsConfigurations(BaseModel):
10
+ model_config = ConfigDict(arbitrary_types_allowed=True)
11
+
12
+ telemetry: Optional[MaleoClientConfigurations] = Field(None, description="MaleoTelemetry client's configuration")
13
+ metadata: Optional[MaleoClientConfigurations] = Field(None, description="MaleoMetadata client's configuration")
14
+ identity: Optional[MaleoClientConfigurations] = Field(None, description="MaleoIdentity client's configuration")
15
+ access: Optional[MaleoClientConfigurations] = Field(None, description="MaleoAccess client's configuration")
16
+ workshop: Optional[MaleoClientConfigurations] = Field(None, description="MaleoWorkshop client's configuration")
17
+ soapie: Optional[MaleoClientConfigurations] = Field(None, description="MaleoSOAPIE client's configuration")
18
+ medix: Optional[MaleoClientConfigurations] = Field(None, description="MaleoMedix client's configuration")
19
+ dicom: Optional[MaleoClientConfigurations] = Field(None, description="MaleoDICOM client's configuration")
20
+ scribe: Optional[MaleoClientConfigurations] = Field(None, description="MaleoScribe client's configuration")
21
+ cds: Optional[MaleoClientConfigurations] = Field(None, description="MaleoCDS client's configuration")
22
+ imaging: Optional[MaleoClientConfigurations] = Field(None, description="MaleoImaging client's configuration")
23
+ mcu: Optional[MaleoClientConfigurations] = Field(None, description="MaleoMCU client's configuration")
@@ -1,4 +1,4 @@
1
- from pydantic import BaseModel, ConfigDict, Field
1
+ from pydantic import BaseModel, Field
2
2
  from typing import List
3
3
 
4
4
  _ALLOW_METHODS: List[str] = [
@@ -34,23 +34,12 @@ class GeneralMiddlewareConfigurations(BaseModel):
34
34
  class CORSMiddlewareConfigurations(BaseModel):
35
35
  expose_headers: List[str] = Field(_EXPOSE_HEADERS, description="Exposed headers")
36
36
 
37
- class MiddlewareStaticConfigurations(BaseModel):
38
- model_config = ConfigDict(arbitrary_types_allowed=True)
39
-
40
- general: GeneralMiddlewareConfigurations = Field(..., description="Middleware's general configurations")
41
- cors: CORSMiddlewareConfigurations = Field(..., description="CORS middleware's configurations")
42
-
43
37
  class BaseMiddlewareConfigurations(BaseModel):
44
38
  limit: int = Field(10, description="Request limit (per 'window' seconds)")
45
39
  window: int = Field(1, description="Request limit window (seconds)")
46
40
  cleanup_interval: int = Field(60, description="Interval for middleware cleanup (seconds)")
47
41
  ip_timeout: int = Field(300, description="Idle IP's timeout (seconds)")
48
42
 
49
- class MiddlewareRuntimeConfigurations(BaseModel):
50
- model_config = ConfigDict(arbitrary_types_allowed=True)
51
-
52
- base: BaseMiddlewareConfigurations = Field(..., description="Base middleware's configurations")
53
-
54
43
  class MiddlewareConfigurations(BaseModel):
55
44
  general: GeneralMiddlewareConfigurations = Field(..., description="Middleware's general configurations")
56
45
  cors: CORSMiddlewareConfigurations = Field(..., description="CORS middleware's configurations")
@@ -0,0 +1,46 @@
1
+ from pydantic_settings import BaseSettings
2
+ from pydantic import Field, model_validator
3
+ from typing import Self
4
+ from maleo_foundation.enums import BaseEnums
5
+ from maleo_foundation.types import BaseTypes
6
+
7
+ class Settings(BaseSettings):
8
+ ENVIRONMENT: BaseEnums.EnvironmentType = Field(..., description="Environment")
9
+ SERVICE_KEY: str = Field(..., description="Service's key")
10
+ ROOT_PATH: str = Field("", description="Application's root path")
11
+ GOOGLE_CREDENTIALS_PATH: str = Field(
12
+ "/credentials/maleo-google-service-account.json",
13
+ description="Internal credential's file path"
14
+ )
15
+ USE_LOCAL_CONFIGURATIONS: bool = Field(
16
+ False,
17
+ description="Whether to use local configurations"
18
+ )
19
+ CONFIGURATIONS_PATH: BaseTypes.OptionalString = Field(
20
+ None,
21
+ description="Configurations path"
22
+ )
23
+ KEY_PASSWORD: BaseTypes.OptionalString = Field(
24
+ None,
25
+ description="Key's password"
26
+ )
27
+ PRIVATE_KEY: BaseTypes.OptionalString = Field(
28
+ None,
29
+ description="Private key"
30
+ )
31
+ PUBLIC_KEY: BaseTypes.OptionalString = Field(
32
+ None,
33
+ description="Public key"
34
+ )
35
+
36
+ @model_validator(mode="after")
37
+ def validate_configurations_path(self) -> Self:
38
+ if self.USE_LOCAL_CONFIGURATIONS and self.CONFIGURATIONS_PATH is None:
39
+ self.CONFIGURATIONS_PATH = (
40
+ f"/configurations/{self.SERVICE_KEY}-configurations-{self.ENVIRONMENT}.yaml"
41
+ )
42
+
43
+ if self.USE_LOCAL_CONFIGURATIONS and self.CONFIGURATIONS_PATH is None:
44
+ raise ValueError("Configurations path must exist if use local configurations is set to true")
45
+
46
+ return self
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.3.25
3
+ Version: 0.3.29
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maleo_foundation"
7
- version = "0.3.25"
7
+ version = "0.3.29"
8
8
  description = "Foundation package for Maleo"
9
9
  authors = [
10
10
  { name = "Agra Bima Yuda", email = "agra@nexmedis.com" }
@@ -1,97 +0,0 @@
1
- from pathlib import Path
2
- from maleo_foundation.models.transfers.general.configurations.cache.redis import (
3
- RedisCacheNamespaces,
4
- RedisCacheConfigurations
5
- )
6
- from maleo_foundation.models.transfers.general.configurations.cache \
7
- import CacheConfigurations
8
- from maleo_foundation.models.transfers.general.configurations import (
9
- RuntimeConfigurations,
10
- StaticConfigurations,
11
- Configurations
12
- )
13
- from maleo_foundation.models.transfers.general.settings import Settings
14
- from maleo_foundation.utils.loaders.yaml import YAMLLoader
15
- from maleo_foundation.utils.merger import deep_merge
16
- from .credential import CredentialManager
17
-
18
- class ConfigurationManager:
19
- def __init__(
20
- self,
21
- settings: Settings,
22
- credential_manager: CredentialManager
23
- ):
24
- self._settings = settings
25
- self._credential_manager = credential_manager
26
-
27
- self._load_configurations()
28
-
29
- def _load_static_configurations(self) -> StaticConfigurations:
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)
46
- return StaticConfigurations.model_validate(data)
47
-
48
- def _load_runtime_configurations(self) -> RuntimeConfigurations:
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)
65
- return RuntimeConfigurations.model_validate(data)
66
-
67
- def _load_cache_configurations(self) -> CacheConfigurations:
68
- namespaces = RedisCacheNamespaces(base=self._settings.SERVICE_KEY)
69
- host = self._credential_manager.secret_manager.get(
70
- f"maleo-redis-host-{self._settings.ENVIRONMENT}"
71
- )
72
- password = self._credential_manager.secret_manager.get(
73
- f"maleo-redis-password-{self._settings.ENVIRONMENT}"
74
- )
75
- redis = RedisCacheConfigurations(
76
- namespaces=namespaces,
77
- host=host,
78
- password=password
79
- )
80
- return CacheConfigurations(redis=redis)
81
-
82
- def _load_configurations(self) -> None:
83
- static_configurations = self._load_static_configurations()
84
- runtime_configurations = self._load_runtime_configurations()
85
- cache_configurations = self._load_cache_configurations()
86
-
87
- merged_configurations = deep_merge(
88
- static_configurations.model_dump(),
89
- runtime_configurations.model_dump(),
90
- {"cache": cache_configurations.model_dump()}
91
- )
92
-
93
- self._configurations = Configurations.model_validate(merged_configurations)
94
-
95
- @property
96
- def configurations(self) -> Configurations:
97
- return self._configurations
@@ -1,22 +0,0 @@
1
- from pydantic import BaseModel, ConfigDict, Field
2
-
3
- class MaleoClientConfigurations(BaseModel):
4
- key: str = Field(..., description="Client's key")
5
- name: str = Field(..., description="Client's name")
6
- url: str = Field(..., description="Client's URL")
7
-
8
- class MaleoClientsConfigurations(BaseModel):
9
- model_config = ConfigDict(arbitrary_types_allowed=True)
10
-
11
- telemetry: MaleoClientConfigurations = Field(..., description="MaleoTelemetry client's configuration")
12
- metadata: MaleoClientConfigurations = Field(..., description="MaleoMetadata client's configuration")
13
- identity: MaleoClientConfigurations = Field(..., description="MaleoIdentity client's configuration")
14
- access: MaleoClientConfigurations = Field(..., description="MaleoAccess client's configuration")
15
- workshop: MaleoClientConfigurations = Field(..., description="MaleoWorkshop client's configuration")
16
- soapie: MaleoClientConfigurations = Field(..., description="MaleoSOAPIE client's configuration")
17
- medix: MaleoClientConfigurations = Field(..., description="MaleoMedix client's configuration")
18
- dicom: MaleoClientConfigurations = Field(..., description="MaleoDICOM client's configuration")
19
- scribe: MaleoClientConfigurations = Field(..., description="MaleoScribe client's configuration")
20
- cds: MaleoClientConfigurations = Field(..., description="MaleoCDS client's configuration")
21
- imaging: MaleoClientConfigurations = Field(..., description="MaleoImaging client's configuration")
22
- mcu: MaleoClientConfigurations = Field(..., description="MaleoMCU client's configuration")
@@ -1,62 +0,0 @@
1
- from pydantic_settings import BaseSettings
2
- from pydantic import Field, model_validator
3
- from typing import Self
4
- from maleo_foundation.enums import BaseEnums
5
- from maleo_foundation.types import BaseTypes
6
-
7
- class Settings(BaseSettings):
8
- ENVIRONMENT: BaseEnums.EnvironmentType = Field(..., description="Environment")
9
- SERVICE_KEY: str = Field(..., description="Service's key")
10
- ROOT_PATH: str = Field("", description="Application's root path")
11
- GOOGLE_CREDENTIALS_PATH: str = Field(
12
- "/credentials/maleo-google-service-account.json",
13
- description="Internal credential's file path"
14
- )
15
- USE_LOCAL_STATIC_CONFIGURATIONS: bool = Field(
16
- False,
17
- description="Whether to use local static configurations"
18
- )
19
- STATIC_CONFIGURATIONS_PATH: BaseTypes.OptionalString = Field(
20
- None,
21
- description="Maleo's static configurations path"
22
- )
23
- USE_LOCAL_RUNTIME_CONFIGURATIONS: bool = Field(
24
- False,
25
- description="Whether to use local runtime configurations"
26
- )
27
- RUNTIME_CONFIGURATIONS_PATH: BaseTypes.OptionalString = Field(
28
- None,
29
- description="Service's runtime configurations path"
30
- )
31
- KEY_PASSWORD: BaseTypes.OptionalString = Field(
32
- None,
33
- description="Key's password"
34
- )
35
- PRIVATE_KEY: BaseTypes.OptionalString = Field(
36
- None,
37
- description="Private key"
38
- )
39
- PUBLIC_KEY: BaseTypes.OptionalString = Field(
40
- None,
41
- description="Public key"
42
- )
43
-
44
- @model_validator(mode="after")
45
- def validate_configurations_path(self) -> Self:
46
- if self.USE_LOCAL_STATIC_CONFIGURATIONS and self.STATIC_CONFIGURATIONS_PATH is None:
47
- self.STATIC_CONFIGURATIONS_PATH = (
48
- f"/static-configurations/maleo-static-configurations-{self.ENVIRONMENT}.yaml"
49
- )
50
-
51
- if self.USE_LOCAL_STATIC_CONFIGURATIONS and self.STATIC_CONFIGURATIONS_PATH is None:
52
- raise ValueError("Static configurations path must exist if use local static configurations is set to true")
53
-
54
- if self.USE_LOCAL_RUNTIME_CONFIGURATIONS and self.RUNTIME_CONFIGURATIONS_PATH is None:
55
- self.RUNTIME_CONFIGURATIONS_PATH = (
56
- f"/runtime-configurations/{self.SERVICE_KEY}-runtime-configurations-{self.ENVIRONMENT}.yaml"
57
- )
58
-
59
- if self.USE_LOCAL_RUNTIME_CONFIGURATIONS and self.RUNTIME_CONFIGURATIONS_PATH is None:
60
- raise ValueError("Runtime configurations path must exist if use local runtime configurations is set to true")
61
-
62
- return self