Skip to content

Replaces Placeholders starting from specific string from source file to destination file

Notifications You must be signed in to change notification settings

shahzaib-sheikh/replace-env-vars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

replace-env-vars

Bash script that replaces placeholders starting from specific string taking input from source file and writes it to destination file

Usage

./replace-env-vars.sh ./config.example.json ./config.json PLACEHOLDERS_START_STRING

Example

config.example.json

{
    "apiKey":"MY_COOL_APP_API_KEY",
    "apiUrl: "MY_COOL_APP_API_URL"
}

usually config files aren't mark to not tracked by vcs. so there might be no config.json so we will make one from script.

in teminal

./replace-env-vars.sh ./config.example.json ./config.json MY_COOL_APP

if MY_COOL_APP_API_KEY & MY_COOL_APP_API_URL are defined in environment as fsafjkwnefknafd & https://api.coolapp.com respctively then config.json will look like this

config.json

{
    "apiKey":"fsafjkwnefknafd",
    "apiUrl: "https://api.coolapp.com"
}

About

Replaces Placeholders starting from specific string from source file to destination file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages