diff --git a/lnbits/settings.py b/lnbits/settings.py index 53c1de1e..9194b17c 100644 --- a/lnbits/settings.py +++ b/lnbits/settings.py @@ -49,7 +49,7 @@ class Settings(BaseSettings): default=["classic", "flamingo", "mint", "salvador", "monochrome", "autumn"] ) lnbits_custom_logo: str = Field(default=None) - lnbits_ad_space: List[str] + lnbits_ad_space: List[str] = Field(default=[]) # ops lnbits_data_folder: str = Field(default="./data") diff --git a/tests/conftest.py b/tests/conftest.py index 46282f0c..37c691f3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -28,7 +28,7 @@ def app(event_loop): # use redefined version of the event loop for scope="session" # loop = asyncio.get_event_loop() loop = event_loop - loop.run_until_complete(migrate_databases()) + #loop.run_until_complete(migrate_databases()) yield app # # get the current event loop and gracefully stop any running tasks # loop = event_loop diff --git a/tools/conv.py b/tools/conv.py index 5084660f..9d8886a0 100644 --- a/tools/conv.py +++ b/tools/conv.py @@ -4,34 +4,28 @@ import sqlite3 from typing import List import psycopg2 -from environs import Env # type: ignore - -env = Env() -env.read_env() +from lnbits.settings import settings # Python script to migrate an LNbits SQLite DB to Postgres # All credits to @Fritz446 for the awesome work - # pip install psycopg2 OR psycopg2-binary - # Change these values as needed +sqfolder = settings.lnbits_data_folder +db_url = settings.lnbits_database_url -sqfolder = env.str("LNBITS_DATA_FOLDER", default=None) - -LNBITS_DATABASE_URL = env.str("LNBITS_DATABASE_URL", default=None) -if LNBITS_DATABASE_URL is None: +if db_url is None: print("missing LNBITS_DATABASE_URL") sys.exit(1) else: # parse postgres://lnbits:postgres@localhost:5432/lnbits - pgdb = LNBITS_DATABASE_URL.split("/")[-1] - pguser = LNBITS_DATABASE_URL.split("@")[0].split(":")[-2][2:] - pgpswd = LNBITS_DATABASE_URL.split("@")[0].split(":")[-1] - pghost = LNBITS_DATABASE_URL.split("@")[1].split(":")[0] - pgport = LNBITS_DATABASE_URL.split("@")[1].split(":")[1].split("/")[0] + pgdb = db_url.split("/")[-1] + pguser = db_url.split("@")[0].split(":")[-2][2:] + pgpswd = db_url.split("@")[0].split(":")[-1] + pghost = db_url.split("@")[1].split(":")[0] + pgport = db_url.split("@")[1].split(":")[1].split("/")[0] pgschema = ""