Merge base and overlay config

Write codeEasy10 min

Your task

An app loads its settings from a base file and then an environment overlay, each given as a list of lines. In both files: trim the line; discard it when empty or when it begins with "#"; otherwise split at the first "=" and trim key and value. Combine the two into one dict where every overlay entry replaces the base entry with the same key, and inside a single file a repeated key keeps its final assignment. An override to an empty value still counts as an override. Return the combined dict.

Examples

apply_overrides(base: list[str], overlay: list[str]) -> dict[str,str]
Example 1
Inputapply_overrides(["retries=3", "log_level=info"], ["log_level=debug"])
Output{"retries": "3", "log_level": "debug"}