#tera-templates #toml-config #tera #config-file #render-template #template #toml

bin+lib tmptoml

Renders Tera templates using a toml config file as the variable source

4 releases

0.1.3 Mar 22, 2022
0.1.2 Mar 22, 2022
0.1.1 Mar 17, 2022
0.1.0 Mar 16, 2022

#698 in Cargo plugins

MIT license

13KB
215 lines

TmpToml

Renders Tera templates using a toml config file as the variable source.

Installation

First and foremost you will need to install Rust, recommended via Homebrew:

brew install rust

Then build the tool:

cargo build

OR run the tool directly:

cargo run config.toml template.yaml qa system1

TmpToml Breakdown

Config.toml

config.toml is the main configuration file for the tool. It contains the variables and values that are used to render the templates. This file contains PUBLIC values that can be checked into source control. This file contains the following sections and secondary sections:

Sections

Sections are used to define the environment and anything that is shared amongst the templates.

  • qa
  • production

Secondary Sections

Secondary sections are used to define the specifics for each service/system.

  • system1
  • system2

Templates

Each template file contains variables and values are defined in the config.toml file. Variables are specificed using the {{variableName}} syntax. If a variable exists in the templated file but not in the config.toml, TmpToml will throw an error and the template will not be rendered. If a variable exists in the config.toml file but not in the referenced templated file, TmpToml will still render the template.

Example:

First render the template:

./tmptoml config.toml template.yaml qa system1

The breakdown of the above command:

  • ./tmptoml is the TmpToml binary.
  • config.toml is the path to the configuration file.
  • template.yaml is the path to the template file.
  • qa is the primary section/environment.
  • system1 is the name of the secondary section.

TmpToml renders the template file to STDOUT.

License

TmpToml is Copyright © 2022 Uptech Works LLC. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About uptech studio

TmpToml is maintained and funded by Uptech Studio, a software design & development agency & consultancy.

We love open source software. See our other projects or hire us to design, develop, and grow your product.

Dependencies

~9–19MB
~237K SLoC