sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #05718
Re: [Merge] ~thorsten-merten/maas-site-manager:MAASENG-1465-add-cors-middleware into maas-site-manager:main
Review: Needs Information
Diff comments:
> diff --git a/backend/msm/user_api/_setup.py b/backend/msm/user_api/_setup.py
> index 58b272f..37d99c8 100644
> --- a/backend/msm/user_api/_setup.py
> +++ b/backend/msm/user_api/_setup.py
> @@ -16,15 +17,31 @@ DEFAULT_DB_DSN = (
> + f"{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_HOST}/{POSTGRES_DB}"
> )
>
> +# TODO: make config dynamic and allow env vars
> +origins = [
> + "http://localhost",
why do you need port 80 here?
> + "http://127.0.0.1",
likewise
> + "http://localhost:8405",
> + "http://127.0.0.1:8405",
> +]
> +
>
> def create_app(db_dsn: str = DEFAULT_DB_DSN) -> FastAPI:
> db = Database(db_dsn)
> app = FastAPI(
> + title="MAAS Site Manager",
> name=PACKAGE.project_name,
> version=PACKAGE.version,
> on_startup=[db.connect],
> on_shutdown=[db.disconnect],
> )
> + app.add_middleware(
> + CORSMiddleware,
> + allow_origins=origins,
> + allow_credentials=True,
> + allow_methods=["*"],
> + allow_headers=["*"],
> + )
> app.state.db = db
> app.router.add_api_route("/", _base.root, methods=["GET"])
> app.router.add_api_route("/sites", _base.sites, methods=["GET"])
--
https://code.launchpad.net/~thorsten-merten/maas-site-manager/+git/maas-site-manager/+merge/438465
Your team MAAS Committers is subscribed to branch ~thorsten-merten/maas-site-manager:MAASENG-1465-add-cors-middleware.
References