blocky icon indicating copy to clipboard operation
blocky copied to clipboard

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

Open BCurrell opened this issue 7 months ago • 2 comments

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.

BCurrell avatar Aug 04 '25 23:08 BCurrell

Hi again,

This is slightly less required now, I've started work on a wrapper container that will handle the templating:

https://github.com/BCurrell/blocky-templates

If you're tempted to include this feature yourself, I'd be willing to put together a pull request to update your Dockerfile. Otherwise I'll just look into publishing this separately.

BCurrell avatar Aug 09 '25 20:08 BCurrell

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Nov 08 '25 04:11 github-actions[bot]