Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "includes" in config file #38

Open
darkdragon-001 opened this issue Jun 2, 2020 · 1 comment
Open

Add "includes" in config file #38

darkdragon-001 opened this issue Jun 2, 2020 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@darkdragon-001
Copy link

darkdragon-001 commented Jun 2, 2020

Allow including other files.

Modify parse_configuration() to get a base config as parameter:

-def parse_configuration(config_filename: str) -> Dict[str, Any]:
+def parse_configuration(config_filename: str, config_base: Dict[str, Any]) -> Dict[str, Any]:
     logger.debug(f"Parsing configuration file: {config_filename}")
     with open(config_filename) as file:
         config = toml.load(file)
 
-    config = deep_update(config_base, dict(config))
+    config = deep_update(CONFIG_DEFAULTS, dict(config))
 
     if "name" not in config:
         config["name"] = os.path.basename(config_filename)
 
     jsonschema.validate(instance=config, schema=SCHEMA)
     return config

Replace

parsed_cfg = parse_configuration(c)
with

parsed_cfg = parse_configuration(c, CONFIG_DEFAULTS)
for include in reversed(config['includes']):
    parsed_cfg = parse_configuration(include, parsed_cfg)
@andreasnuesslein
Copy link
Member

as I said in other places: if you have a good reason for such a change and could provide a PR, I might merge it.

@andreasnuesslein andreasnuesslein added the question Further information is requested label Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants