Skip to content

Commit

Permalink
DATA_DIR as paramter, too
Browse files Browse the repository at this point in the history
  • Loading branch information
A. Schulze committed Dec 20, 2023
1 parent 5150b4a commit aa44d1a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions build_postfix_discard_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ def handle_dsn(filename: str):
LOG_LEVEL = logging.DEBUG
logging.basicConfig(format='%(message)s', level=LOG_LEVEL)

# same 6 lines of code in dmarc_dsn_processor.py ...
# same lines of code in dmarc_dsn_processor.py ...
# pylint: disable=duplicate-code
DATA_DIR = os.getenv('DATA_DIR', './dmarc_dsn_processor')
if len(sys.argv) > 1:
DATA_DIR = sys.argv[1]
else:
DATA_DIR = os.getenv('DATA_DIR', './dmarc_dsn_processor')

if os.path.isdir(DATA_DIR):
logging.debug('DEBUG: using %s', DATA_DIR)
else:
Expand All @@ -69,7 +73,7 @@ def handle_dsn(filename: str):
logging.error("ERROR: ENV[MIN_AGE] = '%s', but must be an integer", MIN_AGE)
sys.exit(1)

# don't accept nagative ages
# don't accept negative ages
if MIN_AGE < 0:
logging.error("ERROR: ENV[MIN_AGE] must be a positive integer")
sys.exit(1)
Expand Down

0 comments on commit aa44d1a

Please sign in to comment.