Reputation: 201
PFB the code which I used for getting environment variable but it is not working.
In application.conf
clientId = ${?clientId}
In Filters.scala
sys.env.get("clientId");
But it is "None".
If I type env in the respective environment, I could see the proper clientId which I set.
clientId = ba6ecff4-4aec-4298-8e98-f1f0b320249f
What is the right way to get the environment variable in Play Framework for scala 2.5.0?
Upvotes: 2
Views: 3313
Reputation: 8263
You override the value. Change the property name
Correct:
myClientId = ${?clientId}
Wrong:
clientId = ${?clientId}
Because you can reference variables from within other variables, ensure you don’t name your environmental variable the same as the field name.
Upvotes: 2