Support root path from environment
This commit is contained in:
+8
-4
@@ -1,11 +1,14 @@
|
|||||||
|
import os
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
|
|
||||||
APP_NAME = "Python FastAPI Template"
|
APP_NAME = os.getenv("APP_NAME", "Python FastAPI Template")
|
||||||
APP_VERSION = "1.0.0"
|
APP_VERSION = os.getenv("APP_VERSION", "1.0.0")
|
||||||
|
ROOT_PATH = os.getenv("ROOT_PATH", "")
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title=APP_NAME,
|
title=APP_NAME,
|
||||||
version=APP_VERSION
|
version=APP_VERSION,
|
||||||
|
root_path=ROOT_PATH
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.get("/health")
|
@app.get("/health")
|
||||||
@@ -17,5 +20,6 @@ def version():
|
|||||||
return {
|
return {
|
||||||
"app": APP_NAME,
|
"app": APP_NAME,
|
||||||
"version": APP_VERSION,
|
"version": APP_VERSION,
|
||||||
"language": "python"
|
"language": "python",
|
||||||
|
"root_path": ROOT_PATH
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user