nitpicks from vlad

This commit is contained in:
dni ⚡ 2022-12-05 12:28:26 +01:00
parent 04b67c3551
commit b4126e664b
2 changed files with 31 additions and 25 deletions

View File

@ -143,30 +143,36 @@ def register_startup(app: FastAPI):
# 2. setup admin settings
await check_admin_settings()
logger.info("Starting LNbits")
logger.info(f"Host: {settings.host}")
logger.info(f"Port: {settings.port}")
logger.info(f"Debug: {settings.debug}")
logger.info(f"Site title: {settings.lnbits_site_title}")
logger.info(f"Funding source: {settings.lnbits_backend_wallet_class}")
logger.info(f"Data folder: {settings.lnbits_data_folder}")
logger.info(f"Git version: {settings.lnbits_commit}")
db_url = settings.lnbits_database_url
database = (
"PostgreSQL"
if db_url and db_url.startswith("postgres://")
else "CockroachDB"
if db_url and db_url.startswith("cockroachdb://")
else "SQLite"
)
logger.info(f"Database: {database}")
logger.info(f"Service fee: {settings.lnbits_service_fee}")
log_server_info()
# 3. initialize funding source
await check_funding_source()
def log_server_info():
logger.info("Starting LNbits")
logger.info(f"Host: {settings.host}")
logger.info(f"Port: {settings.port}")
logger.info(f"Debug: {settings.debug}")
logger.info(f"Site title: {settings.lnbits_site_title}")
logger.info(f"Funding source: {settings.lnbits_backend_wallet_class}")
logger.info(f"Data folder: {settings.lnbits_data_folder}")
logger.info(f"Git version: {settings.lnbits_commit}")
logger.info(f"Database: {get_db_vendor_name()}")
logger.info(f"Service fee: {settings.lnbits_service_fee}")
def get_db_vendor_name():
db_url = settings.lnbits_database_url
return (
"PostgreSQL"
if db_url and db_url.startswith("postgres://")
else "CockroachDB"
if db_url and db_url.startswith("cockroachdb://")
else "SQLite"
)
def register_assets(app: FastAPI):
"""Serve each vendored asset separately or a bundle."""

View File

@ -19,8 +19,6 @@ from .helpers import (
url_for_vendored,
)
path = settings.lnbits_path
@click.command("migrate")
def db_migrate():
@ -38,15 +36,17 @@ def transpile_scss():
warnings.simplefilter("ignore")
from scss.compiler import compile_string # type: ignore
with open(os.path.join(path, "static/scss/base.scss")) as scss:
with open(os.path.join(path, "static/css/base.css"), "w") as css:
with open(os.path.join(settings.lnbits_path, "static/scss/base.scss")) as scss:
with open(
os.path.join(settings.lnbits_path, "static/css/base.css"), "w"
) as css:
css.write(compile_string(scss.read()))
def bundle_vendored():
for getfiles, outputpath in [
(get_js_vendored, os.path.join(path, "static/bundle.js")),
(get_css_vendored, os.path.join(path, "static/bundle.css")),
(get_js_vendored, os.path.join(settings.lnbits_path, "static/bundle.js")),
(get_css_vendored, os.path.join(settings.lnbits_path, "static/bundle.css")),
]:
output = ""
for path in getfiles():