Typically it’s good to change a part of the worth of an setting variable to a different variable
I made a utility for such a substitute
Hyperlinks
https://www.npmjs.com/package/rucken – npm bundle
https://github.com/rucken/rucken – supply code
https://github.com/rucken/rucken/blob/develop/libs/rucken/tests/e2e/env-replacer.spec.ts – e2e check
Instance of utilization
Create env file
instance.env
VAR1=var1${VAR2}
VAR2=var2$var3
var3=VAR3$NO_REPLACE
Load file to present setting
export $(cat ./instance.env)
We derive the variable VAR1 within the typical approach
echo $VAR1
Outcome
var1${VAR2}
And now we’ll show the variable by way of the utility
echo $(npx -y rucken env-replacer $VAR1)
Outcome
var1var2VAR3$NO_REPLACE