Class: Fluent::ChefAPIInput::ChefConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/in_chef_api.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ ChefConfig

Returns a new instance of ChefConfig.



26
27
28
29
# File 'lib/fluent/plugin/in_chef_api.rb', line 26

def initialize(file)
  @config = {}
  instance_eval(::File.read(file))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



47
48
49
# File 'lib/fluent/plugin/in_chef_api.rb', line 47

def method_missing(*args)
  # nop
end

Class Method Details

.load_file(file) ⇒ Object



22
23
24
# File 'lib/fluent/plugin/in_chef_api.rb', line 22

def self.load_file(file)
  new(file).instance_eval { @config.dup }
end

Instance Method Details

#chef_server_url(value) ⇒ Object



31
32
33
# File 'lib/fluent/plugin/in_chef_api.rb', line 31

def chef_server_url(value)
  @config[:endpoint] = value
end

#client_key(value) ⇒ Object



39
40
41
# File 'lib/fluent/plugin/in_chef_api.rb', line 39

def client_key(value)
  @config[:key] = ::File.read(value)
end

#node_name(value) ⇒ Object



35
36
37
# File 'lib/fluent/plugin/in_chef_api.rb', line 35

def node_name(value)
  @config[:client] = value
end

#ssl_verify_mode(value) ⇒ Object



43
44
45
# File 'lib/fluent/plugin/in_chef_api.rb', line 43

def ssl_verify_mode(value)
  @config[:ssl_verify] = value != :verify_none
end