orionis 0.421.0__py3-none-any.whl → 0.422.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orionis/metadata/framework.py +1 -1
- orionis/services/environment/contracts/{types.py → caster.py} +1 -29
- orionis/services/environment/core/dot_env.py +230 -142
- orionis/services/environment/dynamic/caster.py +902 -0
- orionis/services/environment/enums/{cast_type.py → value_type.py} +11 -10
- orionis/services/environment/key/key_generator.py +7 -15
- orionis/services/environment/validators/types.py +10 -10
- {orionis-0.421.0.dist-info → orionis-0.422.0.dist-info}/METADATA +1 -1
- {orionis-0.421.0.dist-info → orionis-0.422.0.dist-info}/RECORD +13 -15
- orionis/services/environment/dynamic/types.py +0 -577
- orionis/services/environment/serializer/__init__.py +0 -0
- orionis/services/environment/serializer/values.py +0 -21
- {orionis-0.421.0.dist-info → orionis-0.422.0.dist-info}/WHEEL +0 -0
- {orionis-0.421.0.dist-info → orionis-0.422.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.421.0.dist-info → orionis-0.422.0.dist-info}/top_level.txt +0 -0
- {orionis-0.421.0.dist-info → orionis-0.422.0.dist-info}/zip-safe +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from enum import Enum
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class EnvironmentValueType(Enum):
|
|
4
4
|
"""
|
|
5
5
|
Enum representing supported environment variable cast types.
|
|
6
6
|
|
|
@@ -31,12 +31,13 @@ class EnvCastType(Enum):
|
|
|
31
31
|
An enumeration member representing the desired cast type.
|
|
32
32
|
"""
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
BASE64 = 'base64' # Represents a base64 encoded type
|
|
35
|
+
PATH = 'path' # Represents a file system path
|
|
36
|
+
STR = 'str' # Represents a string type
|
|
37
|
+
INT = 'int' # Represents an integer type
|
|
38
|
+
FLOAT = 'float' # Represents a floating-point type
|
|
39
|
+
BOOL = 'bool' # Represents a boolean type
|
|
40
|
+
LIST = 'list' # Represents a list type
|
|
41
|
+
DICT = 'dict' # Represents a dictionary type
|
|
42
|
+
TUPLE = 'tuple' # Represents a tuple type
|
|
43
|
+
SET = 'set' # Represents a set type
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import os
|
|
2
|
-
import base64
|
|
3
2
|
|
|
4
3
|
class SecureKeyGenerator:
|
|
5
4
|
"""
|
|
@@ -14,24 +13,17 @@ class SecureKeyGenerator:
|
|
|
14
13
|
@staticmethod
|
|
15
14
|
def generate() -> str:
|
|
16
15
|
"""
|
|
17
|
-
Generates a secure random key and encodes it in
|
|
16
|
+
Generates a cryptographically secure random key and encodes it in hexadecimal format.
|
|
18
17
|
|
|
19
|
-
This method
|
|
20
|
-
|
|
21
|
-
prefixed with 'base64:'.
|
|
18
|
+
This method uses the operating system's cryptographic random number generator to
|
|
19
|
+
produce a 32-byte random value, which is then encoded as a hexadecimal string.
|
|
22
20
|
|
|
23
21
|
Returns
|
|
24
22
|
-------
|
|
25
23
|
str
|
|
26
|
-
A string
|
|
27
|
-
representation of a securely generated 32-byte random key.
|
|
24
|
+
A 64-character hexadecimal string representing a 32-byte secure random key.
|
|
28
25
|
"""
|
|
29
26
|
|
|
30
|
-
# Generate 32 bytes
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Encode the random bytes using base64 and decode to a UTF-8 string
|
|
34
|
-
encoded = base64.b64encode(key).decode('utf-8')
|
|
35
|
-
|
|
36
|
-
# Return the key in the required format
|
|
37
|
-
return f"base64:{encoded}"
|
|
27
|
+
# Generate 32 random bytes using a cryptographically secure RNG
|
|
28
|
+
# Encode the bytes as a hexadecimal string and return
|
|
29
|
+
return os.urandom(32).hex()
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import re
|
|
2
|
-
from typing import
|
|
3
|
-
from orionis.services.environment.enums.
|
|
2
|
+
from typing import Union
|
|
3
|
+
from orionis.services.environment.enums.value_type import EnvironmentValueType
|
|
4
4
|
from orionis.services.environment.exceptions.value import OrionisEnvironmentValueError
|
|
5
5
|
|
|
6
6
|
class __ValidateTypes:
|
|
7
7
|
|
|
8
|
-
def __call__(self, value: Union[str, int, float, bool, list, dict, tuple, set], type_hint: str |
|
|
8
|
+
def __call__(self, value: Union[str, int, float, bool, list, dict, tuple, set], type_hint: str | EnvironmentValueType = None) -> str:
|
|
9
9
|
|
|
10
10
|
# Ensure the value is a valid type.
|
|
11
11
|
if not isinstance(value, (str, int, float, bool, list, dict, tuple, set)):
|
|
@@ -14,23 +14,23 @@ class __ValidateTypes:
|
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
# If a type hint is provided, ensure it is valid.
|
|
17
|
-
if type_hint and not isinstance(type_hint, (str,
|
|
17
|
+
if type_hint and not isinstance(type_hint, (str, EnvironmentValueType)):
|
|
18
18
|
raise OrionisEnvironmentValueError(
|
|
19
|
-
f"Type hint must be a string or
|
|
19
|
+
f"Type hint must be a string or EnvironmentValueType, got {type(type_hint).__name__}."
|
|
20
20
|
)
|
|
21
21
|
|
|
22
|
-
# If type_hint is provided, convert it to a string if it's an
|
|
22
|
+
# If type_hint is provided, convert it to a string if it's an EnvironmentValueType.
|
|
23
23
|
if type_hint:
|
|
24
24
|
|
|
25
|
-
# If type_hint is a string, convert it to
|
|
25
|
+
# If type_hint is a string, convert it to EnvironmentValueType if valid.
|
|
26
26
|
if isinstance(type_hint, str):
|
|
27
27
|
try:
|
|
28
|
-
type_hint =
|
|
28
|
+
type_hint = EnvironmentValueType[type_hint.upper()].value
|
|
29
29
|
except KeyError:
|
|
30
30
|
raise OrionisEnvironmentValueError(
|
|
31
|
-
f"Invalid type hint: {type_hint}. Allowed types are {[e.value for e in
|
|
31
|
+
f"Invalid type hint: {type_hint}. Allowed types are: {[e.value for e in EnvironmentValueType]}"
|
|
32
32
|
)
|
|
33
|
-
elif isinstance(type_hint,
|
|
33
|
+
elif isinstance(type_hint, EnvironmentValueType):
|
|
34
34
|
type_hint = type_hint.value
|
|
35
35
|
|
|
36
36
|
# If no type hint is provided, use the type of the value.
|
|
@@ -187,7 +187,7 @@ orionis/foundation/providers/progress_bar_provider.py,sha256=WW3grNgH-yV2meSSTeO
|
|
|
187
187
|
orionis/foundation/providers/testing_provider.py,sha256=iJSN2RIChbYIL-1ue6vmPmDMCSrvERDkti4Er9MPiLA,1102
|
|
188
188
|
orionis/foundation/providers/workers_provider.py,sha256=kiQjQRyUEyiBX2zcbF_KmqRgvc7Bvxsvg5oMtIvYniM,1075
|
|
189
189
|
orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
190
|
-
orionis/metadata/framework.py,sha256=
|
|
190
|
+
orionis/metadata/framework.py,sha256=TN0bWAwI_0NXglzLrTW6uOK-Oq8T4PwkGoWeuBrZsUM,4960
|
|
191
191
|
orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
|
|
192
192
|
orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
193
193
|
orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -199,26 +199,24 @@ orionis/services/asynchrony/exceptions/exception.py,sha256=yAVsjZ2lLAoFgNIiMcOtC
|
|
|
199
199
|
orionis/services/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
200
200
|
orionis/services/environment/env.py,sha256=vKx9zO2DpUK089fL17qxQ4X4tLYzN3exGAKg3d-rp3c,2272
|
|
201
201
|
orionis/services/environment/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
202
|
+
orionis/services/environment/contracts/caster.py,sha256=f5OsgsUCu-cqjmfWF6fqyKmXocHZGIjZgXw7F7g05yw,1211
|
|
202
203
|
orionis/services/environment/contracts/env.py,sha256=7lezGxABAG63pEEvzAmHXgr9izBI6TCp05Trx_SRvc4,2054
|
|
203
|
-
orionis/services/environment/contracts/types.py,sha256=n0USxUblz0Ofbo1ef0hnGHGkuGjSiWk-SBWVPXv33mE,1994
|
|
204
204
|
orionis/services/environment/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
205
|
-
orionis/services/environment/core/dot_env.py,sha256=
|
|
205
|
+
orionis/services/environment/core/dot_env.py,sha256=1371GV5mxkBH4iPFHccBz9V-6JoZZfy_hSukqJWQjdE,14278
|
|
206
206
|
orionis/services/environment/dynamic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
207
|
-
orionis/services/environment/dynamic/
|
|
207
|
+
orionis/services/environment/dynamic/caster.py,sha256=8j1yVcOhdS3WTTgzc19CzmxZFWyY6vRVGT__76mU5JI,35040
|
|
208
208
|
orionis/services/environment/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
209
|
-
orionis/services/environment/enums/
|
|
209
|
+
orionis/services/environment/enums/value_type.py,sha256=C-JQGGz1GtdoggKG-rBykUm9lUTS2JmU232D8lWTB2Q,1302
|
|
210
210
|
orionis/services/environment/exceptions/__init__.py,sha256=YwLc8GsB0swlwu9T9Qt2vevaCoq5V2vmPUSlEUAqg2Q,199
|
|
211
211
|
orionis/services/environment/exceptions/exception.py,sha256=NnxWmgoSca7LXi7GLDa95HSBPKotFfy8u729d1OAmCc,479
|
|
212
212
|
orionis/services/environment/exceptions/value.py,sha256=Pe1qNHRrM9T0AzESN284CzA3GQYxzokfXPMOVqOTlyQ,475
|
|
213
213
|
orionis/services/environment/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
214
214
|
orionis/services/environment/helpers/functions.py,sha256=MtlDTA1W8KVJu0cohh4TsuPg8CPcnySf36cp9E9tpJI,595
|
|
215
215
|
orionis/services/environment/key/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
216
|
-
orionis/services/environment/key/key_generator.py,sha256=
|
|
217
|
-
orionis/services/environment/serializer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
218
|
-
orionis/services/environment/serializer/values.py,sha256=ERnQWgCAljhJ9pRSd-knnGD5i6ne5Ho-4bh93pgDtwY,364
|
|
216
|
+
orionis/services/environment/key/key_generator.py,sha256=uFHOPH0YtYU_vEG7Oc3a51O15QxZl1USD_KlYcS9SsQ,912
|
|
219
217
|
orionis/services/environment/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
220
218
|
orionis/services/environment/validators/key_name.py,sha256=heMQoMY4vF9sIYAlET7noTQz383daGPvJnJOb62nxFo,1577
|
|
221
|
-
orionis/services/environment/validators/types.py,sha256=
|
|
219
|
+
orionis/services/environment/validators/types.py,sha256=t3G-JlJz1jDcYKrS7iljBL2q3m-KpmcCFBGoQIhRtK0,2000
|
|
222
220
|
orionis/services/introspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
223
221
|
orionis/services/introspection/reflection.py,sha256=_Wdy8Wtt3RKXAqg9o5rvYa_Hyu-Z4674LKnNVg7u7pU,11467
|
|
224
222
|
orionis/services/introspection/abstract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -357,7 +355,7 @@ orionis/test/validators/web_report.py,sha256=-h3Fe9jY93_kzUhd2NBIqEfCcBpu-8Ei9x3
|
|
|
357
355
|
orionis/test/validators/workers.py,sha256=LGffDKtK6SKixFKzIYPQpI5aFeQPAGXpv_LUtmEu6g4,1102
|
|
358
356
|
orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
359
357
|
orionis/test/view/render.py,sha256=3ICz68l-WF3BtnYqH5m-ktN9UD00MELMbmMnyJDV74A,4768
|
|
360
|
-
orionis-0.
|
|
358
|
+
orionis-0.422.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
|
361
359
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
362
360
|
tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
363
361
|
tests/container/test_container.py,sha256=asv8TkkupVoex6SWod74NBl4dSs7wb9mLmu_glNdNy8,14815
|
|
@@ -500,8 +498,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
500
498
|
tests/testing/validators/test_testing_validators.py,sha256=QdcF0Vhnnl_kD-PzceHJbUYOqwPTB1Td7YaTv8LTr30,19612
|
|
501
499
|
tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
502
500
|
tests/testing/view/test_render.py,sha256=-ghGG8rimyb2b2wtvMuSPPH7Zac5_NlVCiUcHRA5SNg,1172
|
|
503
|
-
orionis-0.
|
|
504
|
-
orionis-0.
|
|
505
|
-
orionis-0.
|
|
506
|
-
orionis-0.
|
|
507
|
-
orionis-0.
|
|
501
|
+
orionis-0.422.0.dist-info/METADATA,sha256=uT4PtXxf3WCmccOyQhLgYtP9EsMs9gWS1dq_RQnZwts,4772
|
|
502
|
+
orionis-0.422.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
503
|
+
orionis-0.422.0.dist-info/top_level.txt,sha256=0G1WIo0HbkZ6hNbKp6cdXLoKj1SfULEORhCuPIV_Dqw,26
|
|
504
|
+
orionis-0.422.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
505
|
+
orionis-0.422.0.dist-info/RECORD,,
|