caddy-templatify-config

0.2.0 • Public • Published

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 }}"}

Readme

Keywords

none

Package Sidebar

Install

npm i caddy-templatify-config

Weekly Downloads

58

Version

0.2.0

License

GPL-2.0

Unpacked Size

4.19 kB

Total Files

11

Last publish

Collaborators

  • mozgiii
  • sesh92