Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-client/pull/42#discussion_r118498184
  
    --- Diff: cli/io/config.go ---
    @@ -70,3 +98,111 @@ func (config *Config) Read() {
        dec := json.NewDecoder(fileToRead)
        dec.Decode(&config.Map)
     }
    +
    +
    +// getCredentials reads credentials from .brooklyn_cli data formatted for 
versions > 0.11.0
    +// Note that the password is base64 encoded to avoid json formatting 
problems
    +//{
    +//  "credentials": {
    +//      "password": "cGFzc3dvcmQ=",
    +//      "username": "geoff"
    +//  },
    +//  "skipSslChecks": false,
    +//  "target": "http://geoffs-macbook-pro.local:8081";
    +//}
    +func (config *Config) getCredentials(target string) (username string, 
password string, err error) {
    +   credentials, found := config.Map[credentialsKey].(string)
    +   if !found {
    +           err = errors.New("No credentials found for " + target)
    +           return
    +   }
    +
    +   if decoded, errd := base64.StdEncoding.DecodeString(credentials); errd 
!= nil {
    +           err = errors.New("Could not decode credentials for " + target)
    +           return
    +   } else {
    +           userAndPassword := strings.SplitN(string(decoded), ":", 2)
    +           if len(userAndPassword) != 2 {
    --- End diff --
    
    Yes, tested it and it works ok.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to