-
Notifications
You must be signed in to change notification settings - Fork 382
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
support emerging _FILE convention #130
Comments
Just wanted to say that this would be great! |
I can totally see the usefulness. For the time being you could definitely implement this on individual fields with a custom decoder that goes and reads the file itself. That's been my answer to a lot of feature requests, and it's a nice way to keep |
I think @teepark had answered @bradrydzewski 's question. |
the answer also indicates first class support could make sense. If that is the case I would be happy to send a pull request. If not, I completely understand and this issue can be closed. |
@bradrydzewski |
I understand this can be achieved with custom decoders. I am interested in contributing a patch to support this natively. If this is out-of-scope for the project I completely understand and this can be closed. We need this feature and we use this library for 100+ repositories ,and are therefore comfortable maintaining our own fork if needed. |
I can feel your enthusiasm from the comment. Could you talk about the advantage and disadvantage if you want to send the PR. I expect I can hear about the feature brings value except for the technical layer, how about it effect this community? If it encounters bottleneck, how does it maintain and optimize in the future? |
Personally, I am sorry to talk about that. If there is a core goal or focused solution goal, we think we can define the behavior and functionality to complete the target. If it does thing is not on the track, we should stop that and introspect, maybe it's over-engineering. I am not sure, it's correct or wrong. But at least, we have Github this platform provides discussion chance to make engineers communicate. Please use here and express your idea. Before taking actions, I want to know how you think. |
Just to chime in, I am very much in favour of this, it would be fantastic! Docker swarm is not going to be dying anytime soon it seems, so this request will probably only be coming more and more ;) |
This is a great idea and I'd love to see @bradrydzewski's PR get merged. |
@teepark what about an option to provide a custom lookup function or interface? It would require some minor refactoring but people could add their own custom lookup and their own custom tags, thus giving a path to customization without having to expand the scope of this repository (or maintain a fork). p := envconfig.New()
p = envconfig.NewPrefix("FOO_") // alternate constructor
p.Lookup = func(info VarInfo) (bool, string) { /* custom logic */ }
p.Process(spec) Note that this would not replace or remove the existing global |
I think it's important to limit the scope of this library. If we don't stop at files, then soon people will want us to load data from secrets managers and key/value stores. Custom lookup functions make sense to me and I think it's the right path forward. |
I'll ask a very basic question: How would the scenario described in the original issue (i.e. picking either Maybe I am missing something, but from what I understand a custom decoder would only allow me to check whether the provided env value might be a file and then try to read it (which means I'd have to define |
I was wondering if there was interest in supporting an emerging pattern in the container world:
For example, the
POSTGRES_PASSWORD
environment variable can also be sourced from a file, wherePOSTGRES_PASSWORD_FILE
provides the path to the file. This pattern is very useful when you are targeting kubernetes and swarm environments, that provide the ability to source secrets from a mounted file.This could be supported with an optional tag:
I would be open to sending a pull request, if there was interest in this capability.
The text was updated successfully, but these errors were encountered: