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

httpbakery/agent: support authinfo in environment variables #192

Merged

Conversation

rogpeppe
Copy link
Member

This makes it easy to get agent authinfo from environment
variables instead of a file.

//
// BAKERY_PUBLIC_KEY='wg/rUMm5cy9O00TaS9pgDIHnFMwhrisI0KDSg4+KkGM='
// BAKERY_PRIVATE_KEY='S529MFrVUWB/VqcsPABJSAlnY/57fdHi4cL9HdK9ZQw='
// BAKERY_USERS='https://api.jujucharms.com/identity bob https://api.staging.jujucharms.com/identity'
Copy link
Contributor

@mhilton mhilton Jan 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is significantly more complex than I had in mind. I was essentially looking for a fix to juju/charmstore#776. This is not usable that simply. We need to be able to provide API access to jujucharms.com through a mechanism that it "set these two environment variables", "use the tools" type system. The same as people expect from AWS. I'm not interested that we have this crazy bakery setup inside the API that complexity should not be forced onto out users.

@rogpeppe rogpeppe force-pushed the 143-agent-environment branch from b07485b to 69293eb Compare April 23, 2018 12:03
Copy link
Contributor

@mhilton mhilton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo an additional test.

authInfo1, err := agent.AuthInfoFromEnvironment()
c.Assert(err, gc.Equals, nil)
c.Assert(authInfo1, jc.DeepEquals, authInfo)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add a test for the error when the environment variable isn't set.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

This makes it straightforward for client programs to support agent
authentication without needing an explicit command line flag.
@rogpeppe rogpeppe force-pushed the 143-agent-environment branch from 69293eb to 55709bb Compare April 23, 2018 13:37
@rogpeppe rogpeppe merged commit a0743b6 into go-macaroon-bakery:v2 Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants