config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Vault   VaultConfig            `hcl:"vault,block"`
	Plugins []plugins.PluginConfig `hcl:"plugin,block"`
}

func NewConfig

func NewConfig(filename string, src []byte) (*Config, error)

NewConfig decodes an HCL configuration file into a Config struct, returning an error upon failure. It takes filename as a parameter to use in error messages while parsing, and a byte slice containing the actual configuration itself. It then uses hclsimple to parse the configuration and validates it using Config.Validate() before returning it. If this function returns without an error then the config should be valid to use.

func NewConfigFromFile

func NewConfigFromFile(filename string) (*Config, error)

NewConfigFromFile reads the file from filename and calls NewConfig with its contents

func (*Config) Validate

func (c *Config) Validate() error

type SSH

type SSH struct {
	Hostname string `hcl:"hostname"`
	Username string `hcl:"username"`
	Password string `hcl:"password"`
	Port     uint   `hcl:"port"`
}

type VaultConfig

type VaultConfig struct {
	VaultAddress string `hcl:"api_address"`
	VaultToken   string `hcl:"token"`
	SSHConfig    []SSH  `hcl:"ssh,block"`
}

func (*VaultConfig) Validate

func (c *VaultConfig) Validate() error

func (*VaultConfig) WriteHCL

func (c *VaultConfig) WriteHCL(hclBody *hclwrite.Body)

WriteHCL uses the hclwrite package to encode itself into HCL. It supports $ENVVARS for the string values, in that format. This allows users in a wizard to specify the string params in a shell-like syntax, which will then be serialised into the HCL syntax of env("ENVVARS")

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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