add version to fastapi app and startup log (#1568)
* add version to fastapi app and startup log * move version into settings * remove unused dep
This commit is contained in:
parent
994b203a8e
commit
407a61cd29
|
@ -57,6 +57,7 @@ def create_app() -> FastAPI:
|
|||
app = FastAPI(
|
||||
title="LNbits API",
|
||||
description="API for LNbits, the free and open source bitcoin wallet and accounts system with plugins.",
|
||||
version=settings.version,
|
||||
license_info={
|
||||
"name": "MIT License",
|
||||
"url": "https://raw.githubusercontent.com/lnbits/lnbits/main/LICENSE",
|
||||
|
@ -305,6 +306,7 @@ def register_startup(app: FastAPI):
|
|||
|
||||
def log_server_info():
|
||||
logger.info("Starting LNbits")
|
||||
logger.info(f"Version: {settings.version}")
|
||||
logger.info(f"Baseurl: {settings.lnbits_baseurl}")
|
||||
logger.info(f"Host: {settings.host}")
|
||||
logger.info(f"Port: {settings.port}")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import importlib
|
||||
import importlib.metadata
|
||||
import inspect
|
||||
import json
|
||||
import subprocess
|
||||
|
@ -225,6 +226,7 @@ class EnvSettings(LNbitsSettings):
|
|||
lnbits_path: str = Field(default=".")
|
||||
lnbits_commit: str = Field(default="unknown")
|
||||
super_user: str = Field(default="")
|
||||
version: str = Field(default="0.0.0")
|
||||
|
||||
|
||||
class SaaSSettings(LNbitsSettings):
|
||||
|
@ -366,6 +368,7 @@ try:
|
|||
except:
|
||||
settings.lnbits_commit = "docker"
|
||||
|
||||
settings.version = importlib.metadata.version("lnbits")
|
||||
|
||||
# printing environment variable for debugging
|
||||
if not settings.lnbits_admin_ui:
|
||||
|
|
Loading…
Reference in New Issue
Block a user