
Enables centralized configuration management with multi-stage and multi-region support using wildcard entries, eliminating runtime environment variables and facilitating seamless deployment and parameter management.
This library is meant to enable a centralized multi-stage and multi-region configuration for configurational parameters, using wildcard entries.
It adds to the following use-cases:
Steps to onboard:
implementation("org.agraman4u.appconfig:app-config-parser-jvm:1.0")
configuration/app-config directory in your project root folder.mkdir configuration/app-config
SampleApp for the explanationAPPLICATION_NAME: "SampleApp"
<any-value>.APPLICATION_NAME.conf. File contents need to be in the following schema:<stage>.<region>.<identifier> += {
"<key1>": "<value1>",
"<key2>": "<value2",
}
a) stage: The deployment stage. Insert * for wildcard
b) region: The deployment region. Insert * for wildcard
c) identifier: Custom identifier for the set of configurations. Wildcard noy supported
Example Config (also in configuration/config.AppConfigTest.conf:
*.*.databaseDriverConfig += {
"name": "hello world",
"password": "hello",
"id": "40"
}
prod.*.databaseDriverConfig += {
"name": "hello world prod",
"password": "hello prod",
"id": "41"
}
prod.WestUs2.databaseDriverConfig += {
"name": "hello world prod west us",
"password": "hello prod west us",
"id": "42"
}
tasks.register<Copy>("copy-configuration") {
println("Copying config files")
from(layout.projectDirectory.dir("configuration"))
into(layout.buildDirectory.dir("configuration"))
mustRunAfter("compileJava")
}
import org.agraman4u.appconfig.AppConfig
AppConfig.initAppConfig(APPLICATION_NAME, DEPLOYMENT_STAGE, DEPLOYMET_REGION)
val databaseName=AppConfig.get<String>("databaseDriverConfig", "name")
Thats it. You are good to go! Hurraay!
This library is meant to enable a centralized multi-stage and multi-region configuration for configurational parameters, using wildcard entries.
It adds to the following use-cases:
Steps to onboard:
implementation("org.agraman4u.appconfig:app-config-parser-jvm:1.0")
configuration/app-config directory in your project root folder.mkdir configuration/app-config
SampleApp for the explanationAPPLICATION_NAME: "SampleApp"
<any-value>.APPLICATION_NAME.conf. File contents need to be in the following schema:<stage>.<region>.<identifier> += {
"<key1>": "<value1>",
"<key2>": "<value2",
}
a) stage: The deployment stage. Insert * for wildcard
b) region: The deployment region. Insert * for wildcard
c) identifier: Custom identifier for the set of configurations. Wildcard noy supported
Example Config (also in configuration/config.AppConfigTest.conf:
*.*.databaseDriverConfig += {
"name": "hello world",
"password": "hello",
"id": "40"
}
prod.*.databaseDriverConfig += {
"name": "hello world prod",
"password": "hello prod",
"id": "41"
}
prod.WestUs2.databaseDriverConfig += {
"name": "hello world prod west us",
"password": "hello prod west us",
"id": "42"
}
tasks.register<Copy>("copy-configuration") {
println("Copying config files")
from(layout.projectDirectory.dir("configuration"))
into(layout.buildDirectory.dir("configuration"))
mustRunAfter("compileJava")
}
import org.agraman4u.appconfig.AppConfig
AppConfig.initAppConfig(APPLICATION_NAME, DEPLOYMENT_STAGE, DEPLOYMET_REGION)
val databaseName=AppConfig.get<String>("databaseDriverConfig", "name")
Thats it. You are good to go! Hurraay!