sous-chefs / nginx

Development repository for the nginx cookbook
https://supermarket.chef.io/cookbooks/nginx
Apache License 2.0
551 stars 810 forks source link

Extract useful methods to outside of action_class #620

Open Lasering opened 1 year ago

Lasering commented 1 year ago

The nginx_site resource defines the method config_file inside action_class. This method would be very useful to be used like:

site = nginx_site 'service-discovery' do
  conf_dir ::File.join(config.nginx_dir, 'sites-available')
  cookbook 'dsi-consul-servers'
  template 'service-discovery.conf.erb'
  variables(
     ...
  )
  action :create
end

link site.config_file do    # HERE
  to "../sites-enabled/#{site.name}"
end

To allow this usage the method should be defined outside of action_class. I can make a PR if this is something that would be merged.