Class: Inspec::Resources::NginxConf
- Inherits:
-
Object
- Object
- Inspec::Resources::NginxConf
show all
- Extended by:
- Forwardable
- Includes:
- FileReader, FindFiles
- Defined in:
- lib/resources/nginx_conf.rb
Constant Summary
Constants included
from FindFiles
FindFiles::TYPES
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from FileReader
#read_file_content
Methods included from FindFiles
#find_files, #find_files_or_warn
Constructor Details
#initialize(conf_path = nil) ⇒ NginxConf
34
35
36
37
38
39
|
# File 'lib/resources/nginx_conf.rb', line 34
def initialize(conf_path = nil)
@conf_path = conf_path || '/etc/nginx/nginx.conf'
@contents = {}
return skip_resource 'The `nginx_conf` resource is currently not supported on Windows.' if inspec.os.windows?
read_content(@conf_path)
end
|
Instance Attribute Details
#contents ⇒ Object
Returns the value of attribute contents.
32
33
34
|
# File 'lib/resources/nginx_conf.rb', line 32
def contents
@contents
end
|
Instance Method Details
#http ⇒ Object
48
49
50
|
# File 'lib/resources/nginx_conf.rb', line 48
def http
NginxConfHttp.new(params['http'], self)
end
|
#params ⇒ Object
41
42
43
44
45
46
|
# File 'lib/resources/nginx_conf.rb', line 41
def params
@params ||= parse_nginx(@conf_path)
rescue StandardError => e
skip_resource e.message
@params = {}
end
|
#to_s ⇒ Object
54
55
56
|
# File 'lib/resources/nginx_conf.rb', line 54
def to_s
"nginx_conf #{@conf_path}"
end
|