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.



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

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



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

def method_missing(*args)
  # nop
end

Class Method Details

.load_file(file) ⇒ Object



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

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

Instance Method Details

#chef_server_url(value) ⇒ Object



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

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

#client_key(value) ⇒ Object



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

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

#node_name(value) ⇒ Object



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

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

#ssl_verify_mode(value) ⇒ Object



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

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