Skip to content
Snippets Groups Projects
Verified Commit a5e6f903 authored by hanfi's avatar hanfi
Browse files

make CORS URLs configurable

parent d5bfaa73
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,9 @@ class Settings(BaseSettings):
# we may want use DSN validators from pydantic.
# but there are no sqlite validators?
database_url: str = "sqlite:///./paketshop.db"
backend_url: str = "http://localhost:8000"
customer_url: str = "http://localhost:3000"
worker_url: str = "http://localhost:3002"
class Config:
env_file = ".env"
......
......@@ -5,13 +5,14 @@ from fastapi.middleware.cors import CORSMiddleware
from sqlalchemy.orm import Session
from . import schemas, utils
from .config import settings
from .database import SessionLocal, create_database
create_database()
app = FastAPI()
origins = ["http://127.0.0.1:8000", "http://localhost:3000", "http://localhost:3002"]
origins = [settings.customer_url, settings.worker_url]
app.add_middleware(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment