trying to fix tests

This commit is contained in:
dni ⚡ 2022-10-03 22:33:26 +02:00
parent d838f6806d
commit ec0375b47c
3 changed files with 11 additions and 17 deletions

View File

@ -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")

View File

@ -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

View File

@ -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 = ""