Skip to content

Feature request: Merge multiple config files rather than erroring on duplicate keys #1827

@BCurrell

Description

@BCurrell

Hi,

Just wondering if its possible, and if you would be willing to adjust the config loading process so you can read multiple config files and merge the contents of them rather than erroring out on a duplicate key.

I'm writing a compose setup using blocky where I'd like to have a default config checked into the repository, and the ability to add local-specific config when the compose stack is run on a set of endpoints. For example, having the following:

config/00_default.yaml - Checked into the repository

upstreams:
  groups:
    default:
      # Cloudflare - https://developers.cloudflare.com/1.1.1.1/setup/
      - "https://security.cloudflare-dns.com/dns-query"
      - "tcp-tls:security.cloudflare-dns.com:853"
      # Google - https://developers.google.com/speed/public-dns/docs/secure-transports
      - "https://dns.google/dns-query"
      - "tcp-tls:dns.google:853"
  init:
    strategy: "blocking"
  strategy: "parallel_best"

config/10_local.yaml - Not checked into the repository

upstreams:
  groups:
    192.168.0.0/16:
      # Adguard - https://adguard-dns.io/en/public-dns.html
      - "https://dns.adguard-dns.com/dns-query"
      - "tcp-tls:dns.adguard-dns.com:853"

Result in the following running config:

upstreams:
  groups:
    default:
      # Cloudflare - https://developers.cloudflare.com/1.1.1.1/setup/
      - "https://security.cloudflare-dns.com/dns-query"
      - "tcp-tls:security.cloudflare-dns.com:853"
      # Google - https://developers.google.com/speed/public-dns/docs/secure-transports
      - "https://dns.google/dns-query"
      - "tcp-tls:dns.google:853"
    192.168.0.0/16:
      # Adguard - https://adguard-dns.io/en/public-dns.html
      - "https://dns.adguard-dns.com/dns-query"
      - "tcp-tls:dns.adguard-dns.com:853"
  init:
    strategy: "blocking"
  strategy: "parallel_best"

Would be my ideal situation. If this isn't something that can be done, I can just write some template configs and have a step where you have to run a script to generate a single config from them, however I'm trying to minimise the amount of user input required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions