Skip to content
/ tmptoml Public

Rust CLI tool for parsing toml config files to use in templated files.

License

Notifications You must be signed in to change notification settings

uptech/tmptoml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TmpToml

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

Installation

macOS

To install on macOS we provide a Homebrew tap which provides the tmptoml formula. You can use it by doing the following:

Add the Tap

brew tap "uptech/homebrew-oss"

brew install

brew install uptech/oss/tmptoml

Build from Source

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.