INNER CODE UNIT · Python
_cors_allowed_origins
evolution-foundation/evo-nexus · dashboard/backend/app.py:35
def _cors_allowed_origins():
raw = os.environ.get("CORS_ALLOWED_ORIGINS", "").strip()
if raw:
if raw == "*":
return "*"
origins = [origin.strip() for origin in re.split(r"[,\s]+", raw) if origin.strip()]
return origins or "*"
return "*" if not _is_production() else []
app = Flask(__name__, static_folder=None)
# Persist secret key so sessions survive restarts
_secret_key = os.environ.get("EVONEXUS_SECRET_KEY")
if not _secret_key:
if _is_production():
raise RuntimeError("EVONEXUS_SECRET_KEY must be set in production")
_key_file = WORKSPACE / "dashboard" / "data" / ".secret_key"
_key_file.parent.mkdir(parents=True, exist_ok=True)
if _key_file.exists():