0.2.0 • Published 3 years ago

caddy-templatify-config v0.2.0

Weekly downloads
10
License
GPL-2.0
Repository
-
Last release
3 years ago

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:

npm install -g caddy-templatify-config

As a dependency:

npm install --save-dev caddy-templatify-config

or

yarn add --dev caddy-templatify-config

Usage

caddy-templatify-config [PREFIX]

Tool reads the config file sample from stdin and writes the resulting template to stdout:

caddy-templatify-config < sample/config.json > template/config.json

Example

$ cat > config.js
{
  "hello": "world"
}
$ cat config.js | caddy-templatify-config
{"hello":"{{ if .Env.HELLO }}{{ js .Env.HELLO }}{{ else }}world{{ end }}"}

And with prefix:

$ cat config.js | caddy-templatify-config "MY_APP_"
{"hello":"{{ if .Env.MY_APP_HELLO }}{{ js .Env.MY_APP_HELLO }}{{ else }}world{{ end }}"}
0.2.0

3 years ago

0.1.3

3 years ago

0.1.1

6 years ago

0.1.0

6 years ago