Skip to content
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

How to pass environment variables in JSON #282

Closed
bc-nikhil opened this issue Jul 26, 2019 · 7 comments
Closed

How to pass environment variables in JSON #282

bc-nikhil opened this issue Jul 26, 2019 · 7 comments
Assignees
Labels
feature-request New feature which can be introduced

Comments

@bc-nikhil
Copy link

Please suggest how to pass environment variables in JSON.
The scenario is I want to pass credentials from Jenkins as an environment variables.

@santhoshTpixler
Copy link
Collaborator

WRT #248 you can access the System properties like ${SYSTEM.PROP:host}. But are you sure you want to use the environment variables?
We would be happy to know more about your requirement.

@vkjha2000
Copy link
Collaborator

vkjha2000 commented Jul 27, 2019

@bc-nikhil , I would suggest please put some clarity(bit more details) around your question.

This will help everyone here and you might get an answer quicker(otherwise we keep on guessing your use-case and we might have to do a detective job here to get to the bottom of the issue).

Please visit this guidelines page(for how to raise an issue) :
https://github.com/authorjapps/zerocode/wiki/Guidelines-for-raising-issues

@bc-nikhil
Copy link
Author

bc-nikhil commented Jul 28, 2019 via email

@santhoshTpixler
Copy link
Collaborator

@bc-nikhil At present, we do not have support for fetching the environment variables. Only system properties are supported. We will provide it soon.

@santhoshTpixler santhoshTpixler added the feature-request New feature which can be introduced label Jul 28, 2019
@bc-mahesh
Copy link

We can pass system properties into scenario JSON definitions? Like can I use this -

web.username=SYSTEM.prop.username
web.password=SYSTEM.prop.password

The whole purpose of my question is that I don't want to hardcode the credentials in my JSON files, I need a way to pass those externally, so that anyone having access to the testing codebase won't see them.

@santhoshTpixler
Copy link
Collaborator

@bc-mahesh You can use ${SYSTEM.PROP:username} in you JSON which will be resolved to the System property username. But make sure you set the System property with -Dusername=myuser as an argument while running tests.

@authorjapps
Copy link
Owner

authorjapps commented Aug 7, 2019

"${SYSTEM.ENV:USER}"

Available in version 1.3.12 and higher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature which can be introduced
Projects
None yet
Development

No branches or pull requests

5 participants