Fetching sensitive data from application.conf

Tags: , ,

I am trying to understand someone elseĀ“s Gradle project and need some help in understanding the syntax. In resources->application.conf there is configuration for username and password written this way:

    username = ${?USERNAME}
    password = ${?PASSWORD}

Where does that syntax mean and where do I get the values of username and password? I am currently using intelliJ IDEA. If I know the values of sensitive data, is there anyway I can save these values without exposing them in the code?



That’s a system property, so the actual value would be determined at runtime from a property (e.g. passing -DUSERNAME=zimmer in a run script).

The way you could save them would be to have your run script pass the property, if you don’t want to specify it manually every time.

Environment variables would be accessed with $System.env.USERNAME style, so my earlier answer assumed that it would search both system properties and env variables.

Source: stackoverflow