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

DRY configuration (aliases) #15

Open
tianon opened this issue Dec 14, 2016 · 0 comments
Open

DRY configuration (aliases) #15

tianon opened this issue Dec 14, 2016 · 0 comments

Comments

@tianon
Copy link
Owner

tianon commented Dec 14, 2016

I've got a lot of 100% duplicated blocks in my configuration (because I MITM several .deb mirrors to my local apt-cacher-ng instance, exactly like https://github.com/tianon/rawdns/blob/b2cec4eeff1377afdfd8c90e5a4716eb82370a09/hacks/apt-cacher-ng.md, so whatever gets implemented here should be reflected there), so it'd be nice to have some way to say something like "configuration for this new host should be copied from that other host".

I see two main ways to implement this:

{
	"host1.": {
		...
	},
	"host2.": "host1."
}

Main pros: simple for users to write
Main cons: annoying to implement (StringOrDomainConfig, etc), inflexible for later enhancement

{
	"host1.": {
		...
	},
	"host2.": {
		"copy": "host1.",
		...
	}
}

(or "type": "copy", but I'm not sure I like that -- being able to change even the "type" of what we've copied from seems fun -- maybe "merge": "host1." is better to make it clear what's happening here)

Main pros: flexible, saves code from needing complex unmarshalling for StringOrDomainConfig
Main cons: slightly complex "merging" behavior

One thing to decide would be whether "cnames": [ "1.2.3.4" ] merged into "cnames": [ "5.6.7.8" ] becomes [ "5.6.7.8" ] or [ "1.2.3.4", "5.6.7.8" ].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant