From 7badf89c28527df4178af3f570f7accbc530b004 Mon Sep 17 00:00:00 2001 From: Patrick Robertson Date: Mon, 17 Mar 2025 09:40:46 +0000 Subject: [PATCH] Create the 'secrets' folder if it doesn't exist on first run Easier setup for users --- src/auto_archiver/core/config.py | 5 +++++ 1 file changed, 5 insertions(+) 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