- clean up
- origins
This commit is contained in:
1 parent
f6af594a8f
commit
5e345d20e5
8 files changed
+2104
-21
No files matched your search
+9
-1
@@ -1,7 +1,8 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from src.automations.manager import AutomationManager
|
||||
from src.env import ROOT_FOLDER
|
||||
from src.env import ROOT_FOLDER, ORIGIN
|
||||
from .routes import ping, automations
|
||||
|
||||
|
||||
@@ -18,6 +19,13 @@ def make_app(automation_mgr: AutomationManager) -> FastAPI:
|
||||
)
|
||||
else:
|
||||
print("WARN: could not find web folder")
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=ORIGIN,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
app.include_router(ping.router, prefix="/ping")
|
||||
app.include_router(automations.make_automation_router(automation_mgr), prefix="/automations")
|
||||
|
||||
|
||||
+3
-1
@@ -1,7 +1,9 @@
|
||||
from decouple import config
|
||||
from email.policy import default
|
||||
from decouple import config, Csv
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT_FOLDER = Path(__file__).parent.parent.absolute()
|
||||
BUILD_VERSION = config("BUILD_VERSION", "0.0.0")
|
||||
LOG_LEVEL = config("LOG_LEVEL", "INFO")
|
||||
ORIGIN = config("ORIGIN", cast=Csv(), default="*")
|
||||
Reference in new issue
Block a user