config

package
v4.3.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2016 License: MIT Imports: 8 Imported by: 5

Documentation

Overview

Package config provides data structures for Application configurations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CassandraConfig

type CassandraConfig struct {
	Hosts             []string
	ProtoVersion      int
	Port              int
	Keyspace          string
	NumConns          int
	Consistency       string
	MaxPreparedStmts  int
	MaxRoutingKeyInfo int
	PageSize          int
}

type CassandraDBConfig

type CassandraDBConfig struct {
	TSMetric        *gocql.ClusterConfig
	TSMetricSession *gocql.Session

	TSLog        *gocql.ClusterConfig
	TSLogSession *gocql.Session

	TSEvent        *gocql.ClusterConfig
	TSEventSession *gocql.Session
}

CassandraDBConfig stores all database configuration data.

func NewCassandraDBConfig

func NewCassandraDBConfig(generalConfig GeneralConfig) (*CassandraDBConfig, error)

NewCassandraDBConfig connects to all the databases and returns them in CassandraDBConfig instance.

type EmailConfig

type EmailConfig struct {
	From          string
	SubjectPrefix string
	Host          string
	Port          int
	Username      string
	Password      string
	Identity      string
}

EmailConfig stores all email configuration data.

type GeneralConfig

type GeneralConfig struct {
	Addr                    string
	LogLevel                string
	CookieSecret            string
	RequestShutdownTimeout  string
	EnablePeriodicPruneJobs bool
	JustAPI                 bool
	VIPAddr                 string
	VIPProtocol             string

	PostgreSQL struct {
		DSN                string
		MaxOpenConnections int64
	}

	LocalAgent struct {
		GraphiteTCPPort       string
		ReportMetricsInterval string
	}

	RateLimiters struct {
		PostSignup int
		GeneralAPI int
	}

	HTTPS struct {
		CertFile string
		KeyFile  string
	}

	MessageBus struct {
		URL   string
		Peers []string
	}

	Hosts struct {
		PostgreSQL PostgreSQLPerClusterConfig
	}

	Metrics struct {
		PostgreSQL    PostgreSQLPerClusterConfig `toml:",omitempty"`
		Cassandra     CassandraConfig            `toml:",omitempty"`
		DataRetention int
	}

	Events struct {
		PostgreSQL    PostgreSQLPerClusterConfig `toml:",omitempty"`
		Cassandra     CassandraConfig            `toml:",omitempty"`
		DataRetention int
	}

	Logs struct {
		PostgreSQL    PostgreSQLPerClusterConfig `toml:",omitempty"`
		Cassandra     CassandraConfig            `toml:",omitempty"`
		DataRetention int
	}

	Checks struct {
		Email *EmailConfig

		SMSEmailGateway map[string]string

		PostgreSQL PostgreSQLPerClusterConfig

		DataRetention int
	}

	Email *EmailConfig
}

GeneralConfig stores all configuration data.

func NewGeneralConfig

func NewGeneralConfig(configDir string) (config GeneralConfig, err error)

NewGeneralConfig is the constructor for GeneralConfig.

func (GeneralConfig) GetEventsDBType

func (conf GeneralConfig) GetEventsDBType() string

func (GeneralConfig) GetLogsDBType

func (conf GeneralConfig) GetLogsDBType() string

func (GeneralConfig) GetMetricsDBType

func (conf GeneralConfig) GetMetricsDBType() string

type PGDBConfig

type PGDBConfig struct {
	Core                *sqlx.DB
	Host                *sqlx.DB
	HostByClusterID     map[int64]*sqlx.DB
	TSMetric            *sqlx.DB
	TSMetricByClusterID map[int64]*sqlx.DB
	TSEvent             *sqlx.DB
	TSEventByClusterID  map[int64]*sqlx.DB
	TSLog               *sqlx.DB
	TSLogByClusterID    map[int64]*sqlx.DB
	TSCheck             *sqlx.DB
	TSCheckByClusterID  map[int64]*sqlx.DB
}

PGDBConfig stores all database configuration data.

func NewPGDBConfig

func NewPGDBConfig(generalConfig GeneralConfig) (*PGDBConfig, error)

NewPGDBConfig connects to all the databases and returns them in PGDBConfig instance.

func (*PGDBConfig) GetHost

func (dbconf *PGDBConfig) GetHost(clusterID int64) *sqlx.DB

func (*PGDBConfig) GetTSCheck

func (dbconf *PGDBConfig) GetTSCheck(clusterID int64) *sqlx.DB

func (*PGDBConfig) GetTSEvent

func (dbconf *PGDBConfig) GetTSEvent(clusterID int64) *sqlx.DB

func (*PGDBConfig) GetTSLog

func (dbconf *PGDBConfig) GetTSLog(clusterID int64) *sqlx.DB

func (*PGDBConfig) GetTSMetric

func (dbconf *PGDBConfig) GetTSMetric(clusterID int64) *sqlx.DB

type PostgreSQLPerClusterConfig

type PostgreSQLPerClusterConfig struct {
	DSN                string
	MaxOpenConnections int64
	DSNByClusterID     map[string]string
}

Jump to

Keyboard shortcuts

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