feat: auto disable debug on deploy

This commit is contained in:
2024-04-10 12:18:07 +02:00
parent f009bf7bb8
commit db8e54cd1c
6 changed files with 20 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ from pathlib import Path
import json
import logging
from .shared import DEBUG, DEBUG_LOGGING, DEBUG_DUMP
from .shared import DEBUG, DEBUG_LOGGING, DEBUG_DUMP, DEBUG_TRACE
from .config import config, read_config, write_config
from .enums.colors import BColors
from .path_manager import LOCATIONS
@@ -47,7 +47,7 @@ def dump_to_file(file_name: str, payload: str, is_json: bool = False, exit_after
def trace(msg: str):
if DEBUG_LOGGING:
if DEBUG_TRACE:
logging.debug(msg)
output("trace: " + msg, BColors.OKBLUE)

View File

@@ -1,10 +1,20 @@
import random
from dotenv import load_dotenv
from pathlib import Path
import os
from .path_manager import LOCATIONS
from .config import main_settings
DEBUG = True
if not load_dotenv(Path(__file__).parent.parent.parent / ".env"):
load_dotenv(Path(__file__).parent.parent.parent / ".env.example")
__stage__ = os.getenv("STAGE", "prod")
DEBUG = __stage__ == "dev" and True
DEBUG_LOGGING = DEBUG and False
DEBUG_TRACE = DEBUG and True
DEBUG_YOUTUBE_INITIALIZING = DEBUG and False
DEBUG_PAGES = DEBUG and False
DEBUG_DUMP = DEBUG and True