Disable bootstrap by default and document ENABLE_BOOTSTRAP
This commit is contained in:
13
main.py
13
main.py
@@ -24,6 +24,7 @@ ADMIN_PASSWORD = "batmannotmont"
|
||||
|
||||
app = Flask(__name__)
|
||||
app.secret_key = os.getenv("SECRET_KEY", "change-me-please")
|
||||
ENABLE_BOOTSTRAP = os.getenv("ENABLE_BOOTSTRAP", "0").strip().lower() in {"1", "true", "yes", "on"}
|
||||
|
||||
|
||||
def get_db() -> sqlite3.Connection:
|
||||
@@ -299,11 +300,11 @@ def init_db() -> None:
|
||||
pass
|
||||
|
||||
has_data = conn.execute("SELECT EXISTS(SELECT 1 FROM vendors)").fetchone()[0]
|
||||
if not has_data:
|
||||
if not has_data and ENABLE_BOOTSTRAP:
|
||||
seed_data(conn)
|
||||
|
||||
has_ib_data = conn.execute("SELECT EXISTS(SELECT 1 FROM ib_vendors)").fetchone()[0]
|
||||
if not has_ib_data:
|
||||
if not has_ib_data and ENABLE_BOOTSTRAP:
|
||||
ib_matrix = None
|
||||
from_xlsx = load_matrices_from_xlsx()
|
||||
if from_xlsx:
|
||||
@@ -311,9 +312,11 @@ def init_db() -> None:
|
||||
if not ib_matrix:
|
||||
ib_matrix = IB_MATRIX
|
||||
seed_ib_data(conn, ib_matrix)
|
||||
bootstrap_products_from_vendor_links(conn, "infra")
|
||||
bootstrap_products_from_vendor_links(conn, "ib")
|
||||
import_infra_products_from_json(conn)
|
||||
|
||||
if ENABLE_BOOTSTRAP:
|
||||
bootstrap_products_from_vendor_links(conn, "infra")
|
||||
bootstrap_products_from_vendor_links(conn, "ib")
|
||||
import_infra_products_from_json(conn)
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user