lib/conjur/authn.rb in conjur-cli-4.10.3 vs lib/conjur/authn.rb in conjur-cli-4.12.0
- old
+ new
@@ -52,10 +52,18 @@
end
@netrc ||= Netrc.read(*args)
end
def get_credentials(options = {})
- @credentials ||= (read_credentials || fetch_credentials(options))
+ @credentials ||= (env_credentials || read_credentials || fetch_credentials(options))
+ end
+
+ def env_credentials
+ if (login = ENV['CONJUR_AUTHN_LOGIN']) && (api_key = ENV['CONJUR_AUTHN_API_KEY'])
+ [ login, api_key ]
+ else
+ nil
+ end
end
def read_credentials
netrc[host]
end