mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-29 21:32:38 +02:00
remove annoying warnings and unnecessary prints.
show a summary of some settings on startup when running __main__.py
This commit is contained in:
@@ -1,9 +1,21 @@
|
|||||||
from .app import create_app
|
from .app import create_app
|
||||||
from .commands import migrate_databases, transpile_scss, bundle_vendored
|
from .commands import migrate_databases, transpile_scss, bundle_vendored
|
||||||
|
from .settings import LNBITS_SITE_TITLE, SERVICE_FEE, DEBUG, LNBITS_DATA_FOLDER, WALLET
|
||||||
|
|
||||||
migrate_databases()
|
migrate_databases()
|
||||||
transpile_scss()
|
transpile_scss()
|
||||||
bundle_vendored()
|
bundle_vendored()
|
||||||
|
|
||||||
app = create_app()
|
app = create_app()
|
||||||
|
|
||||||
|
print(
|
||||||
|
f"""Starting LNbits with
|
||||||
|
- site title: {LNBITS_SITE_TITLE}
|
||||||
|
- debug: {DEBUG}
|
||||||
|
- data folder: {LNBITS_DATA_FOLDER}
|
||||||
|
- funding source: {WALLET.__class__.__name__}
|
||||||
|
- service fee: {SERVICE_FEE}
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
app.run(host=app.config["HOST"], port=app.config["PORT"])
|
app.run(host=app.config["HOST"], port=app.config["PORT"])
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import trio # type: ignore
|
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
from quart import g
|
from quart import g
|
||||||
@@ -112,9 +111,7 @@ def register_async_tasks(app):
|
|||||||
@app.before_serving
|
@app.before_serving
|
||||||
async def listeners():
|
async def listeners():
|
||||||
run_deferred_async(app.nursery)
|
run_deferred_async(app.nursery)
|
||||||
|
|
||||||
app.nursery.start_soon(invoice_listener)
|
app.nursery.start_soon(invoice_listener)
|
||||||
print("started global invoice_listener.")
|
|
||||||
|
|
||||||
@app.after_serving
|
@app.after_serving
|
||||||
async def stop_listeners():
|
async def stop_listeners():
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
|
import warnings
|
||||||
import click
|
import click
|
||||||
import importlib
|
import importlib
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
from scss.compiler import compile_string # type: ignore
|
|
||||||
|
|
||||||
from .core import migrations as core_migrations
|
from .core import migrations as core_migrations
|
||||||
from .db import open_db, open_ext_db
|
from .db import open_db, open_ext_db
|
||||||
from .helpers import get_valid_extensions, get_css_vendored, get_js_vendored, url_for_vendored
|
from .helpers import get_valid_extensions, get_css_vendored, get_js_vendored, url_for_vendored
|
||||||
@@ -24,9 +23,13 @@ def handle_assets():
|
|||||||
|
|
||||||
|
|
||||||
def transpile_scss():
|
def transpile_scss():
|
||||||
with open(os.path.join(LNBITS_PATH, "static/scss/base.scss")) as scss:
|
with warnings.catch_warnings():
|
||||||
with open(os.path.join(LNBITS_PATH, "static/css/base.css"), "w") as css:
|
warnings.simplefilter("ignore")
|
||||||
css.write(compile_string(scss.read()))
|
from scss.compiler import compile_string # type: ignore
|
||||||
|
|
||||||
|
with open(os.path.join(LNBITS_PATH, "static/scss/base.scss")) as scss:
|
||||||
|
with open(os.path.join(LNBITS_PATH, "static/css/base.css"), "w") as css:
|
||||||
|
css.write(compile_string(scss.read()))
|
||||||
|
|
||||||
|
|
||||||
def bundle_vendored():
|
def bundle_vendored():
|
||||||
|
@@ -67,7 +67,6 @@ def register_invoice_listener(send_chan: trio.MemorySendChannel):
|
|||||||
A method intended for extensions to call when they want to be notified about
|
A method intended for extensions to call when they want to be notified about
|
||||||
new invoice payments incoming.
|
new invoice payments incoming.
|
||||||
"""
|
"""
|
||||||
print(f"registering invoice_listener: {send_chan}")
|
|
||||||
invoice_listeners.append(send_chan)
|
invoice_listeners.append(send_chan)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user