module ChefCLI::Configurable

def chef_config

def chef_config
  return @chef_config if @chef_config
  config_loader.load
  @chef_config = Chef::Config
  CookbookOmnifetch.integration.default_chef_server_http_client = default_chef_server_http_client
  @chef_config
end

def chefcli_config

def chefcli_config
  chef_config.chefcli
end

def config_loader

def config_loader
  @config_loader ||= Chef::WorkstationConfigLoader.new(config[:config_file])
end

def default_chef_server_http_client

def default_chef_server_http_client
  lambda do
    ChefServerAPIMulti.new(@chef_config.chef_server_url,
      signing_key_filename: @chef_config.client_key,
      client_name: @chef_config.node_name)
  end
end

def generator_config

def generator_config
  chefcli_config.generator
end

def knife_config

def knife_config
  chef_config.knife
end

def reset_config!

def reset_config!
  @chef_config = nil
  @config_loader = nil
end