Skip to content

Commit

Permalink
move config loading into function for easier runtime reloading
Browse files Browse the repository at this point in the history
  • Loading branch information
pirate committed Apr 25, 2019
1 parent d248684 commit df4307c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions archivebox/cli/archivebox_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def main(args=None):
if command.sort:
links = sorted(links, key=lambda link: getattr(link, command.sort))

links = list(links)

if command.status == 'indexed':
folders = get_indexed_folders(links, out_dir=OUTPUT_DIR)
elif command.status == 'archived':
Expand Down
18 changes: 10 additions & 8 deletions archivebox/legacy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,16 +500,18 @@ def get_chrome_info(config: ConfigDict) -> ConfigValue:

################################## Load Config #################################

CONFIG: ConfigDict

CONFIG = load_config(SHELL_CONFIG_DEFAULTS)
CONFIG = load_config(ARCHIVE_CONFIG_DEFAULTS, CONFIG)
CONFIG = load_config(ARCHIVE_METHOD_TOGGLES_DEFAULTS, CONFIG)
CONFIG = load_config(ARCHIVE_METHOD_OPTIONS_DEFAULTS, CONFIG)
CONFIG = load_config(DEPENDENCY_CONFIG_DEFAULTS, CONFIG)
CONFIG = load_config(DERIVED_CONFIG_DEFAULTS, CONFIG)

def load_all_config():
CONFIG: ConfigDict = {}
for section_name, section_config in CONFIG_DEFAULTS.items():
CONFIG = load_config(section_config, CONFIG)

return load_config(DERIVED_CONFIG_DEFAULTS, CONFIG)

CONFIG = load_all_config()
globals().update(CONFIG)


############################## Importable Checkers #############################

def check_system_config(config: ConfigDict=CONFIG) -> None:
Expand Down

0 comments on commit df4307c

Please sign in to comment.