[WIP] Added installation to config
This commit is contained in:
11
app/api/config/actions/install.py
Normal file
11
app/api/config/actions/install.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
from sqlalchemy import create_engine
|
||||||
|
|
||||||
|
from ....schema.config.base import Base
|
||||||
|
from ....db.config.config import get_engine_configuration
|
||||||
|
|
||||||
|
def install():
|
||||||
|
engine_string, echo = get_engine_configuration()
|
||||||
|
engine = create_engine(engine_string, echo=echo)
|
||||||
|
metadata = Base.metadata(engine)
|
||||||
|
metadata.create_all()
|
||||||
|
return engine
|
||||||
@@ -1,2 +1,6 @@
|
|||||||
engine_string = "sqlite://"
|
import os
|
||||||
echo = True
|
|
||||||
|
def get_engine_configuration():
|
||||||
|
engine_string = os.getenv("DEV_URIA_BIBLIOGAME_DEBUG", False)
|
||||||
|
echo = os.getenv("DEV_URIA_BIBLIOGAME_CONFIG_DB", "sqlite://")
|
||||||
|
return (engine_string, echo)
|
||||||
Reference in New Issue
Block a user