Currently, I have a resources/application.conf
file which has the following keys:
development {
server = www.myapp.com
aws_key = my_aws_key
aws_secret = my_aws_secret
}
I would like to remove my aws_key
and aws_secret
from the file.
I was thinking of creating another file called resources/credentials.conf
and storing my personal authentications there.
credentials {
aws_key = my_aws_key
aws_secret = my_aws_secret
}
and then include
it some way in my application.conf
or merge that config to the Config
object in addition to application.conf
.
credentials.conf
would be git ignored. A sample file would be checked in credentials-sample.conf
which each developer would change according to his own credentials and rename the sample file to credentials.conf
I tried different variation of include
like
and so on.
I know I can pass it via system variables but I would like to try it like mentioned above. If you know of a better way, please let me know.
Typesafe Config provide the way to fallback from one configuration to another. You can try the ConfigFactory.Load() to load different config and use withFallback to line them up in your designated order. Such as:
ConfigFactory.Load("credentials.conf") withFallback ConfigFactory.Load("application.conf")