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 access to environment variables in karate-config.js #547
Comments
this is supported: please refer: https://github.com/intuit/karate#dynamic-port-numbers |
I was referring to environment variables defined by Thanks for the help and keep up the good work! |
@ianrenauld AH. sorry, I read some of these issues in a hurry. I think you have a reasonable workaround as follows, hurray for Java interop ;) var systemPath = java.lang.System.getenv('PATH');
|
Yes! This is amazing, thank you so much! |
Can you please show how we can access the environment variables from feature file or from karate-config.js? But it did not work. Also tried adding in feature file in the "Background" Section as
But this hasn't worked too. My requirement is that code needs to be deployed on Google Cloud Platform and read the values from the environment variables that are set there. |
@stutipai please use stack overflow: https://stackoverflow.com/a/52821230/143475 |
There seems to be a little confusion on what karate.properties[] fetches. Does it pick the values for variables only when supplied from the mvn command or is it capable of recognising the environment variables from Gitlab storage? |
environment. I am locking this thread |
This is more a feature request than a bug...
When I try to access environment variables in karate-config.js I get an error when
process.env.my_variable
is seen in the code (error is 'javascript function call failed: "ReferenceError: "process" is not defined'). This is the way we access environment variables in Node.js, but I think that the karate-config.js file does not support these types of Node.js extensions to Javascript?I like the ability to set my environment through karate.env, but I have some configurable elements (a proxy address, which is often specified in the HTTPS_PROXY environment variable) that is not fixed for a specific environment, but can still be changed. I thought I would be able to set my proxy by reading that environment variable and setting the proxy in karate-config.js, but it seems reading environment variables is not supported. I think this might be worthwhile to add to give a bit more flexibility for complex environments.
The text was updated successfully, but these errors were encountered: