Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DataCatalog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eFlows4HPC WP2
DataCatalog
Commits
85c94f95
Commit
85c94f95
authored
3 years ago
by
Christian Boettcher
Browse files
Options
Downloads
Patches
Plain Diff
add cors to python backend
parent
7a64ed6a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#94996
passed
3 years ago
Stage: test
Stage: build
Stage: deploy
Stage: test-deployment
Stage: cleanup
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apiserver/main.py
+19
-0
19 additions, 0 deletions
apiserver/main.py
with
19 additions
and
0 deletions
apiserver/main.py
+
19
−
0
View file @
85c94f95
...
@@ -12,6 +12,7 @@ from fastapi import FastAPI, HTTPException, Request, status
...
@@ -12,6 +12,7 @@ from fastapi import FastAPI, HTTPException, Request, status
from
fastapi.param_functions
import
Depends
from
fastapi.param_functions
import
Depends
from
fastapi.responses
import
JSONResponse
from
fastapi.responses
import
JSONResponse
from
fastapi.security
import
OAuth2PasswordBearer
,
OAuth2PasswordRequestForm
from
fastapi.security
import
OAuth2PasswordBearer
,
OAuth2PasswordRequestForm
from
fastapi.middleware.cors
import
CORSMiddleware
from
pydantic
import
UUID4
from
pydantic
import
UUID4
from
starlette.responses
import
RedirectResponse
from
starlette.responses
import
RedirectResponse
...
@@ -40,6 +41,24 @@ app = FastAPI(
...
@@ -40,6 +41,24 @@ app = FastAPI(
title
=
"
API-Server for the Data Catalog
"
title
=
"
API-Server for the Data Catalog
"
)
)
origins
=
[
"
https://datacatalog.fz-juelich.de
"
,
"
https://datacatalogue.eflows4hpc.eu
"
,
"
https://zam10059.zam.kfa-juelich.de
"
,
"
https://zam10036.zam.kfa-juelich.de
"
,
"
http://datacatalog.fz-juelich.de
"
,
"
http://datacatalogue.eflows4hpc.eu
"
,
"
http://zam10059.zam.kfa-juelich.de
"
,
"
http://zam10036.zam.kfa-juelich.de
"
]
app
.
add_middleware
(
CORSMiddleware
,
allow_origins
=
origins
,
allow_credentials
=
True
,
allow_methods
=
[
"
*
"
],
allow_headers
=
[
"
*
"
]
)
# if env variable is set, get config .env filepath from it, else use default
# if env variable is set, get config .env filepath from it, else use default
dotenv_file_path
=
os
.
getenv
(
DOTENV_FILE_PATH_VARNAME
,
DOTENV_FILE_PATH_DEFAULT
)
dotenv_file_path
=
os
.
getenv
(
DOTENV_FILE_PATH_VARNAME
,
DOTENV_FILE_PATH_DEFAULT
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment