Attempts to parse a Profile from environment variables. Returns os.ErrNotExist if variables are missing, otherwise any other error.
(cfg *config.EnvProfile)
| 25 | // Attempts to parse a Profile from environment variables. |
| 26 | // Returns os.ErrNotExist if variables are missing, otherwise any other error. |
| 27 | func newEnvProfile(cfg *config.EnvProfile) (*envProfile, error) { |
| 28 | p, err := parseEnvProfile(cfg) |
| 29 | if err != nil { |
| 30 | return nil, err |
| 31 | } |
| 32 | fixedCert, teamId, err := processP12(p.originalCert, p.certPass) |
| 33 | if err != nil { |
| 34 | return nil, errors.WithMessage(err, "validate certificate") |
| 35 | } |
| 36 | p.fixedCert = fixedCert |
| 37 | p.teamId = teamId |
| 38 | return p, nil |
| 39 | } |
| 40 | |
| 41 | func parseEnvProfile(cfg *config.EnvProfile) (*envProfile, error) { |
| 42 | // cfg is empty, no envvars were set |
no test coverage detected