config

package
v0.3.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

	// OutputFileName name used for output path.
	OutputFileName = "decider.json"
	// DefaultInfoNamespace path for the info key.
	DefaultInfoNamespace = defaultNamespace + "/" + "info"
)

Variables

View Source
var ConfigDir = "/etc/dcdr"

ConfigDir default config directory.

View Source
var ExampleConfig = []byte(`
// Username = "dcdr admin"
// Namespace = "dcdr"
// Storage = "consul"

// Etcd {
//	 Endpoints = ["http://127.0.0.1:2379"]
// }

// Consul {
//	 Address = "127.0.0.1:8500"
// }

// Watcher {
//   OutputPath = "/etc/dcdr/decider.json"
// }

// Server {
//   JsonRoot = "dcdr"
//   Endpoint = "/dcdr.json"
// }

// Git {
//   RepoURL = "git@github.com:vsco/decider-test-config.git"
//   RepoPath = "/etc/dcdr/audit"
// }

// Stats {
//   Namespace = "decider"
//   Host = "127.0.0.1"
//   Port = 8126
// }`)

ExampleConfig an example config written by `dcdr init`

Functions

func OutputPath

func OutputPath() string

OutputPath path to write `OutputFileName`

func Path

func Path() string

Path path to config.hcl

Types

type Config

type Config struct {
	Username  string
	Namespace string
	Storage   string
	Consul    Consul
	Etcd      Etcd
	Redis     Redis
	Watcher   Watcher
	Git       Git
	Stats     Stats
	Server    Server
}

Config config struct for the `CLI`, `Client`, and `Server`

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a `Config` with default values.

func LoadConfig

func LoadConfig() *Config

LoadConfig reads config.hcl if found and merges with `DefaultConfig`.

func TestConfig

func TestConfig() *Config

TestConfig used for testing.

func (*Config) GitEnabled

func (c *Config) GitEnabled() bool

GitEnabled checks if a git repo has been configured.

func (*Config) PushEnabled

func (c *Config) PushEnabled() bool

PushEnabled checks if a git repo has a remote origin.

func (*Config) StatsEnabled

func (c *Config) StatsEnabled() bool

StatsEnabled checks if statsd has been configured.

type Consul added in v0.2.3

type Consul struct {
	Address string
}

Consul config struct for the consul store. Most of consul configuration is handled by environment variables

type Etcd added in v0.2.3

type Etcd struct {
	Endpoints []string
}

Etcd config struct for the etcd store.

type Git

type Git struct {
	RepoPath string
	RepoURL  string
}

Git config struct for the audit repo

type Redis added in v0.2.4

type Redis struct {
	Address string
}

Redis config struct for the redis store.

type Server

type Server struct {
	Endpoint string
	Host     string
	JSONRoot string
}

Server config struct for `dcdr server`

type Stats

type Stats struct {
	Namespace string
	Host      string
	Port      int
}

Stats config struct for statsd

type Watcher

type Watcher struct {
	OutputPath string
}

Watcher config struct for `dcdr watch`

Jump to

Keyboard shortcuts

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