Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nlewo/consul-template-mock
Render `consul-template` templates without Consul
https://github.com/nlewo/consul-template-mock
consul consul-template mock testing vault
Last synced: 12 days ago
JSON representation
Render `consul-template` templates without Consul
- Host: GitHub
- URL: https://github.com/nlewo/consul-template-mock
- Owner: nlewo
- License: gpl-3.0
- Created: 2018-06-21T09:41:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-11T07:25:00.000Z (almost 4 years ago)
- Last Synced: 2024-10-07T02:01:43.992Z (about 1 month ago)
- Topics: consul, consul-template, mock, testing, vault
- Language: Go
- Homepage:
- Size: 32.2 KB
- Stars: 5
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/nlewo/consul-template-mock.svg?branch=master)](https://travis-ci.org/nlewo/consul-template-mock)
`consul-template-mock` eats a JSON file to render a [`consul-template`](https://github.com/hashicorp/consul-template) template
for testing and development purposes.### Usage
```
$ consul-template-mock examples/trivial.tmpl examples/trivial.json
Rendered without Consul :/
```where [examples/trivial.tmpl](examples/trivial.tmpl) is a
`consul-template` template file and
[examples/trivial.json](examples/trivial.json) is a JSON file
describing input mock datas (see below for its format).### Installation
`go get github.com/nlewo/consul-template-mock`
### Mock JSON file format
```json
{ "service": {
"a_service": [{"Name":"with_its_name"}]},
"key": {
"a_key": "with_its_value"
},
"env": {"a_environment_variable": "with_its_value"},
"secret": {"a_secret_path":
{"a_secret": "****"}},
"file": {"a_filepath": "with_its_content"}
}
```See the `./examples` directory for more examples!
### Limitations
Only `consul-template` functions that I use are mocked, so just a
subpart of `consul-template` language is currently
supported. Contributions are welcome!