PageRenderTime 61ms CodeModel.GetById 34ms RepoModel.GetById 1ms app.codeStats 0ms

/resources/app.rb

https://github.com/gchef/nginx-cookbook
Ruby | 38 lines | 31 code | 5 blank | 2 comment | 2 complexity | 3dcce2e0e4392afb863e7410712f147c MD5 | raw file
  1. actions :add, :remove
  2. default_action :add
  3. # http://wiki.nginx.org/HttpLogModule
  4. attribute :access_log, :kind_of => String, :default => ""
  5. attribute :access_log_format, :kind_of => String, :default => "default"
  6. # http://wiki.nginx.org/NginxCoreModule#error_log
  7. attribute :error_log, :kind_of => String, :default => ""
  8. attribute :error_log_format, :kind_of => String, :default => "crit" # debug | info | notice | warn | error | crit | alert | emerg
  9. attribute :client_max_body_size, :kind_of => String, :default => "16M"
  10. attribute :custom_directives, :kind_of => Array, :default => []
  11. attribute :keepalive_timeout, :kind_of => Fixnum, :default => 10
  12. attribute :listen, :kind_of => Array, :default => [80]
  13. attribute :locations, :kind_of => Array, :default => []
  14. attribute :name, :kind_of => String, :name_attribute => true
  15. attribute :public_path, :kind_of => String
  16. attribute :server_name, :kind_of => String
  17. attribute :try_files, :kind_of => Array, :default => [] # $uri/index.html $uri "@#{@app.name}"
  18. attribute :upstream_keepalive, :kind_of => Fixnum, :default => 4
  19. attribute :upstreams, :kind_of => Array, :default => []
  20. def access_log_path
  21. if access_log.empty?
  22. "#{node[:nginx][:log_dir]}/#{name}.access.log"
  23. else
  24. access_log
  25. end
  26. end
  27. def error_log_path
  28. if error_log.empty?
  29. "#{node[:nginx][:log_dir]}/#{name}.error.log"
  30. else
  31. error_log
  32. end
  33. end