config

package
v2.0.73+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2017 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelSeparator = '/'   // The separator character.
	MaxMessageSize   = 65536 // Maximum message size allowed from/to the peer.
)

Constants used throughout the service.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterConfig

type ClusterConfig struct {
	NodeName   string `json:"node,omitempty"` // The name of the node to use.
	Broadcast  string `json:"broadcast"`      // The address to broadcast.
	Port       int    `json:"port"`           // The port used for gossip.'
	Seed       string `json:"seed"`           // The seed address (or a domain name) for cluster join.
	ClusterKey string `json:"key"`            // The cluster passphrase for the handshake.
}

ClusterConfig represents the configuration for the cluster.

func (*ClusterConfig) Key

func (c *ClusterConfig) Key() []byte

Key returns the key based on the passphrase

type Config

type Config struct {
	TCPPort string         `json:"tcp"`               // The API port used for TCP & Websocket communication.'
	TLSPort string         `json:"tls"`               // The API port used for Secure TCP & Websocket communication.'
	License string         `json:"license"`           // The port used for gossip.'
	Vault   *VaultConfig   `json:"vault,omitempty"`   // The configuration for the Hashicorp Vault.
	Cluster *ClusterConfig `json:"cluster,omitempty"` // The configuration for the clustering.
}

Config represents main configuration.

func NewDefault

func NewDefault() *Config

NewDefault creates a default configuration.

func ReadOrCreate

func ReadOrCreate(path string, stores ...SecretStore) (cfg *Config, err error)

ReadOrCreate reads or creates the configuration object.

func (*Config) HasVault

func (c *Config) HasVault() bool

HasVault checks whether hashicorp vault endpoint is configured.

type SecretStore

type SecretStore interface {
	Configure(c *Config) error
	GetSecret(secretName string) (string, bool)
}

SecretStore represents a contract for a store capable of resolving secrets.

type VaultConfig

type VaultConfig struct {
	Address     string `json:"address"` // The vault address to use.
	Application string `json:"app"`     // The vault application ID to use.
}

VaultConfig represents Vault configuration.

Jump to

Keyboard shortcuts

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