MCPcopy Create free account
hub / github.com/SignTools/SignTools / getProfileFromEnv

Function getProfileFromEnv

src/config/config.go:148–163  ·  view source on GitHub ↗

Loads a single signing profile entirely from environment variables. Intended for use with Heroku without persistent storage.

(mapDelim rune)

Source from the content-addressed store, hash-verified

146// Loads a single signing profile entirely from environment variables.
147// Intended for use with Heroku without persistent storage.
148func 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
165func isAllowedExt(allowedExts []string, fileName string) bool {
166 fileExt := filepath.Ext(fileName)

Callers 1

LoadFunction · 0.85

Calls 1

NewMethod · 0.80

Tested by

no test coverage detected