recopytex/backend/config.py

17 lines
351 B
Python
Raw Normal View History

2022-12-28 06:47:35 +00:00
import os
import sqlite3
from backend.adapters.sqlite import create_db
def sqlite_conn(sqlite_file: str = ":memory"):
conn = sqlite3.connect(sqlite_file)
create_db(conn)
return conn
def get_api_url():
host = os.environ.get("API_HOST", "localhost")
port = 8000 if host == "localhost" else 80
return f"http://{host}:{port}"