where to store jasypt password [WINDOWS]

Four Stars

where to store jasypt password [WINDOWS]

What is the best practice to store and access jasypt (env var) password for Runtime?

 

Linux - I have simple bash script in setenv file to read file with my password and export it to env. variable.

Windows - using talend-esb-wrapper. This approach does not work. One option how to export password into env variable and then use it by jasypt is to configure talend-esb-wrapper.conf: set.default.MY_JASYPT_PASSWORD=supersecretpassword.

 

Is there better approach on Windows servers how to export local environment variable (only for runtime process)?

Moderator

Re: where to store jasypt password [WINDOWS]

Hello,

We will make an investigation on your issue and then come back to you as soon as we can.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Sixteen Stars

Re: where to store jasypt password [WINDOWS]

You can do this with a bit of Java. I use a mthod like this....

 

 /**
     * getEnvironmentVariable: used to retrieve Environment Variables
     * 
     * {talendTypes} String
     * 
     * 
     * {param} string("JASYPT_Password") variableName: the parameter name to be returned

     * 
     * {example} getEnvironmentVariable("JASYPT_Password") # returns "My Password"
     */
	public static String getEnvironmentVariable(String variableName) {
		String returnVal = System.getenv(variableName);

		if (returnVal == null) {
			System.out.println(variableName
					+ " does not exist or holds no value");
		}

		return returnVal;
	}

However, you may be struggling for other reasons with the runtime. If you are using JASYPT to decrypt values you want to use in context variables, this won't work nicely in the runtime. You will need to use PropertyPlaceholders.

 

However, if you are just wanting to access the JASYPT password, the code above will work if you have set an appropriately named System Environment Variable and started your services after this has been set.