Skip to content

Commit c0621b4

Browse files
committed
Simplify application configuration
1 parent 0d4fd0a commit c0621b4

File tree

2 files changed

+6
-39
lines changed

2 files changed

+6
-39
lines changed
Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,7 @@
11
option_settings:
22
aws:elasticbeanstalk:container:python:
3-
WSGIPath: application:app
3+
WSGIPath: application:application
44
aws:elasticbeanstalk:application:environment:
5-
ALLOWED_ORIGINS: "https://getgit789.github.io"
6-
PORT: "5000"
7-
aws:elasticbeanstalk:environment:process:default:
8-
HealthCheckPath: /health
9-
HealthCheckTimeout: 5
10-
HealthyThresholdCount: 3
11-
UnhealthyThresholdCount: 5
12-
MatcherHTTPCode: 200
13-
Port: 5000
14-
Protocol: HTTP
5+
PORT: "8000"
156
aws:elasticbeanstalk:environment:proxy:
167
ProxyServer: nginx
17-
aws:elasticbeanstalk:environment:
18-
LoadBalancerType: application
19-
ServiceRole: aws-elasticbeanstalk-service-role
20-
aws:autoscaling:launchconfiguration:
21-
IamInstanceProfile: aws-elasticbeanstalk-ec2-role
22-
aws:elbv2:listener:default:
23-
ListenerEnabled: true
24-
Protocol: HTTP
25-
DefaultProcess: default
26-
aws:elasticbeanstalk:healthreporting:system:
27-
SystemType: enhanced

application.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,19 @@
11
from fastapi import FastAPI
22
from fastapi.middleware.cors import CORSMiddleware
3-
from mangum import Mangum
43
from backend.app.main import app
54

65
# Update the application instance name to match the EB configuration
76
application = app
87

9-
# Add CORS middleware with specific origins
10-
origins = [
11-
"https://getgit789.github.io",
12-
"https://getgit789.github.io/python-interpreter-online/",
13-
"http://localhost:5000",
14-
"http://127.0.0.1:5000"
15-
]
16-
8+
# Add CORS middleware
179
application.add_middleware(
1810
CORSMiddleware,
19-
allow_origins=origins,
11+
allow_origins=["*"],
2012
allow_credentials=True,
2113
allow_methods=["*"],
22-
allow_headers=["*"],
23-
expose_headers=["*"],
24-
max_age=3600
14+
allow_headers=["*"]
2515
)
2616

27-
# Create handler for AWS Lambda
28-
handler = Mangum(application)
29-
3017
if __name__ == "__main__":
3118
import uvicorn
32-
uvicorn.run(application, host="0.0.0.0", port=80)
19+
uvicorn.run(application, host="0.0.0.0", port=8000)

0 commit comments

Comments
 (0)