refactor: add a simple config file to extensions

It makes possible to automagically keep the extensions admin page updated.
This commit is contained in:
Eneko Illarramendi
2020-02-18 20:27:04 +01:00
parent 792b787f1a
commit e5915bc493
5 changed files with 147 additions and 151 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
import os
import sqlite3
from .helpers import ExtensionManager
from .settings import LNBITS_PATH, LNBITS_DATA_FOLDER
@@ -50,8 +51,8 @@ def init_databases() -> None:
("database", os.path.join(LNBITS_PATH, "data", "schema.sql")),
]
for extension in [x[1] for x in os.walk(os.path.join(LNBITS_PATH, "extensions"))][0]:
schemas.append((f"ext_{extension}", os.path.join(LNBITS_PATH, "extensions", extension, "schema.sql")))
for extension in ExtensionManager().extensions:
schemas.append((f"ext_{extension.code}", os.path.join(extension.path, "schema.sql")))
for schema in [s for s in schemas if os.path.exists(s[1])]:
with open_db(schema[0]) as db: