48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/cf/cli/config.rb', line 48
def set_api_key(yaml_source = "")
api_key = nil
api_key = get_api_key(yaml_source) if File.exists?(yaml_source)
if api_key.blank?
if File.exist?(config_file)
api_key = get_api_key(config_file)
if api_key.blank?
say("Error: No valid api key found. Do login first with: cf login", :red) and exit(1)
else
CF.api_key = api_key
if CF::Account.valid?
return
else
say("Error: Invalid api key => #{CF.api_key} for target #{CF.api_url}", :red) and exit(1)
end
end
end
say("Error: No valid api key found. Do login first with: cf login", :red) and exit(1)
else
CF.api_key = api_key if CF.api_key.blank?
say("Error: Invalid api key => #{CF.api_key} for target #{CF.api_url}", :red) and exit(1) unless CF::Account.valid?
end
end
|