feat: 增加 YAML 配置与一键启动脚本
This commit is contained in:
@@ -78,7 +78,10 @@ def verify_password(password: str, stored: str) -> tuple[bool, bool]:
|
||||
|
||||
|
||||
def _psycopg_url(database_url: str) -> str:
|
||||
return database_url.replace("postgresql+psycopg://", "postgresql://")
|
||||
sqlalchemy_prefix = "postgresql+psycopg://"
|
||||
if database_url.startswith(sqlalchemy_prefix):
|
||||
return f"postgresql://{database_url[len(sqlalchemy_prefix):]}"
|
||||
return database_url
|
||||
|
||||
|
||||
def _pg_sql(sql: str) -> str:
|
||||
@@ -1147,4 +1150,3 @@ def get_platform_store() -> PlatformStore:
|
||||
if _store is None:
|
||||
_store = PlatformStore()
|
||||
return _store
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from collections.abc import Generator
|
||||
from contextlib import contextmanager
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import Session, sessionmaker
|
||||
|
||||
from app.core.config import get_settings
|
||||
|
||||
DATABASE_URL = os.getenv("DATABASE_URL", "postgresql+psycopg://yg_ft:change_me@localhost:15432/yg_ft")
|
||||
|
||||
DATABASE_URL = get_settings().database_url
|
||||
|
||||
engine = create_engine(
|
||||
DATABASE_URL,
|
||||
@@ -37,4 +38,3 @@ def session_scope() -> Generator[Session, None, None]:
|
||||
raise
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user