From 6f194fe2f8efa13d67bfb5fd3e18d91d896699cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Tue, 28 Feb 2023 13:45:43 +0100 Subject: [PATCH] introduce baseurl and remove force_https (#1549) * introduce baseurl and remove force_https * calle's suggestions --- .env.example | 1 - docs/guide/installation.md | 2 +- lnbits/app.py | 1 + lnbits/core/services.py | 2 +- lnbits/core/templates/admin/_tab_server.html | 17 +---------------- lnbits/settings.py | 2 +- 6 files changed, 5 insertions(+), 20 deletions(-) diff --git a/.env.example b/.env.example index dd85b655c..83249c529 100644 --- a/.env.example +++ b/.env.example @@ -48,7 +48,6 @@ LNBITS_EXTENSIONS_DEFAULT_INSTALL="tpos" LNBITS_DATA_FOLDER="./data" # LNBITS_DATABASE_URL="postgres://user:password@host:port/databasename" -LNBITS_FORCE_HTTPS=false LNBITS_SERVICE_FEE="0.0" # value in millisats LNBITS_RESERVE_FEE_MIN=2000 diff --git a/docs/guide/installation.md b/docs/guide/installation.md index ccfbd692d..905e879a7 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -174,8 +174,8 @@ kill_timeout = 30 [env] HOST="127.0.0.1" PORT=5000 - LNBITS_FORCE_HTTPS=true FORWARDED_ALLOW_IPS="*" + LNBITS_BASEURL="https://mylnbits.lnbits.org/" LNBITS_DATA_FOLDER="/data" ${PUT_YOUR_LNBITS_ENV_VARS_HERE} diff --git a/lnbits/app.py b/lnbits/app.py index 6161d7646..a3f719ed5 100644 --- a/lnbits/app.py +++ b/lnbits/app.py @@ -283,6 +283,7 @@ def register_startup(app: FastAPI): def log_server_info(): logger.info("Starting LNbits") + logger.info(f"Baseurl: {settings.lnbits_baseurl}") logger.info(f"Host: {settings.host}") logger.info(f"Port: {settings.port}") logger.info(f"Debug: {settings.debug}") diff --git a/lnbits/core/services.py b/lnbits/core/services.py index b57883001..18dcbc9fb 100644 --- a/lnbits/core/services.py +++ b/lnbits/core/services.py @@ -437,7 +437,7 @@ async def check_admin_settings(): for key, value in settings.dict(exclude_none=True).items(): logger.debug(f"{key}: {value}") - admin_url = f"{'https' if settings.lnbits_force_https else 'http'}://{settings.host}:{settings.port}/wallet?usr={settings.super_user}" + admin_url = f"{settings.lnbits_baseurl}wallet?usr={settings.super_user}" logger.success(f"✔️ Access super user account at: {admin_url}") # callback for saas diff --git a/lnbits/core/templates/admin/_tab_server.html b/lnbits/core/templates/admin/_tab_server.html index 09abb8a1f..8562160be 100644 --- a/lnbits/core/templates/admin/_tab_server.html +++ b/lnbits/core/templates/admin/_tab_server.html @@ -33,22 +33,7 @@
-

Miscelaneous

- - - Force HTTPS - Prefer secure URLs - - - - - +

Miscellaneous

Hide API diff --git a/lnbits/settings.py b/lnbits/settings.py index 0f1036825..75c20a9ad 100644 --- a/lnbits/settings.py +++ b/lnbits/settings.py @@ -88,7 +88,7 @@ class ThemesSettings(LNbitsSettings): class OpsSettings(LNbitsSettings): - lnbits_force_https: bool = Field(default=False) + lnbits_baseurl: str = Field(default="http://127.0.0.1/") lnbits_reserve_fee_min: int = Field(default=2000) lnbits_reserve_fee_percent: float = Field(default=1.0) lnbits_service_fee: float = Field(default=0)