config: retrieve DATABASE_URL from environment vars
This commit is contained in:
parent
60079d64d2
commit
a5ef6f2017
2 changed files with 4 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
[env]
|
[env]
|
||||||
'_'.python.venv = { path = ".venv", create = true }
|
'_'.python.venv = { path = ".venv", create = true }
|
||||||
|
DATABASE_URL = "sqlite:///database.db"
|
||||||
|
|
||||||
[tools]
|
[tools]
|
||||||
markdownlint-cli2 = "latest"
|
markdownlint-cli2 = "latest"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
|
import os
|
||||||
from sqlmodel import SQLModel, create_engine
|
from sqlmodel import SQLModel, create_engine
|
||||||
|
|
||||||
sqlite_url = "sqlite:///database.db" # TODO: get url from environment
|
|
||||||
|
sqlite_url = os.environ.get("DATABASE_URL", "sqlite:///database.db")
|
||||||
engine = create_engine(sqlite_url, echo=True)
|
engine = create_engine(sqlite_url, echo=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue