Loads a single signing profile entirely from environment variables. Intended for use with Heroku without persistent storage.
(mapDelim rune)
| 146 | // Loads a single signing profile entirely from environment variables. |
| 147 | // Intended for use with Heroku without persistent storage. |
| 148 | func getProfileFromEnv(mapDelim rune) (*EnvProfile, error) { |
| 149 | k := koanf.New(string(mapDelim)) |
| 150 | if err := k.Load(structs.Provider(ProfileBox{}, "yaml"), nil); err != nil { |
| 151 | return nil, errors.WithMessage(err, "load default") |
| 152 | } |
| 153 | if err := k.Load(env.Provider(k, "", "_", func(s string) string { |
| 154 | return strings.ToLower(s) |
| 155 | }), nil); err != nil { |
| 156 | return nil, errors.WithMessage(err, "load envvars") |
| 157 | } |
| 158 | profile := EnvProfile{} |
| 159 | if err := k.UnmarshalWithConf("profile", &profile, koanf.UnmarshalConf{Tag: "yaml"}); err != nil { |
| 160 | return nil, errors.WithMessage(err, "unmarshal") |
| 161 | } |
| 162 | return &profile, nil |
| 163 | } |
| 164 | |
| 165 | func isAllowedExt(allowedExts []string, fileName string) bool { |
| 166 | fileExt := filepath.Ext(fileName) |