Write value to file #210
theoephraim
started this conversation in
New Features
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Often as part of our secrets / config, we encounter certificates or other things that are usually stored in files. Especially if they are large, passing things around through env vars doesn't really make sense. So we want a way to use varlock to fetch the value and write it to a file. The overall goal would be to make this work for any plugin, and to probably keep the "fetch the value" part within an item value, rather than a decorator.
A few options / ideas:
Option 1 - new
filedata typeAdd a new data type called
filewhich is meant to save the contents of the item to a path, and then return the file path as the env var. Conceptually it's a little weirder but is relatively simple.Option 2 -
writeFileresolver which returns the pathKeep the value more related to being a file path, but have the data written as a side effect of a function. (Note that path is not a real type yet, but one that is planned on being added anyway).
Option 3 -
writeFileresolver which returns the file contentsBreak it up into 2 items, and have a
writeFilefunction that writes the file but returns the value rather than the path.In this case we may want another decorator to mark items that should not be injected as env vars (or could maybe use a naming convention). This one allows for validating both the path and the file contents independently, and is perhaps the most clear, but it's also a bit verbose.
We should also consider that often we wouldn't really need to inject the path as an env var because it is going to a known constant location, so you may not always need both items.
Beta Was this translation helpful? Give feedback.
All reactions