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

Library templates should use Rego methods, not string substitution #61

Closed
maxsmythe opened this issue Nov 8, 2019 · 1 comment
Closed

Comments

@maxsmythe
Copy link
Contributor

maxsmythe commented Nov 8, 2019

This code:

		if err := libTempl.Execute(libBuf, map[string]string{
			"ConstraintsRoot": fmt.Sprintf(`data.constraints["%s"].cluster["%s"]`, t.GetName(), constraintGroup),
			"DataRoot":        fmt.Sprintf(`data.external["%s"]`, t.GetName()),
		}); err != nil {
			return err
		}

Should be unnecessary. It would be nice if we could use strings of un-modified Rego and access various roots via import statements and/or helper functions.

This would make it easier to build and test TargetHandler library code while still abstracting away the root of the constraint and data trees.

@willbeason
Copy link
Member

We no longer use string substitution for this, via #202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants