rb-commons 0.5.13__tar.gz → 0.5.15__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.
- {rb_commons-0.5.13 → rb_commons-0.5.15}/PKG-INFO +1 -1
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/configs/config.py +1 -1
- rb_commons-0.5.15/rb_commons/configs/v2/config.py +52 -0
- rb_commons-0.5.15/rb_commons/utils/__init__.py +0 -0
- rb_commons-0.5.15/rb_commons/utils/media.py +18 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons.egg-info/PKG-INFO +1 -1
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons.egg-info/SOURCES.txt +2 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/setup.py +1 -1
- rb_commons-0.5.13/rb_commons/utils/media.py +0 -9
- {rb_commons-0.5.13 → rb_commons-0.5.15}/README.md +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/__init__.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/broker/__init__.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/broker/consumer.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/configs/__init__.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/configs/injections.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/configs/rabbitmq.py +0 -0
- {rb_commons-0.5.13/rb_commons/http → rb_commons-0.5.15/rb_commons/configs/v2}/__init__.py +0 -0
- {rb_commons-0.5.13/rb_commons/orm → rb_commons-0.5.15/rb_commons/http}/__init__.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/http/base_api.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/http/consul.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/http/exceptions.py +0 -0
- {rb_commons-0.5.13/rb_commons/permissions → rb_commons-0.5.15/rb_commons/orm}/__init__.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/orm/exceptions.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/orm/managers.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/orm/services.py +0 -0
- {rb_commons-0.5.13/rb_commons/schemes → rb_commons-0.5.15/rb_commons/permissions}/__init__.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/permissions/role_permissions.py +0 -0
- {rb_commons-0.5.13/rb_commons/utils → rb_commons-0.5.15/rb_commons/schemes}/__init__.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/schemes/jwt.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons/schemes/pagination.py +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons.egg-info/dependency_links.txt +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons.egg-info/requires.txt +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/rb_commons.egg-info/top_level.txt +0 -0
- {rb_commons-0.5.13 → rb_commons-0.5.15}/setup.cfg +0 -0
@@ -1,5 +1,6 @@
|
|
1
1
|
from typing import Optional, Any
|
2
2
|
|
3
|
+
from pydantic import field_validator
|
3
4
|
from pydantic_settings import BaseSettings
|
4
5
|
|
5
6
|
class CommonConfigs(BaseSettings):
|
@@ -24,7 +25,6 @@ class CommonConfigs(BaseSettings):
|
|
24
25
|
DIGITALOCEAN_STORAGE_BUCKET_NAME: Optional[str] = None
|
25
26
|
DIGITALOCEAN_S3_ENDPOINT_URL: Optional[str] = None
|
26
27
|
|
27
|
-
|
28
28
|
@property
|
29
29
|
def database_url(self) -> Optional[str]:
|
30
30
|
"""Construct the database URL if all required fields are present."""
|
@@ -0,0 +1,52 @@
|
|
1
|
+
from typing import Optional, Any
|
2
|
+
|
3
|
+
from pydantic import field_validator
|
4
|
+
from pydantic_settings import BaseSettings
|
5
|
+
|
6
|
+
class CommonConfigs(BaseSettings):
|
7
|
+
service_name: Optional[str] = None
|
8
|
+
service_port: Optional[int] = None
|
9
|
+
service_id: Optional[str] = None
|
10
|
+
service_hostname: Optional[Any] = '127.0.0.1'
|
11
|
+
service_host: Optional[str] = None
|
12
|
+
|
13
|
+
# db
|
14
|
+
POSTGRES_HOST: Optional[str] = None
|
15
|
+
POSTGRES_USER: Optional[str] = None
|
16
|
+
POSTGRES_PORT: Optional[int] = None
|
17
|
+
POSTGRES_PASSWORD: Optional[str] = None
|
18
|
+
POSTGRES_DB: Optional[str] = None
|
19
|
+
DB_ALEMBIC_URL: Optional[str] = None
|
20
|
+
|
21
|
+
# Broker
|
22
|
+
|
23
|
+
RABBITMQ_URL: Optional[str] = None
|
24
|
+
|
25
|
+
DIGITALOCEAN_STORAGE_BUCKET_NAME: Optional[str] = None
|
26
|
+
DIGITALOCEAN_S3_ENDPOINT_URL: Optional[str] = None
|
27
|
+
|
28
|
+
@property
|
29
|
+
def database_url(self) -> Optional[str]:
|
30
|
+
"""Construct the database URL if all required fields are present."""
|
31
|
+
required_fields = [
|
32
|
+
self.POSTGRES_USER,
|
33
|
+
self.POSTGRES_PASSWORD,
|
34
|
+
self.POSTGRES_HOST,
|
35
|
+
self.POSTGRES_PORT,
|
36
|
+
self.POSTGRES_DB
|
37
|
+
]
|
38
|
+
if all(required_fields):
|
39
|
+
return (
|
40
|
+
f"postgresql+asyncpg://{self.POSTGRES_USER}:"
|
41
|
+
f"{self.POSTGRES_PASSWORD}@{self.POSTGRES_HOST}:"
|
42
|
+
f"{self.POSTGRES_PORT}/{self.POSTGRES_DB}"
|
43
|
+
)
|
44
|
+
return None
|
45
|
+
|
46
|
+
class Config:
|
47
|
+
env_file = "/robosell/.env"
|
48
|
+
env_file_encoding = "utf-8"
|
49
|
+
extra = "ignore"
|
50
|
+
|
51
|
+
|
52
|
+
configs = CommonConfigs()
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from pydantic import ValidationError
|
2
|
+
|
3
|
+
class MediaUtils:
|
4
|
+
|
5
|
+
@staticmethod
|
6
|
+
def url_builder(key: str):
|
7
|
+
try:
|
8
|
+
from rb_commons.configs.config import configs
|
9
|
+
DIGITALOCEAN_S3_ENDPOINT_URL = configs.DIGITALOCEAN_S3_ENDPOINT_URL
|
10
|
+
DIGITALOCEAN_STORAGE_BUCKET_NAME = configs.DIGITALOCEAN_STORAGE_BUCKET_NAME
|
11
|
+
except ValidationError as e:
|
12
|
+
from rb_commons.configs.v2.config import configs
|
13
|
+
DIGITALOCEAN_S3_ENDPOINT_URL = configs.DIGITALOCEAN_S3_ENDPOINT_URL
|
14
|
+
DIGITALOCEAN_STORAGE_BUCKET_NAME = configs.DIGITALOCEAN_STORAGE_BUCKET_NAME
|
15
|
+
|
16
|
+
return "{endpoint_url}/{bucket_name}/{key}" \
|
17
|
+
.format(endpoint_url=DIGITALOCEAN_S3_ENDPOINT_URL,
|
18
|
+
bucket_name=DIGITALOCEAN_STORAGE_BUCKET_NAME, key=key)
|
@@ -12,6 +12,8 @@ rb_commons/configs/__init__.py
|
|
12
12
|
rb_commons/configs/config.py
|
13
13
|
rb_commons/configs/injections.py
|
14
14
|
rb_commons/configs/rabbitmq.py
|
15
|
+
rb_commons/configs/v2/__init__.py
|
16
|
+
rb_commons/configs/v2/config.py
|
15
17
|
rb_commons/http/__init__.py
|
16
18
|
rb_commons/http/base_api.py
|
17
19
|
rb_commons/http/consul.py
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
5
5
|
|
6
6
|
setup(
|
7
7
|
name="rb-commons",
|
8
|
-
version="0.5.
|
8
|
+
version="0.5.15",
|
9
9
|
author="Abdulvoris",
|
10
10
|
author_email="erkinovabdulvoris101@gmail.com",
|
11
11
|
description="Commons of project and simplified orm based on sqlalchemy.",
|
@@ -1,9 +0,0 @@
|
|
1
|
-
from rb_commons.configs.config import configs
|
2
|
-
|
3
|
-
class MediaUtils:
|
4
|
-
|
5
|
-
@staticmethod
|
6
|
-
def url_builder(key: str):
|
7
|
-
return "{endpoint_url}/{bucket_name}/{key}" \
|
8
|
-
.format(endpoint_url=configs.DIGITALOCEAN_S3_ENDPOINT_URL,
|
9
|
-
bucket_name=configs.DIGITALOCEAN_STORAGE_BUCKET_NAME, key=key)
|
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
|
{rb_commons-0.5.13/rb_commons/schemes → rb_commons-0.5.15/rb_commons/permissions}/__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
|