-
Can we spread out our configuration in a .env file for Foreman across multiple lines?
-
At first I thought that this fix to Foreman allowed me break long confugrations across multiple lines the way that I wanted:
JAVA_OPTS=-Xmx384m -Xss512k \
-XX:+UseCompressedOops
MAVEN_OPTS=-Xmx384m -Xss512k -XX:+UseCompressedOops - But that's not the case as I found out via trial & error. Now I think its simply not supported.
-
At first I thought that this fix to Foreman allowed me break long confugrations across multiple lines the way that I wanted:
-
Can we spread out our configuration in a Procfile file for Foreman across multiple lines?
- Nope, trial & error resulted in the same deal as above.
-
BUT ... I found a nifty clue here, which allowed me to setup a workaround like this:
# contents of Procfile
web: ./webapp-runner.sh
# contents of webapp-runner.sh
java $JAVA_OPTS \
-Djavax.net.ssl.trustStore="cacerts.jks" \
-jar target/dependency/webapp-runner.jar --port $PORT target/*.war
Showing posts with label multiple. Show all posts
Showing posts with label multiple. Show all posts
Friday, March 1, 2013
Multiline config for Procfile and .env in Foreman
Sunday, October 31, 2010
How to list multiple encrypted passwords in properties files
Jasypt is an extremely useful toolkit for encrypting and decrypting passwords. It provides simple instructions for those who want to use Spring and load properties files with encrypted passwords in them.
But, what if you need to provide a whole series of usernames and passwords. How would you accomplish this?
Jasypt's out-of-the-box implementations only read one encrypted value per key=ENC(value) pair in a property file.
Here's a solution:
But, what if you need to provide a whole series of usernames and passwords. How would you accomplish this?
Jasypt's out-of-the-box implementations only read one encrypted value per key=ENC(value) pair in a property file.
Here's a solution:
- Override the EncryptablePropertyPlaceholderConfigurer's convertPropertyValue() method. Then you can split a list like the following:
listOfUsernamePasswords=LIST(username1,ENC(encryptedPassword1),username2,ENC(encryptedPassword2))
into separate values and only send the encrypted values to the parent convertPropertyValue() implementation to get the decrypted values.
- Sew the list back together as a string and return a value that now reads:
username1,password1,username2,password2
- You may be wondering as to who will do the work of breaking up these comma-separated values when they get to your spring bean? The answer is simple: Spring will! For ex: If you had configured you spring bean like so:
<bean id="someBean" class="com.MyBean">
and the multipleUsernamePasswords property is of type String[] in MyBean class, then StringArrayPropertyEditor will be used implicitly, which will break it up into a string array auto-magically. If you are interested, you can read this blog about how various structures interpret property values for Spring.
<property name="multipleUsernamePasswords" value="${listOfUsernamePasswords}" />
</bean>
- Now its up to use that String[] to your advantage in your code.
Labels:
comma separated values,
configure,
csv,
encryption,
Jasypt,
java,
list,
multiple,
properties,
security,
spring
Subscribe to:
Posts (Atom)