This Banner is For Sale !!
Get your ad here for a week in 20$ only and get upto 15k traffic Daily!!!

Recursive replace input value with process environment values in console


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
Enter fullscreen mode

Exit fullscreen mode

Load file to present setting

export $(cat ./instance.env)

We derive the variable VAR1 within the typical approach

echo $VAR1

Outcome

var1${VAR2}
Enter fullscreen mode

Exit fullscreen mode

And now we’ll show the variable by way of the utility

echo $(npx -y rucken env-replacer $VAR1)

Outcome

var1var2VAR3$NO_REPLACE
Enter fullscreen mode

Exit fullscreen mode

The Article was Inspired from tech community site.
Contact us if this is inspired from your article and we will give you credit for it for serving the community.

This Banner is For Sale !!
Get your ad here for a week in 20$ only and get upto 10k Tech related traffic daily !!!

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to Contribute to us or want to have 15k+ Audience read your Article ? Or Just want to make a strong Backlink?