Skip to content

Commit

Permalink
disallow localhost in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
devksingh4 committed Jul 12, 2024
1 parent 709b541 commit 8056d6f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions code/util/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
import json
from decimal import Decimal

cors_config = CORSConfig(allow_origin="https://resumes.acm.illinois.edu", extra_origins=["http://localhost:5173"], max_age=300, allow_credentials=True, allow_headers=["authorization"])
RUN_ENV = get_run_environment()

extra_origins = []
if RUN_ENV != "prod":
extra_origins = ["http://localhost:5173"]

cors_config = CORSConfig(allow_origin="https://resumes.acm.illinois.edu", extra_origins=extra_origins, max_age=300, allow_credentials=True, allow_headers=["authorization"])
app = APIGatewayRestResolver(cors=cors_config)

session = boto3.Session(region_name=os.environ.get('AWS_REGION', 'us-east-1'))
dynamodb = session.client('dynamodb')

PROFILE_TABLE_NAME = "infra-resume-book-profile-data"
RUN_ENV = get_run_environment()
S3_BUCKET = f"infra-resume-book-pdfs-{RUN_ENV}"

@app.get("/api/v1/healthz")
Expand Down

0 comments on commit 8056d6f

Please sign in to comment.