-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Default values for environment variables #3382
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
Comments
Although it shouldn't be overly complicated to make sure all needed environment variables are set before execution, I can see this could sometimes be useful and make configuration easier. I got a feeling that Are you interested to implement this and provide a PR? I can help if needed. |
One of my project consists of lot of services, each of them running the same RF-tests repository (all of them have common keywords, resources, libraries, etc.) with different tags which helps to start the correct tests. The main issue is -- each service can be started on different envs and have lot of configuration differences (here are several dev teams creating these services) -- so defaults is very important for me. As for PR -- i would like to try! Anyway, you can always say what i did wrong in PR. However, i didn't contribute in RF code earlier so if you have some suggestions -- i'd appreciate! |
@pekkaklarck pls see #3384 PR |
Yeah, there definitely are use cases where this would help. Robot's own acceptance test runner sets a Python interpreter and OS specific Implementing this would actually be pretty simple. The code related to finding environment variables is pretty simple and editing it to split the possible default value from the name and returning it if there's no match shouldn't be hard either. You'd need to also create some acceptance tests and update docs. To get started, see the contributing guidelines. If you have questions, don't hesitate to ask here or on the |
Didn't see you earlier comment or the PR when I wrote my previous comment. Good start with the PR but some changes are needed. |
@pekkaklarck pls review #3384 one more time... |
Uh oh!
There was an error while loading. Please reload this page.
Hello!
All of my projects uses a bunch of env vars for configuration.
Sometimes these needs to have some defaults.
As a workaround i made a keyword with
OperatingSystem.Get Environment Variable
and try to load the env var there or put default. The cons of it is -- any keyword, which uses my env var's value need to get that 'loading' keyword running. It seems to be silly.I'd like to have some default value feature in the
%{}
structure.For example:
or
%{MY_ENV_VAR:-default_value_if_missing}
to mimic bash
${a:-b}
structure.It seems not so hard to implement such behavior.
The text was updated successfully, but these errors were encountered: