I'm having config issues in Grails 3 and want to hook into the config setup process, unless there's a better way
We have a plugin(jasypt) that requires config set in the application.yml or it throws errors(example below). We need to set the config values in runtime.groovy, but they don't override any values set in the yml
application.yml
jasypt:
algorithm: "PBEWITHSHA256AND256BITAES-CBC-BC"
providerName: "BC"
password: "-"
keyObtentionIterations: 10
runtime.groovy
jasypt {
algorithm = ExternalSecureKeyConfig.getInstance().jasypt.algorithm
providerName = ExternalSecureKeyConfig.getInstance().jasypt.providerName
password = ExternalSecureKeyConfig.getInstance().jasypt.password
keyObtentionIterations = ExternalSecureKeyConfig.getInstance().jasypt.keyObtentionIterations
}
Debugging during startup and runtime shows that none of the config gets overridden (password stays "-"). If I move config from the yml to application.groovy the runtime values get applied but I get the following error on startup
org.jasypt.exceptions.EncryptionInitializationException: If "encryptorRegisteredName" is not specified, then "password" (and optionally "algorithm" and "keyObtentionIterations") must be specified
Currently I'm hoping I can manually set the jsypt config values or hook into the groovy config setup to ensure they override the prev set yml values. Having trouble figuring how to do this or if it's possible
jasypt v 2.0.2 with Grails 3.3.10 (hibernate5, gorm 6.1)
Solve
Overriding the application.yml config with values from a custom config file. Still find is strand the runtime.groovy doesn't override yml config values.