update docker deployment and changing seed kandang name

This commit is contained in:
Alberto-Audrix committed 2026-08-31 11:10:32 +07:00
1 parent 76f4d0106a
commit 74dd3faf60
40 files changed
+1253 -122

No files matched your search

+24 -1
View File
@@ -2,6 +2,7 @@
from __future__ import annotations
import json
import os
from pathlib import Path
@@ -27,6 +28,14 @@ def env_list(key: str, default: str = "") -> list[str]:
return [item.strip() for item in raw.split(",") if item.strip()]
def env_json_dict(key: str, default: str = "") -> dict[str, int]:
raw = os.getenv(key, default)
if not raw:
return {}
data = json.loads(raw)
return {str(k): int(v) for k, v in data.items()}
SECRET_KEY = env("SECRET_KEY", "insecure-dev-key")
DEBUG = env_bool("DEBUG", True)
ALLOWED_HOSTS = env_list("ALLOWED_HOSTS", "localhost,127.0.0.1")
@@ -166,6 +175,9 @@ SPECTACULAR_SETTINGS = {
BOOTSTRAP_API_KEY = env("BOOTSTRAP_API_KEY", "") or ""
BOOTSTRAP_ADMIN_USER = env("BOOTSTRAP_ADMIN_USER", "admin") or "admin"
BOOTSTRAP_ADMIN_PASSWORD = env("BOOTSTRAP_ADMIN_PASSWORD", "") or ""
KARUNG_WEB_ADMIN_BASE_URL = (
env("KARUNG_WEB_ADMIN_BASE_URL", "http://127.0.0.1:5000") or ""
).rstrip("/")
@@ -174,4 +186,15 @@ KARUNG_WEB_ADMIN_TIMEOUT_SECONDS = float(
)
KARUNG_WEB_ADMIN_SYNC_ENABLED = env_bool("KARUNG_WEB_ADMIN_SYNC_ENABLED", False)
CRON_ADVANCE_CYCLE_DAY = env_bool("CRON_ADVANCE_CYCLE_DAY", True)
# Dashboard publish cutoff (WIB): day D visible from this time on day D.
DASHBOARD_PUBLISH_HOUR = int(env("DASHBOARD_PUBLISH_HOUR", "17") or "17")
DASHBOARD_PUBLISH_MINUTE = int(env("DASHBOARD_PUBLISH_MINUTE", "0") or "0")
# External IoT flocks API — panel sync every 10 minutes (real-time, not gated by publish cutoff).
IOT_API_BASE_URL = (env("IOT_API_BASE_URL", "https://dashboard.cpsp.id/api/iot/flocks") or "").rstrip("/")
IOT_API_SYNC_TIMEOUT_SECONDS = float(env("IOT_API_SYNC_TIMEOUT_SECONDS", "60") or "60")
IOT_SYNC_ENABLED = env_bool("IOT_SYNC_ENABLED", True)
IOT_SYNC_LOOKBACK_MINUTES = int(env("IOT_SYNC_LOOKBACK_MINUTES", "20") or "20")
IOT_SYNC_MAX_PAGES = int(env("IOT_SYNC_MAX_PAGES", "10") or "10")
# JSON map: external IoT flock_id -> Django flock.pk, e.g. {"686df69f407b21002da8750c": 1}
IOT_FLOCK_ID_MAP = env_json_dict("IOT_FLOCK_ID_MAP")