config

package
v0.0.0-...-daf3ae0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2016 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Riak

type Riak struct {
	// RiakHosts is a json  array of host and server_name strings hash.
	//  server_name can be blan, if blank then host will be used
	// Example:
	//	[
	//		{
	//		  "host": "c1.test.org",
	//		  "server_name": "c1"
	//		},
	//		{
	//		  "host": "c2.test.org"
	//		}
	//	]
	RiakHosts string `envconfig:"RIAK_HOSTS"`
	// RiakHTTPPort is the port where http listens on riak cluster
	RiakHTTPPort int `envconfig:"RIAK_HTTP_PORT"`
	// RiakPBPort is the port where protobuffer listens on riak cluster (required)
	RiakPBPort int `envconfig:"RIAK_PB_PORT"`
	// RiakUser is the user which app will connect to execute riak actions
	RiakUser string `envconfig:"RIAK_USER"`
	// RiakPass is the password which app will connect to execute riak actions
	RiakPass string `envconfig:"RIAK_PASSWORD"`
	// RiakRootCaCertPath path to the root CA certificate used to authenticate the TLS connection with riak server
	RiakRootCaCertPath string `envconfig:"RIAK_ROOT_CA_PATH"`
	// RiakRootCaCert Root CA cert content file (alternative to RIAK_ROOT_CA_PATH)
	RiakRootCaCert string `envconfig:"RIAK_ROOT_CA"`
	// RiakInsecureTLS makes an insecure TLS connection (we should be sure of the riak server and no MitM attacks are possible)
	RiakInsecureTLS int `envconfig:"RIAK_INSECURE_TLS",default:"0"`

	// RiakClusterHosts is a custom attr to set the riak cluster hosts in the correct way
	RiakClusterHosts []*RiakHost
}

Riak holds riak configuration

func (*Riak) LoadRiakConfigFromEnv

func (r *Riak) LoadRiakConfigFromEnv()

LoadRiakConfigFromEnv Loads riak configuration from enviroment setting defaults if not preset

type RiakAPI

type RiakAPI struct {
	// RiakAPIUsername is the user used to authenticate against the API service
	RiakAPIUsername string `envconfig:"RIAKAPI_USERNAME"`

	// RiakAPIPassword is the password used to authenticate against the API service
	RiakAPIPassword string `envconfig:"RIAKAPI_PASSWORD"`

	// RiakAPISalt is the salt used for the password creation
	RiakAPISalt string `envconfig:"RIAKAPI_SALT"`
}

RiakAPI holds the configuration for the riak api service configuration

func (*RiakAPI) LoadRiakAPIConfigFromEnv

func (r *RiakAPI) LoadRiakAPIConfigFromEnv(riakCfg *Riak)

LoadRiakAPIConfigFromEnv loads the riakapi service configuration from the env

type RiakHost

type RiakHost struct {
	Host       string `json:"host"`
	ServerName string `json:"server_name,omitempty"`
}

RiakHost is a helper struct for decoding json configuration

type SSH

type SSH struct {
	// SSHHost is the host where ssh will connect to execute riak-admin commands
	SSHHost string `envconfig:"SSH_HOST"`
	// SSHPort is the port where ssh will connect to execute riak-admin commands
	SSHPort int `envconfig:"SSH_PORT"`
	// SSHUser is the user which ssh will connect to execute riak-admin commands (needs passwordless sudo for riak-admin)
	SSHUser string `envconfig:"SSH_USER"`
	// SSHPassword is the password which ssh will connect to execute riak-admin commands
	SSHPassword string `envconfig:"SSH_PASSWORD"`
	// SSHPrivateKey is the private key which ssh will connect to execute riak-admin commands
	SSHPrivateKey string `envconfig:"SSH_PRIVATE_KEY"`

	// SSHAuthMethods internal variable with the ssh auth methods prepared based on the settings provided
	SSHAuthMethods []ssh.AuthMethod
}

SSH holds SSH configuration

func (*SSH) LoadSSHConfigFromEnv

func (s *SSH) LoadSSHConfigFromEnv(riakCfg *Riak)

LoadSSHConfigFromEnv Loads SSH env and populates to default ones

type ServiceConfig

type ServiceConfig struct {
	*Riak
	*SSH
	*RiakAPI

	*config.Server
}

ServiceConfig holds all the configuration of the application

func NewServiceConfig

func NewServiceConfig() *ServiceConfig

NewServiceConfig creates a service config instance

func (*ServiceConfig) LoadConfiguration

func (s *ServiceConfig) LoadConfiguration()

LoadConfiguration loads application configuration

Jump to

Keyboard shortcuts

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