I have a json file that has a template as a string ${varName}
, which I’m reading into a typescript object
It looks like this:
{
"log": "logfile-${profile}"
}
I want that ${profile}
to be replaced at runtime with the runtime profile value.
I know that string.replace(...)
is an option, but in case that value has hierarchy, such as profile.id
or profile.name
it gets to where my code has to be aware of all environment variables and their structure, and I want to keep that out of the way.
How can this be done?
Thanks.
1