MCPcopy
hub / github.com/ArchiveBox/ArchiveBox / load_config_file

Function load_config_file

archivebox/config.py:647–665  ·  view source on GitHub ↗

load the ini-formatted config file from OUTPUT_DIR/Archivebox.conf

(out_dir: str=None)

Source from the content-addressed store, hash-verified

645
646
647def load_config_file(out_dir: str=None) -> Optional[Dict[str, str]]:
648 """load the ini-formatted config file from OUTPUT_DIR/Archivebox.conf"""
649
650 out_dir = out_dir or Path(os.getenv('OUTPUT_DIR', '.')).resolve()
651 config_path = Path(out_dir) / CONFIG_FILENAME
652 if config_path.exists():
653 config_file = ConfigParser()
654 config_file.optionxform = str
655 config_file.read(config_path)
656 # flatten into one namespace
657 config_file_vars = {
658 key.upper(): val
659 for section, options in config_file.items()
660 for key, val in options.items()
661 }
662 # print('[i] Loaded config file', os.path.abspath(config_path))
663 # print(config_file_vars)
664 return config_file_vars
665 return None
666
667
668def write_config_file(config: Dict[str, str], out_dir: str=None) -> ConfigDict:

Callers 1

load_configFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected