diff --git a/src/auto_archiver/core/config.py b/src/auto_archiver/core/config.py index 59c1eec..a2d7679 100644 --- a/src/auto_archiver/core/config.py +++ b/src/auto_archiver/core/config.py @@ -8,6 +8,7 @@ flexible setup in various environments. import argparse from ruamel.yaml import YAML, CommentedMap import json +import os from loguru import logger @@ -230,6 +231,10 @@ def read_yaml(yaml_filename: str) -> CommentedMap: def store_yaml(config: CommentedMap, yaml_filename: str) -> None: config_to_save = deepcopy(config) + ## if the save path is the default location (secrets) then create the 'secrets' folder + if os.path.dirname(yaml_filename) == "secrets": + os.makedirs("secrets", exist_ok=True) + auth_dict = config_to_save.get("authentication", {}) if auth_dict and auth_dict.get("load_from_file"): # remove all other values from the config, don't want to store it in the config file