https://kotlinlang.org logo
#gradle
Title
# gradle
m

Moroa Matshubeni

03/27/2024, 8:15 AM
Greetings all, I'm a newcomer to the JVM realm. I'm interested in examples of crafting a build script capable of substituting parameters within a configuration file (such as application.config) with secrets and environment variables sourced from GitHub during the deployment process.
v

Vampire

03/27/2024, 8:50 AM
Assuming with "during deployment process" you mean at build time, you can just have placeholders in your resource file that you then expand by configuring the
processResources
task, for example using
expand(...)
. Make sure to also use
filesMatching
to only work on intended files and to set the filter encoding appropriately. But also consider maybe not baking in such secrets, but supplying them at runtime somehow.
v

Vampire

03/28/2024, 6:57 PM
You really should set the filtering charset, unless you are super sure that you only use basic ASCII in that file. :-)
s

solonovamax

03/28/2024, 6:57 PM
true I did just grab those quickly bc ik that this example project used the task to do that already so it's a decent example
👌 1
👊 1