I want to include the Diplomat gem in my Chef cookbook so that I can perform Consul variable lookups in .erb templates.
I need to configure the Consul URL:
irb(main):015:0> require 'diplomat'
irb(main):016:0> Diplomat.configure do |config|
irb(main):017:1* config.url = "consulurl:80"
irb(main):018:1> end
Set a variable as the URL path:
irb(main):020:0> kv_path = "path/to/variable"
=> "path/to/variable"
And finally, perform the lookup within the templates.
irb(main):022:0> foo = Diplomat::Kv.get(kv_path + '/test_foo_123')
=> "bar"
Where in the cookbook would I need to write the configuration code above such that I can perform variable lookups within .erb templates?