SKIP IHDR and Clear at restart

This commit is contained in:
Zeecka
2025-12-31 16:25:54 +01:00
parent 3a9cf21c24
commit 5c5e63dbea
3 changed files with 17 additions and 4 deletions
+2
View File
@@ -2,6 +2,8 @@
MAX_CONTENT_LENGTH=1048576 MAX_CONTENT_LENGTH=1048576
MAX_PENDING_TIME=600 MAX_PENDING_TIME=600
MAX_STORE_TIME=259200 MAX_STORE_TIME=259200
CLEAR_AT_RESTART=1
SKIP_IHDR_FILL=1
# Flask configuration # Flask configuration
FLASK_DEBUG=0 FLASK_DEBUG=0
+11 -1
View File
@@ -5,6 +5,9 @@
import itertools import itertools
from datetime import datetime, timezone from datetime import datetime, timezone
from os import getenv
from pathlib import Path
from shutil import rmtree
from flask import Flask from flask import Flask
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
@@ -128,9 +131,16 @@ def init_db(app: Flask) -> None:
""" """
with app.app_context(): with app.app_context():
if not db.engine.dialect.has_table(db.engine.connect(), "image"): if not db.engine.dialect.has_table(db.engine.connect(), "image"):
print("Creating database...") print(f"CLEAR_AT_RESTART={getenv('CLEAR_AT_RESTART', '0')}")
if getenv("CLEAR_AT_RESTART", "0") == "1":
print("Clearing database and file system at restart...")
db.drop_all() # Clear existing tables if configured
rmtree(Path("./results"), ignore_errors=True) # Clear results folder
db.create_all() db.create_all()
print("Database structure created successfully.") print("Database structure created successfully.")
if getenv("SKIP_IHDR_FILL", "0") == "1":
print("Skipping IHDR lookup table fill as per configuration.")
else:
print("Filling IHDR lookup table...") print("Filling IHDR lookup table...")
create_crc_db() create_crc_db()
print("IHDR table filled successfully.") print("IHDR table filled successfully.")
+1
View File
@@ -22,6 +22,7 @@ services:
environment: environment:
- FLASK_DEBUG=true - FLASK_DEBUG=true
- FLASK_ENV=development - FLASK_ENV=development
- SKIP_IHDR_FILL=1
worker: worker:
#image: ghcr.io/zeecka/aperisolve:latest #image: ghcr.io/zeecka/aperisolve:latest