Closed renato-farias closed 1 year ago
This PR intends to add a new feature for selecting which env vars the caller wants to lookup and replace while using the cli or programmatically.
I believe it addresses what was requested in https://github.com/a8m/envsubst/issues/25.
Summary
-envs
echo 'hi ${USER} at ${PWD}' |envsubst -envs ENV,USER > hi myuser at ${PWD}
envsubst.StringSelectedEnvs(input, []string{"ENV1"})
envsubst.StringRestrictedSelectedEnvs(input, true, false, []string{"ENV1"})
envsubst.BytesSelectedEnvs([]byte(input), []string{"ENV1"})
envsubst.BytesRestrictedSelectedEnvs([]byte(input), false, true, []string{"ENV1"})
envsubst.ReadFileSelectedEnvs("filename", []string{"ENV1"})
envsubst.ReadFileRestrictedSelectedEnvs("filename", true, true, []string{"ENV1"})
This PR intends to add a new feature for selecting which env vars the caller wants to lookup and replace while using the cli or programmatically.
I believe it addresses what was requested in https://github.com/a8m/envsubst/issues/25.
Summary
-envs
added for listing what env vars we want to lookup and replace.envsubst.StringSelectedEnvs(input, []string{"ENV1"})
envsubst.StringRestrictedSelectedEnvs(input, true, false, []string{"ENV1"})
envsubst.BytesSelectedEnvs([]byte(input), []string{"ENV1"})
envsubst.BytesRestrictedSelectedEnvs([]byte(input), false, true, []string{"ENV1"})
envsubst.ReadFileSelectedEnvs("filename", []string{"ENV1"})
envsubst.ReadFileRestrictedSelectedEnvs("filename", true, true, []string{"ENV1"})