supermarket
supermarket copied to clipboard
Default attributes depending on other attributes causing headaches for custom configurations
The attempts to use node attributes to set other default node attributes within the omnibus internal cookbook is causing some of our configuration headaches.
For example, we set the default value for protocol
depending on the value of force_ssl
. Because protocol
and force_ssl
are evaluated and set here in the defaults, the evaluation for protocol
never uses an overridden value for force_ssl
. And so, ENV['PROTOCOL']
gets set to https
all the time and then Supermarket::Host.full_url
always returns a URL with https
as the scheme.
That and https
being hardcoded in the nginx site template are the two things that trip up a non-SSL install. I was able to get non-SSL Supermarket working in a VM by setting "protocol": false
directly in supermarket.json
and manually changing the nginx site config to http
after a -ctl reconfigure
.
Need to fix defaults - we should never interpolate default values.
see also tip 5 here - https://coderanger.net/chef-tips/