orionis 0.50.0__tar.gz → 0.54.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {orionis-0.50.0/orionis.egg-info → orionis-0.54.0}/PKG-INFO +1 -1
- orionis-0.50.0/orionis/contracts/support/i_environment.py → orionis-0.54.0/orionis/contracts/facades/environment/i_environment_facade.py +1 -1
- {orionis-0.50.0 → orionis-0.54.0}/orionis/framework.py +1 -1
- orionis-0.54.0/orionis/luminate/app.py +18 -0
- orionis-0.50.0/orionis/luminate/support/environment.py → orionis-0.54.0/orionis/luminate/facades/environment/environment_facade.py +52 -15
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/facades/files/path_facade.py +1 -4
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/services/files/path_service.py +37 -17
- {orionis-0.50.0 → orionis-0.54.0/orionis.egg-info}/PKG-INFO +1 -1
- {orionis-0.50.0 → orionis-0.54.0}/orionis.egg-info/SOURCES.txt +0 -5
- orionis-0.50.0/orionis/contracts/facades/environment/i_environment_facade.py +0 -40
- orionis-0.50.0/orionis/luminate/app.py +0 -103
- orionis-0.50.0/orionis/luminate/config/helpers.py +0 -20
- orionis-0.50.0/orionis/luminate/facades/environment/environment_facade.py +0 -68
- orionis-0.50.0/orionis/luminate/providers/files/path_service_provider.py +0 -26
- orionis-0.50.0/tests/tools/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/LICENCE +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/MANIFEST.in +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/README.md +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/cli_manager.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/bootstrap/i_command_bootstrapper.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/bootstrap/i_config_bootstrapper.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/bootstrap/i_environment_bootstrapper.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/config/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/config/i_config.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/base/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/base/i_command.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/i_command_filter.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/i_kernel.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/i_parser.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/i_task_manager.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/output/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/output/i_console.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/output/i_executor.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/output/i_progress_bar.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/tasks/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/console/tasks/i_schedule.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/container/i_container.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/container/i_types.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/facades/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/facades/config/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/facades/config/i_config_facade.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/facades/environment/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/facades/files/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/facades/files/i_path_facade.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/facades/log/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/facades/log/i_log_facade.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/facades/tests/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/facades/tests/i_tests_facade.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/installer/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/installer/i_installer_manager.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/installer/i_installer_output.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/installer/i_installer_setup.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/providers/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/providers/i_service_provider.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/services/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/services/config/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/services/config/i_config_service.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/services/files/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/services/files/i_path_service.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/services/log/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/services/log/i_log_service.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/support/i_exception_to_dict.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/support/i_reflection.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/contracts/support/i_std.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/installer/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/installer/installer_manager.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/installer/installer_output.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/installer/installer_setup.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/app_context.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/bootstrap/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/bootstrap/command_bootstrapper.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/bootstrap/config_bootstrapper.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/bootstrap/environment_bootstrapper.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/bootstrap/exception_bootstrapper.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/config/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/config/app.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/config/auth.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/config/cache.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/config/cors.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/config/database.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/config/filesystems.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/config/logging.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/config/mail.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/config/queue.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/config/session.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/base/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/base/command.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/command_filter.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/commands/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/commands/cache_clear.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/commands/help.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/commands/schedule_work.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/commands/tests.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/commands/version.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/exceptions/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/exceptions/cli_exception.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/kernel.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/output/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/output/console.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/output/executor.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/output/progress_bar.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/output/styles.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/parser.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/runner.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/tasks/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/console/tasks/scheduler.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/container/container.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/container/exception.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/container/types.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/facades/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/facades/config/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/facades/config/config_facade.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/facades/environment/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/facades/files/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/facades/log/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/facades/log/log_facade.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/facades/tests/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/facades/tests/tests_facade.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/patterns/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/patterns/singleton.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/pipelines/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/pipelines/cli_pipeline.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/providers/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/providers/config/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/providers/config/config_service_provider.py +0 -0
- {orionis-0.50.0/orionis/luminate/providers/files → orionis-0.54.0/orionis/luminate/providers/log}/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/providers/log/log_service_provider.py +0 -0
- {orionis-0.50.0/orionis/luminate/providers/log → orionis-0.54.0/orionis/luminate/services}/__init__.py +0 -0
- {orionis-0.50.0/orionis/luminate/services → orionis-0.54.0/orionis/luminate/services/config}/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/services/config/config_service.py +0 -0
- {orionis-0.50.0/orionis/luminate/services/config → orionis-0.54.0/orionis/luminate/services/files}/__init__.py +0 -0
- {orionis-0.50.0/orionis/luminate/services/files → orionis-0.54.0/orionis/luminate/services/log}/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/services/log/log_service.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/support/dot_dict.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/support/exception_to_dict.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/support/reflection.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/support/std.py +0 -0
- {orionis-0.50.0/orionis/luminate/services/log → orionis-0.54.0/orionis/luminate/test}/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/test/exception.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/test/unit_test.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/static/ascii/icon.ascii +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/static/ascii/info.ascii +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/static/bg/galaxy.jpg +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/static/favicon/OrionisFrameworkFavicon.png +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/static/logos/OrionisFramework.jpg +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/static/logos/OrionisFramework.png +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/static/logos/OrionisFramework.psd +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/static/logos/OrionisFramework2.png +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis/static/logos/OrionisFramework3.png +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis.egg-info/dependency_links.txt +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis.egg-info/entry_points.txt +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis.egg-info/requires.txt +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/orionis.egg-info/top_level.txt +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/setup.cfg +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/setup.py +0 -0
- {orionis-0.50.0/orionis/luminate/test → orionis-0.54.0/tests}/__init__.py +0 -0
- {orionis-0.50.0/tests → orionis-0.54.0/tests/tools}/__init__.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/tests/tools/class_example.py +0 -0
- {orionis-0.50.0 → orionis-0.54.0}/tests/tools/test_reflection.py +0 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
from orionis.luminate.container.container import Container
|
2
|
+
from orionis.luminate.bootstrap.config_bootstrapper import ConfigBootstrapper
|
3
|
+
from orionis.luminate.patterns.singleton import SingletonMeta
|
4
|
+
|
5
|
+
class Application(metaclass=SingletonMeta):
|
6
|
+
|
7
|
+
def __init__(self):
|
8
|
+
self.container = Container()
|
9
|
+
self.container.instance(self.container)
|
10
|
+
self._bootstraping()
|
11
|
+
|
12
|
+
def _bootstraping(self):
|
13
|
+
config_bootstrapper = self.container.singleton(ConfigBootstrapper)
|
14
|
+
config = self.container.make(config_bootstrapper)
|
15
|
+
print(config)
|
16
|
+
|
17
|
+
def isBooted(self):
|
18
|
+
return True
|
@@ -1,19 +1,61 @@
|
|
1
1
|
import os
|
2
|
+
import threading
|
2
3
|
from pathlib import Path
|
3
4
|
from dotenv import set_key, unset_key, dotenv_values
|
4
|
-
from orionis.contracts.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
from orionis.contracts.facades.environment.i_environment_facade import IEnv
|
6
|
+
|
7
|
+
def env(key: str, default=None) -> str:
|
8
|
+
"""
|
9
|
+
Retrieves the value of an environment variable.
|
10
|
+
|
11
|
+
This function provides a convenient way to access environment variables
|
12
|
+
stored in the application context. If the variable does not exist, it
|
13
|
+
returns the specified default value.
|
14
|
+
|
15
|
+
Parameters
|
16
|
+
----------
|
17
|
+
key : str
|
18
|
+
The name of the environment variable to retrieve.
|
19
|
+
default : Any, optional
|
20
|
+
The default value to return if the environment variable does not exist.
|
21
|
+
Defaults to None.
|
22
|
+
|
23
|
+
Returns
|
24
|
+
-------
|
25
|
+
str
|
26
|
+
The value of the environment variable, or the default value if the variable
|
27
|
+
does not exist.
|
28
|
+
"""
|
29
|
+
return Environment().get(key, default)
|
30
|
+
|
31
|
+
class Environment(IEnv):
|
32
|
+
"""
|
33
|
+
A thread-safe singleton class that manages environment variables from a .env file.
|
34
|
+
"""
|
35
|
+
|
36
|
+
_instance = None
|
37
|
+
_lock = threading.Lock()
|
38
|
+
|
39
|
+
def __new__(cls, path: str = None):
|
10
40
|
"""
|
11
|
-
|
41
|
+
Override the __new__ method to ensure only one instance of the class is created.
|
12
42
|
|
13
|
-
|
14
|
-
|
43
|
+
Parameters
|
44
|
+
----------
|
45
|
+
path : str, optional
|
46
|
+
The path to the .env file. Defaults to None.
|
47
|
+
|
48
|
+
Returns
|
49
|
+
-------
|
50
|
+
Environment
|
51
|
+
The singleton instance of the Environment class.
|
15
52
|
"""
|
16
|
-
|
53
|
+
# Use the lock to ensure thread-safe instantiation
|
54
|
+
with cls._lock:
|
55
|
+
if cls._instance is None:
|
56
|
+
cls._instance = super().__new__(cls)
|
57
|
+
cls._instance._initialize(path)
|
58
|
+
return cls._instance
|
17
59
|
|
18
60
|
def _initialize(self, path: str = None):
|
19
61
|
"""
|
@@ -25,7 +67,6 @@ class Environment(IEnvironment, metaclass=SingletonMeta):
|
|
25
67
|
path : str, optional
|
26
68
|
Path to the .env file. Defaults to None.
|
27
69
|
"""
|
28
|
-
|
29
70
|
# Set the path to the .env file
|
30
71
|
self.path = Path(path) if path else Path(os.getcwd()) / ".env"
|
31
72
|
|
@@ -50,7 +91,6 @@ class Environment(IEnvironment, metaclass=SingletonMeta):
|
|
50
91
|
str
|
51
92
|
The value of the environment variable or the default value.
|
52
93
|
"""
|
53
|
-
|
54
94
|
# Get the value from the .env file
|
55
95
|
value = dotenv_values(self.path).get(key)
|
56
96
|
|
@@ -68,7 +108,6 @@ class Environment(IEnvironment, metaclass=SingletonMeta):
|
|
68
108
|
value : str
|
69
109
|
The value to set.
|
70
110
|
"""
|
71
|
-
|
72
111
|
# Set the value in the .env file
|
73
112
|
set_key(str(self.path), key, value)
|
74
113
|
|
@@ -81,7 +120,6 @@ class Environment(IEnvironment, metaclass=SingletonMeta):
|
|
81
120
|
key : str
|
82
121
|
The key of the environment variable to remove.
|
83
122
|
"""
|
84
|
-
|
85
123
|
# Remove the key from the .env file
|
86
124
|
unset_key(str(self.path), key)
|
87
125
|
|
@@ -94,6 +132,5 @@ class Environment(IEnvironment, metaclass=SingletonMeta):
|
|
94
132
|
dict
|
95
133
|
A dictionary of all environment variables and their values.
|
96
134
|
"""
|
97
|
-
|
98
135
|
# Return all environment variables
|
99
136
|
return dotenv_values(self.path)
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import os
|
2
2
|
from orionis.contracts.facades.files.i_path_facade import IPath
|
3
|
-
from orionis.luminate.app_context import AppContext
|
4
3
|
from orionis.luminate.services.files.path_service import PathService
|
5
4
|
|
6
5
|
class Path(IPath):
|
@@ -66,9 +65,7 @@ class Path(IPath):
|
|
66
65
|
route = os.path.normpath(route)
|
67
66
|
|
68
67
|
# Obtain the path service from the container
|
69
|
-
|
70
|
-
path_service : PathService = app.container.make(PathService)
|
71
|
-
return path_service.resolve(route)
|
68
|
+
PathService().resolve(route)
|
72
69
|
|
73
70
|
@staticmethod
|
74
71
|
def app(file: str = None):
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import os
|
2
|
+
import threading
|
2
3
|
from pathlib import Path
|
3
4
|
from orionis.contracts.services.files.i_path_service import IPathService
|
4
5
|
|
5
6
|
class PathService(IPathService):
|
6
7
|
"""
|
7
|
-
A
|
8
|
+
A thread-safe singleton class for resolving and validating absolute paths.
|
8
9
|
|
9
10
|
This class resolves the absolute path for a given relative directory or file path
|
10
11
|
based on the script's execution directory. It ensures that the requested path is valid
|
@@ -12,29 +13,37 @@ class PathService(IPathService):
|
|
12
13
|
|
13
14
|
Attributes
|
14
15
|
----------
|
16
|
+
base_path : Path
|
17
|
+
The base path (current working directory) used for resolving relative paths.
|
15
18
|
route : str
|
16
19
|
The resolved absolute path to the directory or file.
|
17
|
-
|
18
|
-
Methods
|
19
|
-
-------
|
20
|
-
__init__(route: str)
|
21
|
-
Initializes the `PathService` and resolves the absolute path.
|
22
|
-
resolve() -> str
|
23
|
-
Returns the resolved absolute path as a string.
|
24
|
-
__str__() -> str
|
25
|
-
Returns the resolved absolute path as a string (dunder method).
|
26
20
|
"""
|
27
21
|
|
28
|
-
|
22
|
+
_instance = None
|
23
|
+
_lock = threading.Lock()
|
24
|
+
|
25
|
+
def __new__(cls):
|
26
|
+
"""
|
27
|
+
Override the __new__ method to ensure only one instance of the class is created.
|
28
|
+
|
29
|
+
Returns
|
30
|
+
-------
|
31
|
+
PathService
|
32
|
+
The singleton instance of the PathService class.
|
29
33
|
"""
|
30
|
-
|
34
|
+
# Use the lock to ensure thread-safe instantiation
|
35
|
+
with cls._lock:
|
36
|
+
if cls._instance is None:
|
37
|
+
cls._instance = super().__new__(cls)
|
38
|
+
cls._instance._initialize()
|
39
|
+
return cls._instance
|
31
40
|
|
32
|
-
|
33
|
-
|
41
|
+
def _initialize(self):
|
42
|
+
"""
|
43
|
+
Initializes the instance by setting the base path to the current working directory.
|
34
44
|
"""
|
35
45
|
self.base_path = Path(os.getcwd())
|
36
46
|
|
37
|
-
|
38
47
|
def resolve(self, route: str) -> str:
|
39
48
|
"""
|
40
49
|
Resolves and returns the absolute path as a string.
|
@@ -58,7 +67,6 @@ class PathService(IPathService):
|
|
58
67
|
ValueError
|
59
68
|
If the resolved path does not exist or is neither a directory nor a file.
|
60
69
|
"""
|
61
|
-
|
62
70
|
# Combine base path with the relative route
|
63
71
|
real_path = (self.base_path / route).resolve()
|
64
72
|
|
@@ -68,4 +76,16 @@ class PathService(IPathService):
|
|
68
76
|
if not (real_path.is_dir() or real_path.is_file()):
|
69
77
|
raise ValueError(f"The requested path is neither a directory nor a file: {real_path}")
|
70
78
|
|
71
|
-
self.route = str(real_path)
|
79
|
+
self.route = str(real_path)
|
80
|
+
return self.route
|
81
|
+
|
82
|
+
def __str__(self) -> str:
|
83
|
+
"""
|
84
|
+
Returns the resolved absolute path as a string (dunder method).
|
85
|
+
|
86
|
+
Returns
|
87
|
+
-------
|
88
|
+
str
|
89
|
+
The absolute path to the directory or file.
|
90
|
+
"""
|
91
|
+
return self.route
|
@@ -56,7 +56,6 @@ orionis/contracts/services/files/__init__.py
|
|
56
56
|
orionis/contracts/services/files/i_path_service.py
|
57
57
|
orionis/contracts/services/log/__init__.py
|
58
58
|
orionis/contracts/services/log/i_log_service.py
|
59
|
-
orionis/contracts/support/i_environment.py
|
60
59
|
orionis/contracts/support/i_exception_to_dict.py
|
61
60
|
orionis/contracts/support/i_reflection.py
|
62
61
|
orionis/contracts/support/i_std.py
|
@@ -79,7 +78,6 @@ orionis/luminate/config/cache.py
|
|
79
78
|
orionis/luminate/config/cors.py
|
80
79
|
orionis/luminate/config/database.py
|
81
80
|
orionis/luminate/config/filesystems.py
|
82
|
-
orionis/luminate/config/helpers.py
|
83
81
|
orionis/luminate/config/logging.py
|
84
82
|
orionis/luminate/config/mail.py
|
85
83
|
orionis/luminate/config/queue.py
|
@@ -127,8 +125,6 @@ orionis/luminate/pipelines/cli_pipeline.py
|
|
127
125
|
orionis/luminate/providers/__init__.py
|
128
126
|
orionis/luminate/providers/config/__init__.py
|
129
127
|
orionis/luminate/providers/config/config_service_provider.py
|
130
|
-
orionis/luminate/providers/files/__init__.py
|
131
|
-
orionis/luminate/providers/files/path_service_provider.py
|
132
128
|
orionis/luminate/providers/log/__init__.py
|
133
129
|
orionis/luminate/providers/log/log_service_provider.py
|
134
130
|
orionis/luminate/services/__init__.py
|
@@ -139,7 +135,6 @@ orionis/luminate/services/files/path_service.py
|
|
139
135
|
orionis/luminate/services/log/__init__.py
|
140
136
|
orionis/luminate/services/log/log_service.py
|
141
137
|
orionis/luminate/support/dot_dict.py
|
142
|
-
orionis/luminate/support/environment.py
|
143
138
|
orionis/luminate/support/exception_to_dict.py
|
144
139
|
orionis/luminate/support/reflection.py
|
145
140
|
orionis/luminate/support/std.py
|
@@ -1,40 +0,0 @@
|
|
1
|
-
|
2
|
-
from abc import ABC, abstractmethod
|
3
|
-
|
4
|
-
class IEnv(ABC):
|
5
|
-
"""
|
6
|
-
A facade class for accessing environment variables.
|
7
|
-
|
8
|
-
This class provides a static method to retrieve environment variables
|
9
|
-
stored in the application context. It implements the `IEnv` interface.
|
10
|
-
|
11
|
-
Methods
|
12
|
-
-------
|
13
|
-
get(key: str, default=None) -> str
|
14
|
-
Retrieves the value of an environment variable.
|
15
|
-
"""
|
16
|
-
|
17
|
-
@abstractmethod
|
18
|
-
def get(key: str, default=None) -> str:
|
19
|
-
"""
|
20
|
-
Retrieves the value of an environment variable.
|
21
|
-
|
22
|
-
This method provides a convenient way to access environment variables
|
23
|
-
stored in the application context. If the variable does not exist, it
|
24
|
-
returns the specified default value.
|
25
|
-
|
26
|
-
Parameters
|
27
|
-
----------
|
28
|
-
key : str
|
29
|
-
The name of the environment variable to retrieve.
|
30
|
-
default : Any, optional
|
31
|
-
The default value to return if the environment variable does not exist.
|
32
|
-
Defaults to None.
|
33
|
-
|
34
|
-
Returns
|
35
|
-
-------
|
36
|
-
str
|
37
|
-
The value of the environment variable, or the default value if the variable
|
38
|
-
does not exist.
|
39
|
-
"""
|
40
|
-
pass
|
@@ -1,103 +0,0 @@
|
|
1
|
-
import traceback
|
2
|
-
from orionis.luminate.container.container import Container
|
3
|
-
from orionis.luminate.bootstrap.config_bootstrapper import Bootstrapper as BootstrapperConfig
|
4
|
-
from orionis.luminate.patterns.singleton import SingletonMeta
|
5
|
-
|
6
|
-
class Application(metaclass=SingletonMeta):
|
7
|
-
"""
|
8
|
-
The main service container for the Orionis Framework, ensuring persistent dependency resolution.
|
9
|
-
|
10
|
-
This class acts as a singleton service container, similar to Laravel's Application class.
|
11
|
-
It maintains service bindings, ensures proper initialization, and prevents unnecessary re-instantiation.
|
12
|
-
|
13
|
-
Attributes
|
14
|
-
----------
|
15
|
-
container : Container
|
16
|
-
The IoC container that holds all service bindings.
|
17
|
-
booted : bool
|
18
|
-
Indicates whether the application has been initialized.
|
19
|
-
error_info : tuple or None
|
20
|
-
Stores error information if an exception occurs during boot.
|
21
|
-
|
22
|
-
Methods
|
23
|
-
-------
|
24
|
-
boot()
|
25
|
-
Initializes the application and registers all necessary dependencies.
|
26
|
-
isBooted()
|
27
|
-
Checks if the application is currently running.
|
28
|
-
getError()
|
29
|
-
Retrieves stored error information, if any.
|
30
|
-
"""
|
31
|
-
|
32
|
-
def __init__(self):
|
33
|
-
"""Initializes the application with an empty dependency container."""
|
34
|
-
self.container = Container()
|
35
|
-
self.booted = False
|
36
|
-
self.error_info = None
|
37
|
-
|
38
|
-
self._config = {}
|
39
|
-
|
40
|
-
def register(self):
|
41
|
-
"""
|
42
|
-
Registers all necessary service bindings with the application container.
|
43
|
-
|
44
|
-
This method is intended to be overridden by the user to define custom service bindings.
|
45
|
-
"""
|
46
|
-
pass
|
47
|
-
|
48
|
-
def boot(self):
|
49
|
-
"""
|
50
|
-
Boots the application and registers necessary dependencies.
|
51
|
-
|
52
|
-
This method ensures that all required services are bound to the container and instantiated.
|
53
|
-
If the application is already booted, it returns immediately.
|
54
|
-
|
55
|
-
Returns
|
56
|
-
-------
|
57
|
-
Application
|
58
|
-
The current instance of the application.
|
59
|
-
|
60
|
-
Raises
|
61
|
-
------
|
62
|
-
Exception
|
63
|
-
If an error occurs during the boot process.
|
64
|
-
"""
|
65
|
-
if self.booted:
|
66
|
-
return self
|
67
|
-
|
68
|
-
try:
|
69
|
-
# Config Bootstrapper and retrieve application configuration
|
70
|
-
boot_config = self.container.singleton(BootstrapperConfig)
|
71
|
-
app_config = self.container.make(boot_config)
|
72
|
-
self._config = app_config.get()
|
73
|
-
|
74
|
-
self.booted = True
|
75
|
-
return self
|
76
|
-
|
77
|
-
except Exception as e:
|
78
|
-
# Capture and store exception details
|
79
|
-
self.error_info = (e, traceback.format_exc())
|
80
|
-
raise
|
81
|
-
|
82
|
-
def isBooted(self):
|
83
|
-
"""
|
84
|
-
Checks if the application has been successfully initialized.
|
85
|
-
|
86
|
-
Returns
|
87
|
-
-------
|
88
|
-
bool
|
89
|
-
True if the application has been booted, False otherwise.
|
90
|
-
"""
|
91
|
-
return self.booted
|
92
|
-
|
93
|
-
def getError(self):
|
94
|
-
"""
|
95
|
-
Retrieves the last stored error details.
|
96
|
-
|
97
|
-
Returns
|
98
|
-
-------
|
99
|
-
tuple or None
|
100
|
-
A tuple containing the exception instance and its formatted traceback if an error occurred;
|
101
|
-
otherwise, None.
|
102
|
-
"""
|
103
|
-
return self.error_info
|
@@ -1,20 +0,0 @@
|
|
1
|
-
from orionis.luminate.support.environment import Environment
|
2
|
-
|
3
|
-
def env(key: str, default=None) -> str:
|
4
|
-
"""
|
5
|
-
Retrieves the value of an environment variable from the .env file
|
6
|
-
or from system environment variables if not found.
|
7
|
-
|
8
|
-
Parameters
|
9
|
-
----------
|
10
|
-
key : str
|
11
|
-
The key of the environment variable.
|
12
|
-
default : optional
|
13
|
-
Default value if the key does not exist. Defaults to None.
|
14
|
-
|
15
|
-
Returns
|
16
|
-
-------
|
17
|
-
str
|
18
|
-
The value of the environment variable or the default value.
|
19
|
-
"""
|
20
|
-
return Environment().get(key, default)
|
@@ -1,68 +0,0 @@
|
|
1
|
-
from orionis.contracts.facades.environment.i_environment_facade import IEnv
|
2
|
-
from orionis.luminate.app_context import AppContext
|
3
|
-
|
4
|
-
def env(key: str, default=None) -> str:
|
5
|
-
"""
|
6
|
-
Retrieves the value of an environment variable.
|
7
|
-
|
8
|
-
This function provides a convenient way to access environment variables
|
9
|
-
stored in the application context. If the variable does not exist, it
|
10
|
-
returns the specified default value.
|
11
|
-
|
12
|
-
Parameters
|
13
|
-
----------
|
14
|
-
key : str
|
15
|
-
The name of the environment variable to retrieve.
|
16
|
-
default : Any, optional
|
17
|
-
The default value to return if the environment variable does not exist.
|
18
|
-
Defaults to None.
|
19
|
-
|
20
|
-
Returns
|
21
|
-
-------
|
22
|
-
str
|
23
|
-
The value of the environment variable, or the default value if the variable
|
24
|
-
does not exist.
|
25
|
-
"""
|
26
|
-
with AppContext() as app:
|
27
|
-
env : dict = app._environment_vars
|
28
|
-
return env.get(key, default)
|
29
|
-
|
30
|
-
class Env(IEnv):
|
31
|
-
"""
|
32
|
-
A facade class for accessing environment variables.
|
33
|
-
|
34
|
-
This class provides a static method to retrieve environment variables
|
35
|
-
stored in the application context. It implements the `IEnv` interface.
|
36
|
-
|
37
|
-
Methods
|
38
|
-
-------
|
39
|
-
get(key: str, default=None) -> str
|
40
|
-
Retrieves the value of an environment variable.
|
41
|
-
"""
|
42
|
-
|
43
|
-
@staticmethod
|
44
|
-
def get(key: str, default=None) -> str:
|
45
|
-
"""
|
46
|
-
Retrieves the value of an environment variable.
|
47
|
-
|
48
|
-
This method provides a convenient way to access environment variables
|
49
|
-
stored in the application context. If the variable does not exist, it
|
50
|
-
returns the specified default value.
|
51
|
-
|
52
|
-
Parameters
|
53
|
-
----------
|
54
|
-
key : str
|
55
|
-
The name of the environment variable to retrieve.
|
56
|
-
default : Any, optional
|
57
|
-
The default value to return if the environment variable does not exist.
|
58
|
-
Defaults to None.
|
59
|
-
|
60
|
-
Returns
|
61
|
-
-------
|
62
|
-
str
|
63
|
-
The value of the environment variable, or the default value if the variable
|
64
|
-
does not exist.
|
65
|
-
"""
|
66
|
-
with AppContext() as app:
|
67
|
-
env : dict = app._environment_vars
|
68
|
-
return env.get(key, default)
|
@@ -1,26 +0,0 @@
|
|
1
|
-
from orionis.contracts.providers.i_service_provider import IServiceProvider
|
2
|
-
from orionis.luminate.container.container import Container
|
3
|
-
from orionis.luminate.services.files.path_service import PathService
|
4
|
-
|
5
|
-
class PathServiceProvider(IServiceProvider):
|
6
|
-
|
7
|
-
def register(self, container: Container) -> None:
|
8
|
-
"""
|
9
|
-
Registers services or bindings into the given container.
|
10
|
-
|
11
|
-
Args:
|
12
|
-
container (Container): The container to register services or bindings into.
|
13
|
-
"""
|
14
|
-
self.key_sp = container.singleton(PathService)
|
15
|
-
|
16
|
-
def boot(self, container: Container) -> None:
|
17
|
-
"""
|
18
|
-
Boot the service provider.
|
19
|
-
|
20
|
-
This method is intended to be overridden by subclasses to perform
|
21
|
-
any necessary bootstrapping or initialization tasks.
|
22
|
-
|
23
|
-
Args:
|
24
|
-
container (Container): The service container instance.
|
25
|
-
"""
|
26
|
-
container.make(self.key_sp)
|
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
|
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
|
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
|
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
|
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
|
{orionis-0.50.0 → orionis-0.54.0}/orionis/luminate/providers/config/config_service_provider.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
|
{orionis-0.50.0/orionis/luminate/services/log → orionis-0.54.0/orionis/luminate/test}/__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
|