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
allow leading slash for variables in manifest files while using vars-store file #300
Conversation
Hey MeBNoah! Thanks for submitting this pull request! All pull request submitters and commit authors must have a Contributor License Agreement (CLA) on-file with us. Please sign the appropriate CLA (individual or corporate). When sending signed CLA please provide your github username in case of individual CLA or the list of github usernames that can make pull requests on behalf of your organization. If you are confident that you're covered under a Corporate CLA, please make sure you've publicized your membership in the appropriate Github Org, per these instructions. Once you've publicized your membership, one of the owners of this repository can close and reopen this pull request, and dreddbot will take another look. |
Hey MeBNoah! Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you and the commit authors have already signed the CLA. |
director/template/template_test.go
Outdated
@@ -21,6 +21,15 @@ var _ = Describe("Template", func() { | |||
Expect(result).To(Equal([]byte("foo\n"))) | |||
}) | |||
|
|||
It("can interpolate values with leading slash into a struct with byte slice", func() { | |||
template := NewTemplate([]byte("((/key))")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mind changing it to /key/foo
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course not ;) ... already done
director/template/template.go
Outdated
@@ -87,7 +87,7 @@ func (t Template) interpolateRoot(obj interface{}, tracker varsTracker) (interfa | |||
type interpolator struct{} | |||
|
|||
var ( | |||
interpolationRegex = regexp.MustCompile(`\(\((!?[-\.\w\pL]+)\)\)`) | |||
interpolationRegex = regexp.MustCompile(`\(\((!?[-\/\.\w\pL]+)\)\)`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but the forward slash doesn't need to be escaped. Maybe merger can change it if it isn't already changed.
Currently the BOSH CLI doesn't allow to reference variables with leading slashes, i.e. ((/foo)) when using a vars-store file. It is only allowed when using credhub instead of vars-file. In our use case we want to provide manifest files which can be deployed using credhub as well as using the vars-store file.