in app/load/AppLoader.scala [22:51]
private def buildConfig(context: Context): Try[Config] = {
val credentialsProvider = DefaultCredentialsProvider.builder.profileName(awsProfileName).build()
val isDev = context.environment.mode == Mode.Dev
def configFor(appIdentity: AppIdentity) = {
ConfigurationLoader.load(appIdentity, credentialsProvider) { case identity: AwsIdentity =>
ComposedConfigurationLocation(
List(
SSMConfigurationLocation.default(identity),
ResourceConfigurationLocation(s"${identity.stage}.conf"),
)
)
}
}
// To validate the SSL certificate of the RDS instance - remove this and the associated params when we no longer use RDS
def configureTrustStore(config: Config) = {
System.setProperty("javax.net.ssl.trustStore", config.getString("trustStore.path"))
System.setProperty("javax.net.ssl.trustStorePassword", config.getString("trustStore.password"))
}
if (isDev)
Try(configFor(AwsIdentity(app = appName, stack = awsProfileName, stage = "DEV", region = "eu-west-1")))
else
for {
identity <- AppIdentity.whoAmI(defaultAppName = appName, credentialsProvider)
config <- Try(configFor(identity))
_ <- Try(configureTrustStore(config))
} yield config
}