Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A base64 interpolation function would be nice #2647

Closed
wants to merge 1 commit into from

Conversation

thepastelsuit
Copy link

Would be nice to have an interpolation function to encode a string in base64 for when the templating provider is used with cloud-config for user_data containing a write_files section. (Disclaimer: I've never written Go before, nor have I added additional change proposals for the test suite. This is maybe more of a proof of concept?)

Would be nice to have an interpolation function to encode a string in base64 for when the templating provider is used with cloud-config for user_data containing a write_files section. (Disclaimer: I've never written Go before, nor have I added additional change proposals for the test suite. This is maybe more of a proof of concept?)
@@ -95,6 +96,19 @@ func interpolationFuncFile() ast.Function {
}
}

// interpolationFuncBase64 implements the "base64" function to
// encode a string in base64
func interpolationFuncBase64() ast.Function {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think just adding this function is sufficient.

There's also a mapping from the names used in the configuration to these functions near the top of this file in func init(), where I think you'd need to add a new entry for this.

@apparentlymart
Copy link
Contributor

@thepastelsuit Thanks for the initial work here! This same functionality was added by the later PR #3325, so base64encode and base64decode functions are now merged and awaiting inclusion in the next release.

@ghost
Copy link

ghost commented Apr 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants