Skip to content

Commit

Permalink
chore: print a warning if invalid character is there in yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
VihasMakwana committed Sep 27, 2024
1 parent c155b14 commit 383bfd9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions confmap/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func withStringRepresentation(stringRepresentation string) RetrievedOption {
func NewRetrievedFromYAML(yamlBytes []byte, opts ...RetrievedOption) (*Retrieved, error) {
var rawConf any
if err := yaml.Unmarshal(yamlBytes, &rawConf); err != nil {
fmt.Printf("unmarshaling from yaml failed: %v\nAttempting to use it as a string verbatim. You can ignore this warning if the collector starts successfully.\n\n", err)
// If the string is not valid YAML, we try to use it verbatim as a string.
strRep := string(yamlBytes)
return NewRetrieved(strRep, append(opts, withStringRepresentation(strRep))...)
Expand Down

0 comments on commit 383bfd9

Please sign in to comment.