diff --git a/Dockerfile b/Dockerfile index fd09052..d2d13f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -80,4 +80,4 @@ VOLUME /config WORKDIR /config #ENTRYPOINT ["/init"] -CMD python -u /app/fanficdownload.py --config="/config/config.toml" --verbose=${VERBOSE} +CMD sh -c 'if [ "$VERBOSE" = "true" ]; then python -u /app/fanficdownload.py --config="/config/config.toml" --verbose; else python -u /app/fanficdownload.py --config="/config/config.toml"; fi' \ No newline at end of file diff --git a/root/app/ff_logging.py b/root/app/ff_logging.py index 8339690..21226e3 100644 --- a/root/app/ff_logging.py +++ b/root/app/ff_logging.py @@ -1,4 +1,6 @@ +import ctypes import datetime +from multiprocessing import Value class bcolors: @@ -27,7 +29,8 @@ class bcolors: "UNDERLINE": bcolors.UNDERLINE, } -verbose = False +# Initialize a shared variable for the verbose flag +verbose = Value(ctypes.c_bool, False) def set_verbose(value: bool) -> None: @@ -37,8 +40,7 @@ def set_verbose(value: bool) -> None: Args: value (bool): The value to set the verbose flag to. """ - global verbose - verbose = value + verbose.value = value def log(msg: str, color: str = None) -> None: