File tree Expand file tree Collapse file tree 5 files changed +21
-2
lines changed
Expand file tree Collapse file tree 5 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ commands:
3333 - run :
3434 name : Install Test Dependencies
3535 command : pip install -r requirements.txt
36+ - run :
37+ name : Create ENV file
38+ command : env > .env
3639 package-lambda :
3740 description : " Packages the Python into a zip file."
3841 steps :
Original file line number Diff line number Diff line change 1+ from pydantic import BaseSettings
2+
3+
4+ class Settings (BaseSettings ):
5+ API_V1_STR : str = "/api/v1"
6+ PROJECT_NAME : str = "serverless-fastapi-lambda"
7+ SECRET_KEY : str
8+
9+
10+ class Config :
11+ case_sensitive = True
12+ env_file = ".env"
13+
14+ settings = Settings ()
Original file line number Diff line number Diff line change 11from fastapi import FastAPI
22
33from app .api .api_v1 .api import router as api_router
4+ from app .core .config import settings
45from mangum import Mangum
56
67app = FastAPI ()
78
89
910@app .get ("/" )
1011async def root ():
11- return {"message" : "Deployed with CircleCi! " }
12+ return {"message" : f"Secret Key: { settings . SECRET_KEY } " }
1213
1314
14- app .include_router (api_router , prefix = "/api/v1" )
15+ app .include_router (api_router , prefix = settings . API_V1_STR )
1516handler = Mangum (app )
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ MarkupSafe==1.1.1
2121orjson == 3.3.0
2222promise == 2.3
2323pydantic == 1.6.1
24+ python-dotenv == 0.14.0
2425python-multipart == 0.0.5
2526PyYAML == 5.3.1
2627requests == 2.24.0
You can’t perform that action at this time.
0 commit comments