mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-10 20:42:32 +02:00
trying to fix tests
This commit is contained in:
@@ -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 = ""
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user