config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotAUrl = errors.New("not a url")

Functions

func DevKeyGeneration added in v0.1.8

func DevKeyGeneration() (string, string, string)

func ParseAddress

func ParseAddress(addr string) (string, error)

ParseAddress parses a URL with schemes file://, env://, or any other. Depending on the scheme it will return specific types of data:

* file:// will return a string with the file's contents

* env:// will return a string with the env var's contents

* Anything else will return the string as it was

On error, we return the original string along with the error. The caller can switch on ErrNotAUrl to understand whether it was the parsing step that errored or something else. This is useful to attempt to read a non-URL string from some resource, but where the original input may simply be a valid string of that type.

Types

type Config

type Config struct {
	*configutil.SharedConfig `hcl:"-"`

	Worker     *Worker     `hcl:"worker"`
	Controller *Controller `hcl:"controller"`

	// Dev-related options
	DevController        bool   `hcl:"-"`
	PassthroughDirectory string `hcl:"-"`
	DevControllerKey     string `hcl:"-"`
	DevWorkerAuthKey     string `hcl:"-"`
	DevRecoveryKey       string `hcl:"-"`
}

Config is the configuration for the boundary controller

func DevCombined

func DevCombined() (*Config, error)

func DevController

func DevController() (*Config, error)

DevController is a Config that is used for dev mode of Boundary controllers

func DevWorker

func DevWorker() (*Config, error)

DevWorker is a Config that is used for dev mode of Boundary workers

func LoadFile

func LoadFile(path string, wrapper wrapping.Wrapper) (*Config, error)

LoadFile loads the configuration from the given file.

func New

func New() *Config

func Parse

func Parse(d string) (*Config, error)

func (*Config) Sanitized

func (c *Config) Sanitized() map[string]interface{}

Sanitized returns a copy of the config with all values that are considered sensitive stripped. It also strips all `*Raw` values that are mainly used for parsing.

Specifically, the fields that this method strips are: - KMS.Config - Telemetry.CirconusAPIToken

type Controller

type Controller struct {
	Name              string    `hcl:"name"`
	Description       string    `hcl:"description"`
	Database          *Database `hcl:"database"`
	PublicClusterAddr string    `hcl:"public_cluster_addr"`

	// AuthTokenTimeToLive is the total valid lifetime of a token denoted by time.Duration
	AuthTokenTimeToLive         interface{} `hcl:"auth_token_time_to_live"`
	AuthTokenTimeToLiveDuration time.Duration

	// AuthTokenTimeToStale is the total time a token can go unused before becoming invalid
	// denoted by time.Duration
	AuthTokenTimeToStale         interface{} `hcl:"auth_token_time_to_stale"`
	AuthTokenTimeToStaleDuration time.Duration
}

type Database

type Database struct {
	Url                string `hcl:"url"`
	MigrationUrl       string `hcl:"migration_url"`
	MaxOpenConnections int    `hcl:"max_open_connections"`
}

type Worker

type Worker struct {
	Name        string   `hcl:"name"`
	Description string   `hcl:"description"`
	Controllers []string `hcl:"controllers"`
	PublicAddr  string   `hcl:"public_addr"`

	// We use a raw interface for parsing so that people can use JSON-like
	// syntax that maps directly to the filter input or possibly more familiar
	// key=value syntax. This is trued up in the Parse function below.
	TagsRaw interface{}         `hcl:"tags"`
	Tags    map[string][]string `hcl:"-"`
}

Jump to

Keyboard shortcuts

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