-
Notifications
You must be signed in to change notification settings - Fork 70
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
Multi-prefix on JSON configuration file gets overwritten #12
Comments
@sethvargo I was wondering if you have looked into this. I can start working on this and send you a PR if you are busy |
@cleung2010 thank you for opening an issue. The JSON you supplied is not a direct translation from the HCL. Top-level keys in HCL are actually keys to arrays of objects in JSON, i.e.: consul = "127.0.0.1:8500"
token = "abcd1234"
retry = "10s"
max_stale = "10m"
auth {
enabled = true
username = "test"
password = "test"
} becomes: {
"auth": [
{
"enabled": true,
"password": "test",
"username": "test"
}
]
} Are you experiencing issues when you specify the prefixes as an array of objects, because that should definitely work? |
So I am not using HCL at all as my config file. I want to use multi-prefix via JSON. The readme says I can do it like so in HCL: prefix {
source = "global@nyc1"
destination = "local/nyc1"
}
prefix {
source = "global@nyc2"
destination = "local/nyc2"
} But how can I do this in JSON since keys need to be unique (thus two |
@cleung2010 the same as my example for auth (and the example you provided yourself above): {
"prefix": [
{
"source": "...",
"destination": "..."
}
]
} |
Oh nice, and I assume the same would apply for |
@cleung2010 no, destination must be a string. It's the same as the command line. If you want multiple destinations, you need to specify the prefix multiple times. |
So {
"prefix": [
{
"destination": "local/nyc1",
"source": "global@nyc1"
},
{
"destination": "local/nyc2",
"source": "global@nyc2"
},
{
"destination": "temp/nyc2",
"source": "global@nyc2"
}
]
} Instead of {
"prefix": [
{
"destination": "local/nyc1",
"source": "global@nyc1"
},
{
"destination": [
"local/nyc2",
"temp/nyc2"
],
"source": "global@nyc2"
}
]
} |
Yes |
Cool, thanks! |
Multi-prefix via configuration file does not seem to work, as keys are unique in JSON.
The following HCL:
Converts to this JSON:
In the example above, prefix configuration for
global@nyc1
gets removed/overwritten since a duplicate key exists. A suggestion is to haveprefix
also accept an array of objects (i.e. hashes) if more than one prefix is specified. The same should apply fordestination
, so that it can be a string or an array of strings.The text was updated successfully, but these errors were encountered: