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

Config file merging issue #706

Closed
justintime opened this issue Oct 19, 2015 · 4 comments
Closed

Config file merging issue #706

justintime opened this issue Oct 19, 2015 · 4 comments
Milestone

Comments

@justintime
Copy link

I've come across what I think is a bug in config file merging in vault.

My use case is that I'm using a chef community cookbook, and it manages /etc/vault.hcl for me. Rather than try to push changes upstream, I figured I could just create a /etc/vault.hcl.d directory, and stick my config changes in there.

According to help, it sounds like I can do this:

 -config=<path>      Path to the configuration file or directory. This can be
                      specified multiple times. If it is a directory, all
                      files with a ".hcl" or ".json" suffix will be loaded.

Here's my server command line:
/usr/local/bin/vault server -config=/etc/vault.hcl -config=/etc/vault.hcl.d -log-level=info

And here's what I have in the .d directory:

[root@vault1 log#] cat /etc/vault.hcl.d/cache.hcl
disable_cache = true

However, the read cache is not getting disabled when I start vault. If I move the disable_cache statement to /etc/vault.hcl and restart, I get the desired behavior.

Am I doing something wrong? Thanks!

@jefferai
Copy link
Member

I don't think you are, no. I'll dig into this.

@jefferai
Copy link
Member

@justintime Is there any chance you can share your configs? I can't replicate this.

I have the following config.hcl:

backend "file" {
  path = "/home/jeff/706-test/filetest"
}

disable_mlock = true

listener "tcp" {
  address = "0.0.0.0:8200"
  tls_disable = 1
}

and a config directory with one file:

disable_cache=true

I put in a panic and print statements to print out the seen paths and the final config, here's what I see:

config paths:
[]string{"config.hcl", "config"}
config:
server.Config{Listeners:[]*server.Listener{*server.Listener{Type:"tcp", Config:map[string]string{"address":"0.0.0.0:8200", "tls_disable":"1"}}}, Backend:*server.Backend{Type:"file", AdvertiseAddr:"", Config:map[string]string{"path":"/home/jeff/706-test/filetest"}}, DisableCache:true, DisableMlock:true, Telemetry:<nil>, MaxLeaseTTL:0, MaxLeaseTTLRaw:"", DefaultLeaseTTL:0, DefaultLeaseTTLRaw:""}

You can see DisableCache:true in the output. Unfortunately, without being able to replicate it I'm not sure what's wrong -- I took a look at the code and the merging logic for DisableCache looks fine.

@justintime
Copy link
Author

Sigh I found my problem. Closing this and reopening the other issue.

@jefferai
Copy link
Member

Reopening the other? Wuh oh. What's going wrong?

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

2 participants