Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enables passing credentials via environment variables instead of json file #28

Merged
merged 1 commit into from
Jun 9, 2015
Merged

Enables passing credentials via environment variables instead of json file #28

merged 1 commit into from
Jun 9, 2015

Conversation

haabaato
Copy link

Addresses issue #27. I took it a step further than I originally proposed and made the necessary changes to allow UserRefreshCredentials to be initialized from environment variables, in addition to ServiceAccountCredentials and ServiceAccountJwtHeaderCredentials.

@tbetbetbe
Copy link
Contributor

The travis build is failing because of rubocop detected style failings.

I think both the warnings are things that can be ignored, so I'm happy to have the style warnings resolved using by updating the .rubocop_todo.yml. Could you update that and add it to this PR please?

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 18, 2015
@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 99.72% when pulling 0f642dc on haabaato:haabaato/auth-with-env-vars into 133e05c on google:master.

@haabaato
Copy link
Author

Updated the .rubocop_todo.yml. Now the ruby 1.9.3 and jruby builds are failing because of keyword arguments in the initializers. Is this acceptable, or does this project require 1.9 compatibility?

end

# Reads the input json and determines which creds class to use.
def self.determine_creds_class(json_key_io)
json_key = MultiJson.load(json_key_io.read)
fail "the json is missing the #{key} field" unless json_key.key?('type')
key = 'type'
fail "the json is missing the #{key} field" unless json_key.key?(key)
type = json_key['type']

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 99.28% when pulling 490278e on haabaato:haabaato/auth-with-env-vars into 133e05c on google:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 99.28% when pulling 490278e on haabaato:haabaato/auth-with-env-vars into 133e05c on google:master.

- ServiceAccountCredentials, ServiceAccountJwtHeaderCredentials
and UserRefreshCredentials initializers now take keyword args
via options hash.

- In `credentials_loader.rb`, refactored env var checking into
private methods

- Updated tests & added new tests.

- Fixed existing test for #from_well_known_path 'fails if
the file is invalid', where `from_env` was called instead of
`from_well_known_path`.

- Fixed rubocop errors I introduced, but two existing ones remain.

- Added entry to changelog.

- Fixed rubocop errors from code containing parallel assignments

- Updated rubocop_todo.yml to ignore parallel assignments and
trailing underscore assignments.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.56%) to 99.88% when pulling 5061fb5 on haabaato:haabaato/auth-with-env-vars into 133e05c on google:master.

@haabaato
Copy link
Author

@tbetbetbe Build is green. Anything left to address in this PR?

@sqrrrl
Copy link
Contributor

sqrrrl commented May 21, 2015

@tbetbetbe Curious - why still require 1.9.3 support? It's officially past EOL as far as ruby-lang.org goes (expired back in Feb.) Is it for jruby which is still lagging on 2.0+ language support?

@haabaato
Copy link
Author

Pinging @tbetbetbe. If there's more to be done, I have some time this weekend.

@tbetbetbe
Copy link
Contributor

sorry, I was out for much last week. I will look through this again and take action by wednesday - sorry about the delay.

tbetbetbe added a commit that referenced this pull request Jun 9, 2015
Enables passing credentials via environment variables instead of json file
@tbetbetbe tbetbetbe merged commit 11a1a5d into googleapis:master Jun 9, 2015
@haabaato
Copy link
Author

haabaato commented Jun 9, 2015

thanks for the merge!

@haabaato
Copy link
Author

One more question: when will the gem be version bumped?

mr-salty added a commit to mr-salty/google-auth-library-ruby that referenced this pull request Jun 29, 2015
The environment variables in the 'fails if env vars are set' test
were not actually being set because they used a nonexistent hash key
(which has the effect of unsetting the environment variable).
tbetbetbe added a commit that referenced this pull request Jul 10, 2015
Fix a failing test introduced in #28.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants