Skip to content

Commit

Permalink
feat: use OS environment variables for hot reload
Browse files Browse the repository at this point in the history
  • Loading branch information
cofin committed Dec 13, 2023
1 parent 848bfdb commit 348fa65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

LITESTAR_APP=app.asgi:create_app
APP_SECRET_KEY='secret-key'
APP_ENVIRONMENT=docker
Expand All @@ -21,9 +20,13 @@ WORKER_WEB_ENABLED=True
WORKER_BACKGROUND_WORKERS=1
WORKER_CONCURRENCY=1


# MINIO
# ------------------------------------------------------------------------------

MINIO_ROOT_USER=minio
MINIO_ROOT_PASSWORD=minio

# VITE
VITE_HOST = "localhost"
VITE_PORT = 3006
VITE_HOT_RELOAD = false
7 changes: 5 additions & 2 deletions src/app/domain/plugins.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from litestar.contrib.pydantic import PydanticPlugin
from litestar_aiosql import AiosqlConfig, AiosqlPlugin
from litestar_saq import CronJob, QueueConfig, SAQConfig, SAQPlugin
Expand All @@ -13,9 +15,10 @@
resource_dir=settings.RESOURCES_DIR,
template_dir=settings.TEMPLATES_DIR,
dev_mode=settings.app.DEV_MODE,
hot_reload=True,
hot_reload=os.environ.get("VITE_HOT_RELOAD", None) not in {None, "no", "false", "False", "0"},
use_server_lifespan=True,
port=3006,
port=int(os.environ.get("VITE_PORT", 3006)),
host=os.environ.get("VITE_HOST", "localhost"),
),
)
saq = SAQPlugin(
Expand Down

0 comments on commit 348fa65

Please sign in to comment.