orionis 0.66.0__tar.gz → 0.70.0__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 (171) hide show
  1. {orionis-0.66.0/orionis.egg-info → orionis-0.70.0}/PKG-INFO +1 -1
  2. orionis-0.70.0/orionis/contracts/services/environment/i_environment_service.py +74 -0
  3. orionis-0.66.0/orionis/contracts/services/files/i_path_service.py → orionis-0.70.0/orionis/contracts/services/files/i_path_resolver_service.py +1 -3
  4. {orionis-0.66.0 → orionis-0.70.0}/orionis/framework.py +1 -1
  5. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/app.py +21 -3
  6. orionis-0.70.0/orionis/luminate/bootstrap/environment_bootstrapper.py +76 -0
  7. orionis-0.70.0/orionis/luminate/bootstrap/service_providers_bootstrapper.py +10 -0
  8. orionis-0.70.0/orionis/luminate/facades/app.py +41 -0
  9. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/facades/config/config_facade.py +5 -7
  10. orionis-0.70.0/orionis/luminate/facades/environment/environment_facade.py +93 -0
  11. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/facades/files/path_facade.py +4 -3
  12. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/facades/log/log_facade.py +11 -6
  13. orionis-0.70.0/orionis/luminate/providers/config/config_service_provider.py +19 -0
  14. orionis-0.70.0/orionis/luminate/providers/environment/environment_provider.py +19 -0
  15. orionis-0.70.0/orionis/luminate/providers/log/log_service_provider.py +19 -0
  16. orionis-0.70.0/orionis/luminate/providers/service_provider.py +51 -0
  17. orionis-0.66.0/orionis/luminate/facades/environment/environment_facade.py → orionis-0.70.0/orionis/luminate/services/environment/environment_service.py +46 -51
  18. orionis-0.70.0/orionis/luminate/services/files/path_resolver_service.py +59 -0
  19. orionis-0.70.0/orionis/luminate/test/__init__.py +0 -0
  20. {orionis-0.66.0 → orionis-0.70.0/orionis.egg-info}/PKG-INFO +1 -1
  21. {orionis-0.66.0 → orionis-0.70.0}/orionis.egg-info/SOURCES.txt +11 -2
  22. orionis-0.70.0/tests/__init__.py +0 -0
  23. orionis-0.70.0/tests/tools/__init__.py +0 -0
  24. orionis-0.66.0/orionis/luminate/bootstrap/environment_bootstrapper.py +0 -138
  25. orionis-0.66.0/orionis/luminate/providers/config/config_service_provider.py +0 -26
  26. orionis-0.66.0/orionis/luminate/providers/log/log_service_provider.py +0 -26
  27. orionis-0.66.0/orionis/luminate/services/files/path_service.py +0 -91
  28. {orionis-0.66.0 → orionis-0.70.0}/LICENCE +0 -0
  29. {orionis-0.66.0 → orionis-0.70.0}/MANIFEST.in +0 -0
  30. {orionis-0.66.0 → orionis-0.70.0}/README.md +0 -0
  31. {orionis-0.66.0 → orionis-0.70.0}/orionis/__init__.py +0 -0
  32. {orionis-0.66.0 → orionis-0.70.0}/orionis/cli_manager.py +0 -0
  33. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/__init__.py +0 -0
  34. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/bootstrap/i_command_bootstrapper.py +0 -0
  35. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/bootstrap/i_config_bootstrapper.py +0 -0
  36. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/bootstrap/i_environment_bootstrapper.py +0 -0
  37. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/config/__init__.py +0 -0
  38. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/config/i_config.py +0 -0
  39. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/__init__.py +0 -0
  40. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/base/__init__.py +0 -0
  41. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/base/i_command.py +0 -0
  42. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/i_command_filter.py +0 -0
  43. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/i_kernel.py +0 -0
  44. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/i_parser.py +0 -0
  45. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/i_task_manager.py +0 -0
  46. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/output/__init__.py +0 -0
  47. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/output/i_console.py +0 -0
  48. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/output/i_executor.py +0 -0
  49. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/output/i_progress_bar.py +0 -0
  50. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/tasks/__init__.py +0 -0
  51. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/console/tasks/i_schedule.py +0 -0
  52. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/container/i_container.py +0 -0
  53. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/container/i_types.py +0 -0
  54. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/facades/__init__.py +0 -0
  55. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/facades/config/__init__.py +0 -0
  56. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/facades/config/i_config_facade.py +0 -0
  57. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/facades/environment/__init__.py +0 -0
  58. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/facades/environment/i_environment_facade.py +0 -0
  59. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/facades/files/__init__.py +0 -0
  60. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/facades/files/i_path_facade.py +0 -0
  61. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/facades/log/__init__.py +0 -0
  62. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/facades/log/i_log_facade.py +0 -0
  63. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/facades/tests/__init__.py +0 -0
  64. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/facades/tests/i_tests_facade.py +0 -0
  65. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/installer/__init__.py +0 -0
  66. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/installer/i_installer_manager.py +0 -0
  67. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/installer/i_installer_output.py +0 -0
  68. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/installer/i_installer_setup.py +0 -0
  69. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/providers/__init__.py +0 -0
  70. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/providers/i_service_provider.py +0 -0
  71. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/services/__init__.py +0 -0
  72. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/services/config/__init__.py +0 -0
  73. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/services/config/i_config_service.py +0 -0
  74. {orionis-0.66.0/orionis/contracts/services/files → orionis-0.70.0/orionis/contracts/services/environment}/__init__.py +0 -0
  75. {orionis-0.66.0/orionis/contracts/services/log → orionis-0.70.0/orionis/contracts/services/files}/__init__.py +0 -0
  76. {orionis-0.66.0/orionis/installer → orionis-0.70.0/orionis/contracts/services/log}/__init__.py +0 -0
  77. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/services/log/i_log_service.py +0 -0
  78. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/support/i_exception_to_dict.py +0 -0
  79. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/support/i_reflection.py +0 -0
  80. {orionis-0.66.0 → orionis-0.70.0}/orionis/contracts/support/i_std.py +0 -0
  81. {orionis-0.66.0/orionis/luminate → orionis-0.70.0/orionis/installer}/__init__.py +0 -0
  82. {orionis-0.66.0 → orionis-0.70.0}/orionis/installer/installer_manager.py +0 -0
  83. {orionis-0.66.0 → orionis-0.70.0}/orionis/installer/installer_output.py +0 -0
  84. {orionis-0.66.0 → orionis-0.70.0}/orionis/installer/installer_setup.py +0 -0
  85. {orionis-0.66.0/orionis/luminate/bootstrap → orionis-0.70.0/orionis/luminate}/__init__.py +0 -0
  86. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/app_context.py +0 -0
  87. {orionis-0.66.0/orionis/luminate/config → orionis-0.70.0/orionis/luminate/bootstrap}/__init__.py +0 -0
  88. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/bootstrap/command_bootstrapper.py +0 -0
  89. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/bootstrap/config_bootstrapper.py +0 -0
  90. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/bootstrap/exception_bootstrapper.py +0 -0
  91. {orionis-0.66.0/orionis/luminate/console → orionis-0.70.0/orionis/luminate/config}/__init__.py +0 -0
  92. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/config/app.py +0 -0
  93. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/config/auth.py +0 -0
  94. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/config/cache.py +0 -0
  95. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/config/cors.py +0 -0
  96. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/config/database.py +0 -0
  97. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/config/filesystems.py +0 -0
  98. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/config/logging.py +0 -0
  99. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/config/mail.py +0 -0
  100. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/config/queue.py +0 -0
  101. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/config/session.py +0 -0
  102. {orionis-0.66.0/orionis/luminate/console/base → orionis-0.70.0/orionis/luminate/console}/__init__.py +0 -0
  103. {orionis-0.66.0/orionis/luminate/console/commands → orionis-0.70.0/orionis/luminate/console/base}/__init__.py +0 -0
  104. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/base/command.py +0 -0
  105. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/command_filter.py +0 -0
  106. {orionis-0.66.0/orionis/luminate/console/exceptions → orionis-0.70.0/orionis/luminate/console/commands}/__init__.py +0 -0
  107. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/commands/cache_clear.py +0 -0
  108. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/commands/help.py +0 -0
  109. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/commands/schedule_work.py +0 -0
  110. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/commands/tests.py +0 -0
  111. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/commands/version.py +0 -0
  112. {orionis-0.66.0/orionis/luminate/console/output → orionis-0.70.0/orionis/luminate/console/exceptions}/__init__.py +0 -0
  113. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/exceptions/cli_exception.py +0 -0
  114. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/kernel.py +0 -0
  115. {orionis-0.66.0/orionis/luminate/console/tasks → orionis-0.70.0/orionis/luminate/console/output}/__init__.py +0 -0
  116. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/output/console.py +0 -0
  117. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/output/executor.py +0 -0
  118. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/output/progress_bar.py +0 -0
  119. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/output/styles.py +0 -0
  120. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/parser.py +0 -0
  121. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/runner.py +0 -0
  122. {orionis-0.66.0/orionis/luminate/facades → orionis-0.70.0/orionis/luminate/console/tasks}/__init__.py +0 -0
  123. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/console/tasks/scheduler.py +0 -0
  124. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/container/container.py +0 -0
  125. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/container/exception.py +0 -0
  126. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/container/types.py +0 -0
  127. {orionis-0.66.0/orionis/luminate/facades/config → orionis-0.70.0/orionis/luminate/facades}/__init__.py +0 -0
  128. {orionis-0.66.0/orionis/luminate/facades/environment → orionis-0.70.0/orionis/luminate/facades/config}/__init__.py +0 -0
  129. {orionis-0.66.0/orionis/luminate/facades/files → orionis-0.70.0/orionis/luminate/facades/environment}/__init__.py +0 -0
  130. {orionis-0.66.0/orionis/luminate/facades/log → orionis-0.70.0/orionis/luminate/facades/files}/__init__.py +0 -0
  131. {orionis-0.66.0/orionis/luminate/facades/tests → orionis-0.70.0/orionis/luminate/facades/log}/__init__.py +0 -0
  132. {orionis-0.66.0/orionis/luminate/patterns → orionis-0.70.0/orionis/luminate/facades/tests}/__init__.py +0 -0
  133. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/facades/tests/tests_facade.py +0 -0
  134. {orionis-0.66.0/orionis/luminate/pipelines → orionis-0.70.0/orionis/luminate/patterns}/__init__.py +0 -0
  135. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/patterns/singleton.py +0 -0
  136. {orionis-0.66.0/orionis/luminate/providers → orionis-0.70.0/orionis/luminate/pipelines}/__init__.py +0 -0
  137. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/pipelines/cli_pipeline.py +0 -0
  138. {orionis-0.66.0/orionis/luminate/providers/config → orionis-0.70.0/orionis/luminate/providers}/__init__.py +0 -0
  139. {orionis-0.66.0/orionis/luminate/providers/log → orionis-0.70.0/orionis/luminate/providers/config}/__init__.py +0 -0
  140. {orionis-0.66.0/orionis/luminate/services → orionis-0.70.0/orionis/luminate/providers/environment}/__init__.py +0 -0
  141. {orionis-0.66.0/orionis/luminate/services/config → orionis-0.70.0/orionis/luminate/providers/log}/__init__.py +0 -0
  142. {orionis-0.66.0/orionis/luminate/services/files → orionis-0.70.0/orionis/luminate/services}/__init__.py +0 -0
  143. {orionis-0.66.0/orionis/luminate/services/log → orionis-0.70.0/orionis/luminate/services/config}/__init__.py +0 -0
  144. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/services/config/config_service.py +0 -0
  145. {orionis-0.66.0/orionis/luminate/test → orionis-0.70.0/orionis/luminate/services/environment}/__init__.py +0 -0
  146. {orionis-0.66.0/tests → orionis-0.70.0/orionis/luminate/services/files}/__init__.py +0 -0
  147. {orionis-0.66.0/tests/tools → orionis-0.70.0/orionis/luminate/services/log}/__init__.py +0 -0
  148. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/services/log/log_service.py +0 -0
  149. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/support/dot_dict.py +0 -0
  150. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/support/exception_to_dict.py +0 -0
  151. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/support/reflection.py +0 -0
  152. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/support/std.py +0 -0
  153. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/test/exception.py +0 -0
  154. {orionis-0.66.0 → orionis-0.70.0}/orionis/luminate/test/unit_test.py +0 -0
  155. {orionis-0.66.0 → orionis-0.70.0}/orionis/static/ascii/icon.ascii +0 -0
  156. {orionis-0.66.0 → orionis-0.70.0}/orionis/static/ascii/info.ascii +0 -0
  157. {orionis-0.66.0 → orionis-0.70.0}/orionis/static/bg/galaxy.jpg +0 -0
  158. {orionis-0.66.0 → orionis-0.70.0}/orionis/static/favicon/OrionisFrameworkFavicon.png +0 -0
  159. {orionis-0.66.0 → orionis-0.70.0}/orionis/static/logos/OrionisFramework.jpg +0 -0
  160. {orionis-0.66.0 → orionis-0.70.0}/orionis/static/logos/OrionisFramework.png +0 -0
  161. {orionis-0.66.0 → orionis-0.70.0}/orionis/static/logos/OrionisFramework.psd +0 -0
  162. {orionis-0.66.0 → orionis-0.70.0}/orionis/static/logos/OrionisFramework2.png +0 -0
  163. {orionis-0.66.0 → orionis-0.70.0}/orionis/static/logos/OrionisFramework3.png +0 -0
  164. {orionis-0.66.0 → orionis-0.70.0}/orionis.egg-info/dependency_links.txt +0 -0
  165. {orionis-0.66.0 → orionis-0.70.0}/orionis.egg-info/entry_points.txt +0 -0
  166. {orionis-0.66.0 → orionis-0.70.0}/orionis.egg-info/requires.txt +0 -0
  167. {orionis-0.66.0 → orionis-0.70.0}/orionis.egg-info/top_level.txt +0 -0
  168. {orionis-0.66.0 → orionis-0.70.0}/setup.cfg +0 -0
  169. {orionis-0.66.0 → orionis-0.70.0}/setup.py +0 -0
  170. {orionis-0.66.0 → orionis-0.70.0}/tests/tools/class_example.py +0 -0
  171. {orionis-0.66.0 → orionis-0.70.0}/tests/tools/test_reflection.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.66.0
3
+ Version: 0.70.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -0,0 +1,74 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ class IEnvironmentService(ABC):
4
+
5
+ @abstractmethod
6
+ def _initialize(self, path: str = None):
7
+ """
8
+ Initializes the instance by setting the path to the .env file.
9
+ If no path is provided, defaults to a `.env` file in the current directory.
10
+
11
+ Parameters
12
+ ----------
13
+ path : str, optional
14
+ Path to the .env file. Defaults to None.
15
+ """
16
+ pass
17
+
18
+ @abstractmethod
19
+ def get(self, key: str, default=None) -> str:
20
+ """
21
+ Retrieves the value of an environment variable from the .env file
22
+ or from system environment variables if not found.
23
+
24
+ Parameters
25
+ ----------
26
+ key : str
27
+ The key of the environment variable.
28
+ default : optional
29
+ Default value if the key does not exist. Defaults to None.
30
+
31
+ Returns
32
+ -------
33
+ str
34
+ The value of the environment variable or the default value.
35
+ """
36
+ pass
37
+
38
+ @abstractmethod
39
+ def set(self, key: str, value: str) -> None:
40
+ """
41
+ Sets the value of an environment variable in the .env file.
42
+
43
+ Parameters
44
+ ----------
45
+ key : str
46
+ The key of the environment variable.
47
+ value : str
48
+ The value to set.
49
+ """
50
+ pass
51
+
52
+ @abstractmethod
53
+ def unset(self, key: str) -> None:
54
+ """
55
+ Removes an environment variable from the .env file.
56
+
57
+ Parameters
58
+ ----------
59
+ key : str
60
+ The key of the environment variable to remove.
61
+ """
62
+ pass
63
+
64
+ @abstractmethod
65
+ def all(self) -> dict:
66
+ """
67
+ Retrieves all environment variable values from the .env file.
68
+
69
+ Returns
70
+ -------
71
+ dict
72
+ A dictionary of all environment variables and their values.
73
+ """
74
+ pass
@@ -1,8 +1,6 @@
1
- import os
2
- from pathlib import Path
3
1
  from abc import ABC, abstractmethod
4
2
 
5
- class IPathService(ABC):
3
+ class IPathResolverService(ABC):
6
4
 
7
5
  @abstractmethod
8
6
  def resolve(self, route: str) -> str:
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.66.0"
8
+ VERSION = "0.70.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,33 +1,51 @@
1
- import json
2
1
  from orionis.luminate.container.container import Container
3
2
  from orionis.luminate.bootstrap.config_bootstrapper import ConfigBootstrapper
4
3
  from orionis.luminate.bootstrap.command_bootstrapper import CommandsBootstrapper
5
4
  from orionis.luminate.bootstrap.environment_bootstrapper import EnvironmentBootstrapper
6
5
  from orionis.luminate.patterns.singleton import SingletonMeta
6
+ from orionis.luminate.providers.environment.environment_provider import EnvironmentProvider
7
7
 
8
8
  class Application(metaclass=SingletonMeta):
9
9
 
10
10
  def __init__(self):
11
11
 
12
+ # Atributos de la clase
12
13
  self._config = {}
13
14
  self._commands = {}
15
+ self._environment = {}
14
16
 
17
+ # Inicializar el contenedor de la aplicacion
15
18
  self.container = Container()
16
19
  self.container.instance(self.container)
20
+
21
+ # Cargar el servidor de entorno
22
+ self._loadServiceProviderEnvironment()
23
+
24
+ # Cargar dinamicamente la configurcion de la aplicacion.
17
25
  self._bootstraping()
18
26
 
27
+ def _loadServiceProviderEnvironment(self):
28
+
29
+ # Cargar el proveedor de entorno
30
+ _environment_provider = EnvironmentProvider(app=self.container)
31
+ _environment_provider.register()
32
+ _environment_provider.boot()
33
+
19
34
  def _bootstraping(self):
35
+
36
+ # Cargar la configuracion de la aplicacion
20
37
  config_bootstrapper_key = self.container.singleton(ConfigBootstrapper)
21
38
  config_bootstrapper: ConfigBootstrapper = self.container.make(config_bootstrapper_key)
22
39
  self._config = config_bootstrapper.get()
23
40
 
41
+ # Cargar los comandos propios y definidos por el desarrollador
24
42
  commands_bootstrapper_key = self.container.singleton(CommandsBootstrapper)
25
43
  commands_bootstrapper: CommandsBootstrapper = self.container.make(commands_bootstrapper_key)
26
44
  self._commands = commands_bootstrapper.get()
27
45
 
46
+ # Cargar las variables de entorno solo desde el archivo .env (No se carga desde el sistema operativo, por seguridad)
28
47
  environment_bootstrapper_key = self.container.singleton(EnvironmentBootstrapper)
29
48
  environment_bootstrapper: EnvironmentBootstrapper = self.container.make(environment_bootstrapper_key)
30
49
  self._environment = environment_bootstrapper.get()
31
50
 
32
- def isBooted(self):
33
- return True
51
+ print(self._config)
@@ -0,0 +1,76 @@
1
+ from typing import Dict
2
+ from orionis.contracts.bootstrap.i_environment_bootstrapper import IEnvironmentBootstrapper
3
+ from orionis.luminate.facades.app import app
4
+ from orionis.luminate.services.environment.environment_service import EnvironmentService
5
+
6
+ class EnvironmentBootstrapper(IEnvironmentBootstrapper):
7
+ """
8
+ A class responsible for loading and managing environment variables from a `.env` file.
9
+
10
+ This class implements the `IEnvironment` interface and provides functionality to
11
+ automatically load environment variables from a `.env` file located in the current
12
+ working directory. If the file does not exist, it creates it.
13
+
14
+ Attributes
15
+ ----------
16
+ _environment_vars : Dict[str, str]
17
+ A dictionary to store the loaded environment variables.
18
+ path : Path
19
+ The path to the `.env` file.
20
+
21
+ Methods
22
+ -------
23
+ __init__()
24
+ Initializes the `EnvironmentBootstrapper` and triggers the autoload process.
25
+ _autoload()
26
+ Loads environment variables from the `.env` file or creates the file if it does not exist.
27
+ """
28
+
29
+ def __init__(self) -> None:
30
+ """
31
+ Initializes the `EnvironmentBootstrapper` and triggers the autoload process.
32
+
33
+ The `_environment_vars` dictionary is initialized to store environment variables,
34
+ and the `_autoload` method is called to load variables from the `.env` file.
35
+ """
36
+ self._environment_vars: Dict[str, str] = {}
37
+ self._autoload()
38
+
39
+ def _autoload(self) -> None:
40
+ """
41
+ Loads environment variables from the `.env` file or creates the file if it does not exist.
42
+
43
+ This method checks if the `.env` file exists in the current working directory.
44
+ If the file does not exist, it creates an empty `.env` file. If the file exists,
45
+ it loads the environment variables into the `_environment_vars` dictionary.
46
+ """
47
+ environment_service : EnvironmentService = app(EnvironmentService)
48
+ self._environment_vars = environment_service.all()
49
+
50
+ def get(self, key: str = None) -> str:
51
+ """
52
+ Retrieves the value of an environment variable by its key.
53
+
54
+ Parameters
55
+ ----------
56
+ key : str
57
+ The key of the environment variable to retrieve.
58
+
59
+ Returns
60
+ -------
61
+ str
62
+ The value of the environment variable.
63
+
64
+ Raises
65
+ ------
66
+ KeyError
67
+ If the environment variable does not exist.
68
+ """
69
+
70
+ if not key:
71
+ return self._environment_vars
72
+
73
+ if key not in self._environment_vars:
74
+ raise KeyError(f"Environment variable {key} not found")
75
+
76
+ return self._environment_vars[key]
@@ -0,0 +1,10 @@
1
+ from orionis.luminate.container.container import Container
2
+
3
+ class ServiceProvidersBootstrapper:
4
+
5
+ def __init__(self, container : Container) -> None:
6
+ self._container = container
7
+ self._autoload()
8
+
9
+ def _autoload(self) -> None:
10
+ pass
@@ -0,0 +1,41 @@
1
+ from typing import Any
2
+ from orionis.luminate.container.container import Container
3
+ from orionis.luminate.container.exception import OrionisContainerException, OrionisContainerTypeError
4
+
5
+ def app(concrete: Any = None):
6
+ """
7
+ Retrieves the container instance or resolves a service from the container.
8
+
9
+ If a `concrete` class or service is passed, it will check if it is bound
10
+ to the container and return an instance of the service. If not bound,
11
+ an exception will be raised.
12
+
13
+ Parameters
14
+ ----------
15
+ concrete : Any, optional
16
+ The concrete service or class to resolve from the container.
17
+ If None, returns the container instance itself.
18
+
19
+ Returns
20
+ -------
21
+ Container or Any
22
+ If `concrete` is provided and bound, returns the resolved service.
23
+ If `concrete` is None, returns the container instance.
24
+
25
+ Raises
26
+ ------
27
+ OrionisContainerException
28
+ If `concrete` is not bound to the container.
29
+ """
30
+
31
+ # Create a new container instance
32
+ container : Container = Container()
33
+
34
+ # If concrete is provided (not None), attempt to resolve it from the container
35
+ if concrete is not None:
36
+ if not isinstance(concrete, type):
37
+ raise OrionisContainerTypeError(f"The provided concrete must be a class or service, got {type(concrete)}.")
38
+ return container.make(concrete)
39
+
40
+ # If concrete is None, return the container instance
41
+ return container
@@ -1,6 +1,6 @@
1
1
  from typing import Any, Optional
2
2
  from orionis.contracts.facades.config.i_config_facade import IConfig
3
- from orionis.luminate.app_context import AppContext
3
+ from orionis.luminate.facades.app import app
4
4
  from orionis.luminate.services.config.config_service import ConfigService
5
5
 
6
6
  class Config(IConfig):
@@ -17,9 +17,8 @@ class Config(IConfig):
17
17
  value : Any
18
18
  The value to set.
19
19
  """
20
- with AppContext() as app:
21
- config_service : ConfigService = app.container.make(ConfigService)
22
- config_service.set(key, value)
20
+ _config_service_provider : ConfigService = app(ConfigService)
21
+ return _config_service_provider.set(key, value)
23
22
 
24
23
  @staticmethod
25
24
  def get(key: str, default: Optional[Any] = None) -> Any:
@@ -38,6 +37,5 @@ class Config(IConfig):
38
37
  Any
39
38
  The configuration value or the default value if the key is not found.
40
39
  """
41
- with AppContext() as app:
42
- config_service : ConfigService = app.container.make(ConfigService)
43
- return config_service.get(key, default)
40
+ _config_service_provider : ConfigService = app(ConfigService)
41
+ return _config_service_provider.get(key, default)
@@ -0,0 +1,93 @@
1
+ from orionis.contracts.facades.environment.i_environment_facade import IEnv
2
+ from orionis.luminate.facades.app import app
3
+ from orionis.luminate.services.environment.environment_service import EnvironmentService
4
+
5
+ def env(key: str, default=None) -> str:
6
+ """
7
+ Retrieves the value of an environment variable.
8
+
9
+ This function provides a convenient way to access environment variables
10
+ stored in the application context. If the variable does not exist, it
11
+ returns the specified default value.
12
+
13
+ Parameters
14
+ ----------
15
+ key : str
16
+ The name of the environment variable to retrieve.
17
+ default : Any, optional
18
+ The default value to return if the environment variable does not exist.
19
+ Defaults to None.
20
+
21
+ Returns
22
+ -------
23
+ str
24
+ The value of the environment variable, or the default value if the variable
25
+ does not exist.
26
+ """
27
+ return Env.get(key, default)
28
+
29
+ class Env(IEnv):
30
+
31
+
32
+ @staticmethod
33
+ def get(key: str, default=None) -> str:
34
+ """
35
+ Retrieves the value of an environment variable from the .env file
36
+ or from system environment variables if not found.
37
+
38
+ Parameters
39
+ ----------
40
+ key : str
41
+ The key of the environment variable.
42
+ default : optional
43
+ Default value if the key does not exist. Defaults to None.
44
+
45
+ Returns
46
+ -------
47
+ str
48
+ The value of the environment variable or the default value.
49
+ """
50
+
51
+ _env_service : EnvironmentService = app(EnvironmentService)
52
+ return _env_service.get(key, default)
53
+
54
+ @staticmethod
55
+ def set(key: str, value: str) -> None:
56
+ """
57
+ Sets the value of an environment variable in the .env file.
58
+
59
+ Parameters
60
+ ----------
61
+ key : str
62
+ The key of the environment variable.
63
+ value : str
64
+ The value to set.
65
+ """
66
+ _env_service : EnvironmentService = app(EnvironmentService)
67
+ return _env_service.set(key, value)
68
+
69
+ @staticmethod
70
+ def unset(key: str) -> None:
71
+ """
72
+ Removes an environment variable from the .env file.
73
+
74
+ Parameters
75
+ ----------
76
+ key : str
77
+ The key of the environment variable to remove.
78
+ """
79
+ _env_service : EnvironmentService = app(EnvironmentService)
80
+ return _env_service.unset(key)
81
+
82
+ @staticmethod
83
+ def all() -> dict:
84
+ """
85
+ Retrieves all environment variable values from the .env file.
86
+
87
+ Returns
88
+ -------
89
+ dict
90
+ A dictionary of all environment variables and their values.
91
+ """
92
+ _env_service : EnvironmentService = app(EnvironmentService)
93
+ return _env_service.all()
@@ -1,6 +1,6 @@
1
1
  import os
2
2
  from orionis.contracts.facades.files.i_path_facade import IPath
3
- from orionis.luminate.services.files.path_service import PathService
3
+ from orionis.luminate.services.files.path_resolver_service import PathResolverService
4
4
 
5
5
  class Path(IPath):
6
6
  """
@@ -64,8 +64,9 @@ class Path(IPath):
64
64
  # Normalize path (removes redundant slashes)
65
65
  route = os.path.normpath(route)
66
66
 
67
- # Obtain the path service from the container
68
- PathService().resolve(route)
67
+ # Resolve path (Note: The service container is not used here)
68
+ path_resolver_service = PathResolverService()
69
+ return path_resolver_service.resolve(route)
69
70
 
70
71
  @staticmethod
71
72
  def app(file: str = None):
@@ -1,5 +1,5 @@
1
1
  from orionis.contracts.facades.log.i_log_facade import ILog
2
- from orionis.luminate.container.container import Container
2
+ from orionis.luminate.facades.app import app
3
3
  from orionis.luminate.services.log.log_service import LogguerService
4
4
 
5
5
  class Log(ILog):
@@ -34,7 +34,8 @@ class Log(ILog):
34
34
  message : str
35
35
  The message to log.
36
36
  """
37
- Container().make(LogguerService).info(message)
37
+ _log_service : LogguerService = app(LogguerService)
38
+ return _log_service.info(message)
38
39
 
39
40
  @staticmethod
40
41
  def error(message: str) -> None:
@@ -46,7 +47,8 @@ class Log(ILog):
46
47
  message : str
47
48
  The message to log.
48
49
  """
49
- Container().make(LogguerService).error(message)
50
+ _log_service : LogguerService = app(LogguerService)
51
+ return _log_service.error(message)
50
52
 
51
53
  @staticmethod
52
54
  def success(message: str) -> None:
@@ -58,7 +60,8 @@ class Log(ILog):
58
60
  message : str
59
61
  The message to log.
60
62
  """
61
- Container().make(LogguerService).success(message)
63
+ _log_service : LogguerService = app(LogguerService)
64
+ return _log_service.success(message)
62
65
 
63
66
  @staticmethod
64
67
  def warning(message: str) -> None:
@@ -70,7 +73,8 @@ class Log(ILog):
70
73
  message : str
71
74
  The message to log.
72
75
  """
73
- Container().make(LogguerService).warning(message)
76
+ _log_service : LogguerService = app(LogguerService)
77
+ return _log_service.warning(message)
74
78
 
75
79
  @staticmethod
76
80
  def debug(message: str) -> None:
@@ -82,4 +86,5 @@ class Log(ILog):
82
86
  message : str
83
87
  The message to log.
84
88
  """
85
- Container().make(LogguerService).debug(message)
89
+ _log_service : LogguerService = app(LogguerService)
90
+ return _log_service.debug(message)
@@ -0,0 +1,19 @@
1
+ from orionis.luminate.providers.service_provider import ServiceProvider
2
+ from orionis.luminate.services.config.config_service import ConfigService
3
+
4
+ class ConfigServiceProvider(ServiceProvider):
5
+
6
+ def register(self,) -> None:
7
+ """
8
+ Registers services or bindings into the given container.
9
+ """
10
+ self._container_id = self.app.scoped(ConfigService)
11
+
12
+ def boot(self,) -> None:
13
+ """
14
+ Boot the service provider.
15
+
16
+ This method is intended to be overridden by subclasses to perform
17
+ any necessary bootstrapping or initialization tasks.
18
+ """
19
+ self.app.make(self._container_id)
@@ -0,0 +1,19 @@
1
+ from orionis.luminate.providers.service_provider import ServiceProvider
2
+ from orionis.luminate.services.environment.environment_service import EnvironmentService
3
+
4
+ class EnvironmentProvider(ServiceProvider):
5
+
6
+ def register(self) -> None:
7
+ """
8
+ Registers services or bindings into the given container.
9
+ """
10
+ self._container_id = self.app.singleton(EnvironmentService)
11
+
12
+ def boot(self) -> None:
13
+ """
14
+ Boot the service provider.
15
+
16
+ This method is intended to be overridden by subclasses to perform
17
+ any necessary bootstrapping or initialization tasks.
18
+ """
19
+ self.app.make(self._container_id)
@@ -0,0 +1,19 @@
1
+ from orionis.luminate.providers.service_provider import ServiceProvider
2
+ from orionis.luminate.services.log.log_service import LogguerService
3
+
4
+ class LogServiceProvider(ServiceProvider):
5
+
6
+ def register(self) -> None:
7
+ """
8
+ Registers services or bindings into the given container.
9
+ """
10
+ self._container_id = self.app.singleton(LogguerService)
11
+
12
+ def boot(self) -> None:
13
+ """
14
+ Boot the service provider.
15
+
16
+ This method is intended to be overridden by subclasses to perform
17
+ any necessary bootstrapping or initialization tasks.
18
+ """
19
+ self.app.make(self._container_id)
@@ -0,0 +1,51 @@
1
+ from orionis.contracts.providers.i_service_provider import IServiceProvider
2
+ from orionis.luminate.container.container import Container
3
+
4
+ class ServiceProvider(IServiceProvider):
5
+ """
6
+ Base class for service providers.
7
+
8
+ Parameters
9
+ ----------
10
+ container : Container
11
+ The container instance to be used by the service provider.
12
+ """
13
+
14
+ def __init__(self, app : Container) -> None:
15
+ """
16
+ Initialize the service provider with the given container.
17
+
18
+ Parameters
19
+ ----------
20
+ container : Container
21
+ The container instance to be used by the service provider.
22
+ """
23
+ self.app = app
24
+
25
+ def register(self) -> None:
26
+ """
27
+ Register services in the container.
28
+
29
+ This method should be overridden in the subclass to register
30
+ specific services.
31
+
32
+ Parameters
33
+ ----------
34
+ container : Container
35
+ The container instance where services will be registered.
36
+ """
37
+ raise NotImplementedError("This method should be overridden in the subclass")
38
+
39
+ def boot(self) -> None:
40
+ """
41
+ Boot services in the container.
42
+
43
+ This method should be overridden in the subclass to boot
44
+ specific services.
45
+
46
+ Parameters
47
+ ----------
48
+ container : Container
49
+ The container instance where services will be booted.
50
+ """
51
+ raise NotImplementedError("This method should be overridden in the subclass")