Skip to content

Commit 543fecb

Browse files
committed
feat: Added env var for allowing docs
1 parent c2e9501 commit 543fecb

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

app/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ class Settings(BaseSettings):
1010
VULN_DB_URI: str = ""
1111
VULN_DB_USER: str = ""
1212
VULN_DB_PASSWORD: str = ""
13-
ALLOWED_ORIGINS: list[str] = []
13+
DOCS_URL: str | None = None
14+
SERVICES_ALLOWED_ORIGINS: list[str] = []
1415
ALGORITHM: str = ""
1516
JWT_ACCESS_SECRET_KEY: str = ""
1617
GITHUB_GRAPHQL_API_KEY: str = ""

app/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from app.limiter import limiter
1616
from app.middleware import log_request_middleware
1717
from app.router import api_router
18+
from app.config import settings
1819

1920
DESCRIPTION = """
2021
Depex is a tool that allows you to reason over the entire configuration space of the Software Supply Chain of an open-source software repository.
@@ -27,6 +28,7 @@ async def lifespan(app: FastAPI):
2728

2829
app = FastAPI(
2930
title="Secure Chain Depex Tool",
31+
docs_url=settings.DOCS_URL,
3032
version="1.0.0",
3133
description=DESCRIPTION,
3234
contact={
@@ -45,7 +47,7 @@ async def lifespan(app: FastAPI):
4547
app.middleware("http")(log_request_middleware)
4648
app.add_middleware(
4749
CORSMiddleware,
48-
allow_origins=settings.ALLOWED_ORIGINS,
50+
allow_origins=settings.SERVICES_ALLOWED_ORIGINS,
4951
allow_credentials=True,
5052
allow_methods=["*"],
5153
allow_headers=["*"],

template.env

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# For dockerized backend and database
22
GRAPH_DB_URI='bolt://neo4j:7687'
33
VULN_DB_URI='mongodb://mongoSecureChain:mongoSecureChain@mongodb:27017/admin'
4-
ALLOWED_ORIGINS='["http://localhost:8000"]'
4+
DOCS_URL='/docs' # Comment this on production
55

66
# Databases settings
77
GRAPH_DB_USER='neo4j'
@@ -10,11 +10,12 @@ VULN_DB_USER='mongoSecureChain'
1010
VULN_DB_PASSWORD='mongoSecureChain'
1111

1212
# Secrets for JWT
13-
ALGORITHM = 'your_preferred_algorithm' # e.g., 'HS256'
14-
ACCESS_TOKEN_EXPIRE_MINUTES = 'access_token_expire_minutes'
15-
REFRESH_TOKEN_EXPIRE_DAYS = 'refresh_token_expire_days'
16-
JWT_ACCESS_SECRET_KEY = 'your_access_secret_key' # Need to be equal to the one in other services
17-
JWT_REFRESH_SECRET_KEY = 'your_refresh_secret_key'
13+
SECURE_COOKIES=False # Set to True in production
14+
ALGORITHM='your_preferred_algorithm' # e.g., 'HS256'
15+
ACCESS_TOKEN_EXPIRE_MINUTES='access_token_expire_minutes'
16+
REFRESH_TOKEN_EXPIRE_DAYS='refresh_token_expire_days'
17+
JWT_ACCESS_SECRET_KEY='your_access_secret_key'
18+
JWT_REFRESH_SECRET_KEY='your_refresh_secret_key'
1819

1920
# Api key for github services
2021
GITHUB_GRAPHQL_API_KEY='add_your_api_key'

0 commit comments

Comments
 (0)