Conversation
src/kontrol/utils.py
Outdated
| if '=' not in line: | ||
| continue | ||
| key, value = line.split('=', 1) | ||
| key = key.strip() |
There was a problem hiding this comment.
Does strip() also remove inner whitespaces? If not, it would accept some invalid keys, such as MY KEY.
There was a problem hiding this comment.
@lisandrasilva @anvacaru I think it may be better to use a library for parsing env files, like https://github.com/theskumar/python-dotenv. .env files are more complex than they seem; for example, they typically also allow referencing each other. However, I can also understand if we don't want to introduce another dependency.
|
@lisandrasilva @anvacaru I'm wondering what's the best way to propagate environment variables into the initial konfiguration from a user perspective. So far, we're propagating all variables from the .env file in the Foundry root folder. However, we're not propagating variables from the actual environment in which the kontrol command is running. What do you think about the following approach?
|
|
Additionally, we require a method to initialize environment variables with symbolic values. |
Isn't it a bit dangerous to read all environment variables, since some of them can contain sensitive information? As a user, I think I would never use this option. But I do agree with options 1. and 3. Regarding a method to initialize environment variables with symbolic values, the user can achieve this by providing the default value as a symbolic value rather than a concrete one. |
|
@RaoulSchaffranek and @anvacaru, right now, the function that I implemented is able to parse the following file: @RaoulSchaffranek I also implemented the Let me know if there's anything else you would like me to address. |
This PR adds
envOr(...)cheatcodes.There are some design choices to consider:
--set-env-var name value. These variables are then stored in a new subconfiguration<envVars>and always read from there.