-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
add support of hashmap in environment variables #52
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
I'm not familiar with this format. Do you have any examples of storing hashmap data in env var values like this in the wild? If possible I'd like to align with existing conventions |
Hmm, the only examples I saw they use kind of JSON syntax like: |
What is like to avoid is inventing a new syntax for env variables Can you link me to some example of those tools? |
In https://github.com/spf13/viper for example they support json syntax but also this kind of syntax: struct Cfg {
test: HashMap<String, String>,
} You can have some kind of |
In Javascript they also use JSON syntax as I see on stackoverflow. But TBH I didn't really find a lot of informations about this kind of issue. I think it's not very frequent |
I'm wondering if it might be more useful to assume less about the structure of values and just treat structured data as Env vars place a design constraint that you represent data as flat keys and values. That's what's currently exposed in envy. For specialized needs I can see a setup as follows Serialize a special value as a plain string in an env var then in an impl method, use a serde deserializer of your choice to deseriaze additional data from_str. In your case that might be json. In this case envy doesn't need to change and you have maximum flexibility to encode extra structure in what ever format you like. |
Prefixed var names are supported but carry a different but common convention. They namespace vars targeting an application |
I fully understand your concerns. And I am partially agree. What disturbing me is the fact that we support |
Hello, I wanted to add support of hashmap inside environment variable. I suggest this kind of syntax:
export FOO="{key:value, key2:value2}"
I'm open to any suggestions :)