Skip to content

Commit

Permalink
Update the README for v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
albertrdixon committed Mar 12, 2015
1 parent 4285778 commit c142dd1
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,53 @@ RUN curl -#kL https://github.com/albertrdixon/tmplnator/releases/download/<versi

## Usage

Super simple. Use the following methods in the template to set up how the file should be generated from the template: `destination` `mode` `user` `group`
Help Menu:

```
Usage of ./t2:
-bpool-size="": Size of write buffer pool
-default-dir="": Default output directory
-delete="": Remove templates after processing
-etcd-peers=: etcd peers in host:port (can be provided multiple times)
-namespace="": etcd key namespace
-template-dir="": Template directory
-threads="": Number of processing threads
-v="": Verbosity (0:quiet output, 1:default, 2:debug output)
-version="": show version
```

Super simple. Use the following methods in the template to set up how the file should be generated from the template: `dir` `mode` `user` `group`

```
# example supervisor.conf template
{{ destination . "/etc/supervisor" }}
{{ mode . 0644 }}
{{ user . 0 }}
{{ group . 0 }}
{{ dir "/etc/supervisor" }}
{{ mode 0644 }}
{{ user 0 }}
{{ group 0 }}
[supervisord]
nodaemon = true
...
```

Add your templates to some directory: `ADD configs /templates`

Run tmplnator like so: `t2 -td /templates`
Run tmplnator like so: `t2 -template-dir /templates`

And that's it!

## Template Functions

Access environment variables in the template with `.Env` like so `.Env.VARIABLE`

`destination . "/path/to/destination/dir"`: Describe destination directory
Access etcd values with `.Var <key>` if key not found will look in ENV

`dir "/path/to/destination/dir"`: Describe destination directory

`mode . <file_mode>`: Describe filemode for generated file
`mode <file_mode>`: Describe filemode for generated file

`user . <uid>`: Describe uid for generated file
`user <uid>`: Describe uid for generated file

`group . <gid>`: Describe gid for generated file
`group <gid>`: Describe gid for generated file

`to_json <input>`: Marshal JSON string

Expand Down

0 comments on commit c142dd1

Please sign in to comment.