Merge pull request #6245 from corda/EG-1991-ConfigHelper-update

EG-1991 Ignore warning for CORDA environment variables in all caps
This commit is contained in:
Ivan Schasny 2020-05-13 15:37:42 +01:00 committed by GitHub
commit bd657fad65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,7 @@ object ConfigHelper {
private const val UPPERCASE_PROPERTY_PREFIX = "CORDA."
private val log = LoggerFactory.getLogger(javaClass)
@Suppress("LongParameterList")
fun loadConfig(baseDirectory: Path,
configFile: Path = baseDirectory / "node.conf",
allowMissingConfig: Boolean = false,
@ -88,7 +89,15 @@ object ConfigHelper {
return ConfigFactory.parseMap(
toProperties()
.mapKeys {
var newKey = (it.key as String)
val original = it.key as String
// Reject environment variable that are in all caps
// since these cannot be properties.
if (original == original.toUpperCase()){
return@mapKeys original
}
var newKey = original
.replace('_', '.')
.replace(UPPERCASE_PROPERTY_PREFIX, CORDA_PROPERTY_PREFIX)
@ -175,4 +184,4 @@ fun MutualSslConfiguration.configureDevKeyAndTrustStores(myLegalName: CordaX500N
else -> throw IllegalArgumentException("CryptoService not supported.")
}
}
}
}