Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ GATEWAY_KEY_TTL=2
RABBITMQ_URL=amqp://guest:guest@localhost:5672/

QUEUE_SECRECT_KEY='XXXXXXXXXXXXXXXXX'
QUEUE_SECRECT_KEY_TTL=0.5
QUEUE_SECRECT_KEY_TTL=0.5

CORS_ALLOWED_ORIGINS=http://localhost:3000, ...
3 changes: 3 additions & 0 deletions src/config/cors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from src.env import cors

CORS_ALLOWED_ORIGINS = cors["allowed_origins"]
1 change: 1 addition & 0 deletions src/config/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from src.env import app

from .apps import INSTALLED_APPS as INSTALLED_APPS
from .cors import CORS_ALLOWED_ORIGINS as CORS_ALLOWED_ORIGINS
from .caches import CACHES as CACHES
from .logger import LOGGING as LOGGING
from .databases import DATABASES as DATABASES
Expand Down
7 changes: 7 additions & 0 deletions src/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ class Queue(TypedDict):
ttl: float


class CORS(TypedDict):
allowed_origins: list[str]


env = Env()

app: App = {
Expand Down Expand Up @@ -126,10 +130,13 @@ class Queue(TypedDict):

rabbitmq_config: RabbitMQ = {"url": get_env_str("RABBITMQ_URL")}

cors: CORS = {"allowed_origins": get_env_list("CORS_ALLOWED_ORIGINS")}

__all__ = [
"api_gateway",
"app",
"cache",
"cors",
"db",
"env",
"jwt_config",
Expand Down
Loading