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.



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

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



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

def method_missing(*args)
  # nop
end

Class Method Details

.load_file(file) ⇒ Object



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

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

Instance Method Details

#chef_server_url(value) ⇒ Object



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

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

#client_key(value) ⇒ Object



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

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

#node_name(value) ⇒ Object



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

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

#ssl_verify_mode(value) ⇒ Object



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

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