Skip to content

Commit

Permalink
change handling of settings
Browse files Browse the repository at this point in the history
  • Loading branch information
rndmh3ro committed Aug 24, 2023
1 parent 96964cb commit b0473ff
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/settings.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
import kopf
import logging
import os
from env_vars import get_required_env_var, get_env_var_bool

# Here we use Kopf's logging macro to setup the logging format and level for all modules
DEBUG = get_env_var_bool("DEBUG")
kopf.configure(
debug=DEBUG
)
from env_vars import get_required_env_var

logger = logging.getLogger(__name__)

if DEBUG:
logger.info("DEBUG mode is activated!")

LABEL = os.getenv('LABEL')
LABEL_VALUE = os.getenv('LABEL_VALUE')
if LABEL_VALUE:
LABEL = os.getenv('LABEL', None)
LABEL_VALUE = os.getenv('LABEL_VALUE', None)
if LABEL and LABEL_VALUE:
logger.info("Looking for resources with LABEL '%s' and LABEL_VALUE '%s'", LABEL, LABEL_VALUE)
else:
elif LABEL:
logger.info("Looking for resources with LABEL '%s'", LABEL)
else:
logger.info("Looking for all resources")

NAMESPACE = os.getenv('NAMESPACE', 'ALL')
if NAMESPACE == 'ALL':
Expand Down

0 comments on commit b0473ff

Please sign in to comment.