parse-nomad-config

command module
v0.0.0-...-e82c154 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 6 Imported by: 0

README

parse-nomad-config

parse-nomad-config parses one or more Nomad configuration files and prints the effective configuration as a JSON object or using a Go template.

Installation

Download a prebuilt release from the releases page.

or

Use the go install command to build and install the command from source.

go install github.com/angrycub/parse-nomad-config

Usage

usage: parse-nomad-config [options] [hcl-file ...]
  -j, --json              output in JSON format
  -o, --out string        write to the given file, instead of stdout
  -t, --template string   output using a go template
  -v, --version           show the version number and immediately exit

Examples

Given the following Nomad configuration file--server.hcl:

datacenter = "dc1"
data_dir   = "/opt/nomad/data"
log_level  = "DEBUG"

server {
  encrypt = "rn5HmQP/y1o2hvMxMfMYag=="
  enabled = true
}
Print the effective configuration as JSON
$ parse-nomad-config --json server.hcl

Some of the fields are suppressed when printed in JSON format. For example, the server.encrypt field is not included in JSON output. Public fields that are not printed in JSON can be retrieved by using the Go Template output option.

These fields will have different capitalization and occasionally different names. You can use the "%+v" format string to explore the Config structure or consult the nomad.command.agent.Config type for the full type specification.

Retrieve the encrypt value using a Go Template
$ parse-nomad-config --template '{{ printf "%+v" .Server.EncryptKey}}' server.hcl
rn5HmQP/y1o2hvMxMfMYag==

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL