Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mozgiii/caddy-templatify-config
Convert JSON config file to Caddy template
https://github.com/mozgiii/caddy-templatify-config
caddy docker runtime-configuration spa template
Last synced: 14 days ago
JSON representation
Convert JSON config file to Caddy template
- Host: GitHub
- URL: https://github.com/mozgiii/caddy-templatify-config
- Owner: MOZGIII
- Created: 2018-03-12T21:24:19.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-06-15T20:37:22.000Z (over 3 years ago)
- Last Synced: 2024-11-20T06:25:09.223Z (3 months ago)
- Topics: caddy, docker, runtime-configuration, spa, template
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# caddy-templatify-config
A command line tool written for Node.js that takes a configuration
file in JSON format and converts it to template file that evaluates
the values from the environment variables when used as a template in a
Caddy web server.Useful to prepare config file templates for Caddy that's running in docker.
## Installation
Global:
```shell
npm install -g caddy-templatify-config
```As a dependency:
```shell
npm install --save-dev caddy-templatify-config
```or
```shell
yarn add --dev caddy-templatify-config
```## Usage
```shell
caddy-templatify-config [PREFIX]
```Tool reads the config file sample from stdin and writes the resulting
template to stdout:```shell
caddy-templatify-config < sample/config.json > template/config.json
```### Example
```shell
$ cat > config.js
{
"hello": "world"
}
$ cat config.js | caddy-templatify-config
{"hello":"{{ if .Env.HELLO }}{{ js .Env.HELLO }}{{ else }}world{{ end }}"}
```And with prefix:
```shell
$ cat config.js | caddy-templatify-config "MY_APP_"
{"hello":"{{ if .Env.MY_APP_HELLO }}{{ js .Env.MY_APP_HELLO }}{{ else }}world{{ end }}"}
```