MCPcopy Create free account
hub / github.com/buildpacks/pack / parseConfig

Function parseConfig

builder/config_reader.go:168–186  ·  view source on GitHub ↗

parseConfig reads a builder configuration from file

(file *os.File)

Source from the content-addressed store, hash-verified

166
167// parseConfig reads a builder configuration from file
168func parseConfig(file *os.File) (Config, error) {
169 builderConfig := Config{}
170 tomlMetadata, err := toml.NewDecoder(file).Decode(&builderConfig)
171 if err != nil {
172 return Config{}, errors.Wrap(err, "decoding toml contents")
173 }
174
175 undecodedKeys := tomlMetadata.Undecoded()
176 if len(undecodedKeys) > 0 {
177 unknownElementsMsg := config.FormatUndecodedKeys(undecodedKeys)
178
179 return Config{}, errors.Errorf("%s in %s",
180 unknownElementsMsg,
181 style.Symbol(file.Name()),
182 )
183 }
184
185 return builderConfig, nil
186}
187
188func ParseBuildConfigEnv(env []BuildConfigEnv, path string) (envMap map[string]string, warnings []string, err error) {
189 envMap = map[string]string{}

Callers 1

ReadConfigFunction · 0.85

Calls 3

FormatUndecodedKeysFunction · 0.92
ErrorfMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected