module ChefConfig::Mixin::Credentials

def credentials_profile(profile = nil)

Returns:
  • (String) -

Parameters:
  • profile (String, nil) -- Optional override for the active profile,

Other tags:
    Since: - 14.4
def credentials_profile(profile = nil)
  context_file = PathHelper.home(ChefConfig::Dist::USER_CONF_DIR, "context").freeze
  if !profile.nil?
    profile
  elsif ENV.include?("CHEF_PROFILE")
    ENV["CHEF_PROFILE"]
  elsif File.file?(context_file)
    File.read(context_file).strip
  else
    "default"
  end
end