sam
10/11/2023, 3:15 PMdave08
10/11/2023, 3:34 PMsam
10/11/2023, 3:34 PMdave08
10/11/2023, 3:34 PMsam
10/11/2023, 3:35 PMdave08
10/11/2023, 3:36 PMsam
10/11/2023, 3:36 PMdave08
10/11/2023, 3:36 PMsam
10/11/2023, 3:37 PMdave08
10/11/2023, 3:37 PMsam
10/11/2023, 3:37 PMSOME_CAMEL_SETTING
will be automatically applied to someCamelSettingdave08
10/11/2023, 3:40 PMsam
10/11/2023, 3:40 PMEnvironmentVariablesPropertySource(true,true)
as a property sourcedave08
10/11/2023, 3:43 PMsam
10/11/2023, 3:44 PMdave08
10/11/2023, 3:45 PMsam
10/11/2023, 3:46 PMexport FOO=BAR
in a shell and then running intellijj from the same shelldave08
10/11/2023, 3:51 PMS3_CONFIGS__ACCESS_TOKEN
doesn't workSystem.getEnv()
returns itval configs = ConfigLoaderBuilder.default().apply {
addResourceSource("/application.yaml")
val envs = listOf("local")
envs.forEach {
addResourceSource("/application-$it.yaml", optional = true)
}
addEnvironmentSource()
}.build().loadConfigOrThrow<Settings>()
application.yaml
and application-local.yaml
object MyUppercaseParamMapper : ParameterMapper {
override fun map(param: KParameter, constructor: KFunction<Any>, kclass: KClass<*>): Set<String> =
setOfNotNull(param.name?.fold("") { acc, c -> if (c.isUpperCase()) acc + "_" + c.uppercaseChar() else acc + c.uppercaseChar() })
}
"s3Configs.accessToken".fold("") { acc, c -> if (c.isUpperCase()) acc + "_" + c.uppercaseChar() else acc + c.uppercaseChar() }
gives me:
S3_CONFIGS.ACCESS_TOKEN
but it still doesn't work... do I also need to convert the .
to __
sam
10/11/2023, 6:08 PMdave08
10/12/2023, 5:57 AMfun ConfigLoaderBuilder.addEnvironmentSource(
useUnderscoresAsSeparator: Boolean = true,
allowUppercaseNames: Boolean = true,
) = addPropertySource(
EnvironmentVariablesPropertySource(useUnderscoresAsSeparator, allowUppercaseNames)
)
with no params the default IS true, true