modify: Docker 部署脚本更新
This commit is contained in:
@@ -64,8 +64,12 @@ async def lifespan(app: FastAPI):
|
||||
database_config = database.get(database_type, None)
|
||||
if database_config is None:
|
||||
raise ValueError("配置不存在")
|
||||
database_path = database.get("database_path", None)
|
||||
if database_path:
|
||||
Path(database_path).parent.mkdir(parents=True, exist_ok=True)
|
||||
engine_config = {k: v for k, v in database_config.items() if k != "database_path"}
|
||||
|
||||
engine = create_async_engine(database["url"], **database_config)
|
||||
engine = create_async_engine(database["url"], **engine_config)
|
||||
async_session_maker = async_sessionmaker(
|
||||
engine, class_=AsyncSession, expire_on_commit=False
|
||||
)
|
||||
|
||||
@@ -60,6 +60,7 @@ class Database(TypedDict, total=False):
|
||||
sqlite: DatabaseSqlite
|
||||
mysql: dict
|
||||
postgresql: dict
|
||||
database_path: str
|
||||
|
||||
|
||||
class Security(TypedDict):
|
||||
|
||||
@@ -134,6 +134,10 @@ def run_pyinstaller():
|
||||
"-m",
|
||||
"PyInstaller",
|
||||
"--onefile",
|
||||
"--noconfirm",
|
||||
"--optimize",
|
||||
"2",
|
||||
"--strip",
|
||||
"--name",
|
||||
"chongming",
|
||||
"--distpath",
|
||||
@@ -173,11 +177,7 @@ def run_pyinstaller():
|
||||
"--hidden-import",
|
||||
"diskcache",
|
||||
"--hidden-import",
|
||||
"passlib",
|
||||
"--hidden-import",
|
||||
"passlib.context",
|
||||
"--hidden-import",
|
||||
"passlib.handlers.bcrypt",
|
||||
"bcrypt",
|
||||
"--hidden-import",
|
||||
"sqlite_vfs",
|
||||
"--hidden-import",
|
||||
@@ -197,6 +197,10 @@ def run_pyinstaller():
|
||||
"-m",
|
||||
"PyInstaller",
|
||||
"--onefile",
|
||||
"--noconfirm",
|
||||
"--optimize",
|
||||
"2",
|
||||
"--strip",
|
||||
"--name",
|
||||
"chongming",
|
||||
"--distpath",
|
||||
@@ -236,11 +240,7 @@ def run_pyinstaller():
|
||||
"--hidden-import",
|
||||
"diskcache",
|
||||
"--hidden-import",
|
||||
"passlib",
|
||||
"--hidden-import",
|
||||
"passlib.context",
|
||||
"--hidden-import",
|
||||
"passlib.handlers.bcrypt",
|
||||
"bcrypt",
|
||||
"--hidden-import",
|
||||
"sqlite_vfs",
|
||||
"--hidden-import",
|
||||
@@ -309,9 +309,9 @@ async def init_database():
|
||||
database_config = database.get(database_type, None)
|
||||
if database_config is None:
|
||||
raise ValueError("配置不存在")
|
||||
|
||||
os.makedirs("./build/data", exist_ok=True)
|
||||
engine = create_async_engine(
|
||||
"sqlite+aiosqlite:///./build/database.db", **database_config
|
||||
"sqlite+aiosqlite:///./build/data/database.db", **database_config
|
||||
)
|
||||
async_session_maker = async_sessionmaker(
|
||||
engine, class_=AsyncSession, expire_on_commit=False
|
||||
|
||||
@@ -22,7 +22,8 @@ def generate_markdown_from_py_files(directory, output_file):
|
||||
or file.endswith(".ts")
|
||||
or file.endswith(".json")
|
||||
or file.endswith(".html")
|
||||
or file == "dockerfile"
|
||||
or file.endswith(".sh")
|
||||
or file == "Dockerfile"
|
||||
):
|
||||
file_path = os.path.join(root, file)
|
||||
if file == "output.md" or file == "package-lock.json":
|
||||
|
||||
Reference in New Issue
Block a user