Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Fix the evaluation to avoid an escape character error #250

Merged
merged 4 commits into from
Nov 23, 2021
Merged

Conversation

noahingh
Copy link
Member

@noahingh noahingh commented Nov 23, 2021

To evaluate without json.Unmarshal, the evaluation evaluates the saved content which is stored when parsing the YAML formatted content.

@noahingh noahingh added the bug Something isn't working label Nov 23, 2021
@noahingh noahingh added this to the v0.4 milestone Nov 23, 2021
@noahingh noahingh linked an issue Nov 23, 2021 that may be closed by this pull request
return eutil.NewError(eutil.ErrorCodeConfigParseError, err)
}

c.source = content
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Save the content when parsing the configuration file.

Comment on lines +102 to +108
evalued, err := envsubst.Eval(string(c.source), mapper)
if err != nil {
return eutil.NewError(eutil.ErrorCodeConfigParseError, err)
}

if err := yaml.Unmarshal([]byte(evalued), c); err != nil {
return eutil.NewError(eutil.ErrorCodeConfigParseError, err)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parse again after evaluating the configuration.

@noahingh noahingh marked this pull request as ready for review November 23, 2021 13:18
@noahingh noahingh merged commit 27656de into main Nov 23, 2021
@noahingh noahingh deleted the fix-eval branch November 23, 2021 13:20
@noahingh noahingh changed the title Fix to evaluation to avoid an escape character error Fix the evaluation to avoid an escape character error Nov 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix the bug of evaluation.
1 participant