parseConfig reads a builder configuration from file
(file *os.File)
| 166 | |
| 167 | // parseConfig reads a builder configuration from file |
| 168 | func 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 | |
| 188 | func ParseBuildConfigEnv(env []BuildConfigEnv, path string) (envMap map[string]string, warnings []string, err error) { |
| 189 | envMap = map[string]string{} |
no test coverage detected