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,6 +143,13 @@ def register_startup(app: FastAPI):
# 2. setup admin settings # 2. setup admin settings
await check_admin_settings() await check_admin_settings()
log_server_info()
# 3. initialize funding source
await check_funding_source()
def log_server_info():
logger.info("Starting LNbits") logger.info("Starting LNbits")
logger.info(f"Host: {settings.host}") logger.info(f"Host: {settings.host}")
logger.info(f"Port: {settings.port}") logger.info(f"Port: {settings.port}")
@ -151,20 +158,19 @@ def register_startup(app: FastAPI):
logger.info(f"Funding source: {settings.lnbits_backend_wallet_class}") logger.info(f"Funding source: {settings.lnbits_backend_wallet_class}")
logger.info(f"Data folder: {settings.lnbits_data_folder}") logger.info(f"Data folder: {settings.lnbits_data_folder}")
logger.info(f"Git version: {settings.lnbits_commit}") 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 db_url = settings.lnbits_database_url
database = ( return (
"PostgreSQL" "PostgreSQL"
if db_url and db_url.startswith("postgres://") if db_url and db_url.startswith("postgres://")
else "CockroachDB" else "CockroachDB"
if db_url and db_url.startswith("cockroachdb://") if db_url and db_url.startswith("cockroachdb://")
else "SQLite" else "SQLite"
) )
logger.info(f"Database: {database}")
logger.info(f"Service fee: {settings.lnbits_service_fee}")
# 3. initialize funding source
await check_funding_source()
def register_assets(app: FastAPI): def register_assets(app: FastAPI):

View File

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