Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/m-abs/env-in-template
https://github.com/m-abs/env-in-template
Last synced: 29 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/m-abs/env-in-template
- Owner: m-abs
- Created: 2018-11-19T10:05:18.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-22T05:27:56.000Z (over 2 years ago)
- Last Synced: 2024-04-13T16:25:34.840Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 67.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @nota/env-in-template
Simple script to inject variables from shell ENV into a file.
Useful when building a multistage docker image.
## Usage:
env-in-template INPUT_FILE OUTPUT_FILE**Example:**
Input file "input.json-tmpl" with this content:
```
{
<% if (typeof ssl !== 'undefined' && ssl) {
%>
"SSL": <% print(JSON.stringify(ssl)) %>,
<%
}
%>
"PATH": "<%= PATH %>"
}
```Run:
```bash
env-in-template input.json-tmpl output.json
```Creates "output.json" with this content:
```javascript
{"PATH": "/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin"
}
```Adding `ssl` to the environment variables:
```bash
ssl=1 env-in-template input.json-tmpl output.json
```Will create "output.json" with this content:
```javascript
{
"SSL": "1","PATH": "/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin"
}
```