config

package
v0.11.10 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 Imports: 17 Imported by: 207

Documentation

Overview

Package config parses command line flags and config files, and defines options used elsewhere in goiardi.

Index

Constants

View Source
const ChefVersion = "11.1.7"

The chef version we're at least aiming for, even if it's not complete yet.

View Source
const DefaultTimeSlew = "15m"

The default time difference allowed between the server's clock and the time in the X-OPS-TIMESTAMP header.

View Source
const MaxAPIVersion = "1"

Maximum supported API version

View Source
const MinAPIVersion = "0"

Minimum supported API version

View Source
const Version = "0.11.10"

The goiardi version.

Variables

View Source
var Config = initConfig()

Config struct with the options specified on the command line or in the config file.

View Source
var GitHash = "unknown"

GitHash is the git hash (supplied with '-ldflags "-X config.GitHash=<hash>"') of goiardi when it was compiled.

View Source
var Key = &SigningKeys{}

Key is the initialized shovey public and private keys.

View Source
var LogLevelNames = map[string]int{"debug": 5, "info": 4, "warning": 3, "error": 2, "critical": 1, "fatal": 0}

LogLevelNames give convenient, easier to remember than number name for the different levels of logging.

View Source
var SupportedAPIVersions = []string{"0", "1"}

All supported API versions

Functions

func ListenAddr

func ListenAddr() string

ListenAddr builds the address and port goiardi is configured to listen on.

func ParseConfigOptions

func ParseConfigOptions() error

ParseConfigOptions reads and applies arguments from the command line and the configuration file, merging them together as needed, with command line options taking precedence over options in the config file.

func PprofWhitelisted added in v0.11.7

func PprofWhitelisted(remoteIP net.IP) bool

func ServerBaseURL

func ServerBaseURL() string

ServerBaseURL returns the base scheme+hostname portion of a goiardi URL.

func ServerHostname

func ServerHostname() string

ServerHostname returns the hostname and port goiardi is configured to use.

func UsingDB added in v0.6.0

func UsingDB() bool

UsingDB returns true if we're using any db engine, false if using the in-memory data store.

func UsingExternalSecrets added in v0.11.1

func UsingExternalSecrets() bool

Types

type Conf

type Conf struct {
	Ipaddress            string
	Port                 int
	Hostname             string
	ProxyHostname        string `toml:"proxy-hostname"`
	ProxyPort            int    `toml:"proxy-port"`
	ConfFile             string `toml:"conf-file"`
	IndexFile            string `toml:"index-file"`
	DataStoreFile        string `toml:"data-file"`
	DebugLevel           int    `toml:"debug-level"`
	LogLevel             string `toml:"log-level"`
	FreezeInterval       int    `toml:"freeze-interval"`
	FreezeData           bool   `toml:"freeze-data"`
	LogFile              string `toml:"log-file"`
	SysLog               bool   `toml:"syslog"`
	UseAuth              bool   `toml:"use-auth"`
	TimeSlew             string `toml:"time-slew"`
	TimeSlewDur          time.Duration
	ConfRoot             string       `toml:"conf-root"`
	UseSSL               bool         `toml:"use-ssl"`
	SSLCert              string       `toml:"ssl-cert"`
	SSLKey               string       `toml:"ssl-key"`
	HTTPSUrls            bool         `toml:"https-urls"`
	DisableWebUI         bool         `toml:"disable-webui"`
	UseMySQL             bool         `toml:"use-mysql"`
	MySQL                MySQLdb      `toml:"mysql"`
	UsePostgreSQL        bool         `toml:"use-postgresql"`
	PostgreSQL           PostgreSQLdb `toml:"postgresql"`
	LocalFstoreDir       string       `toml:"local-filestore-dir"`
	LogEvents            bool         `toml:"log-events"`
	LogEventKeep         int          `toml:"log-event-keep"`
	SkipLogExtended      bool         `toml:"skip-log-extended"`
	DoExport             bool
	DoImport             bool
	ImpExFile            string
	ObjMaxSize           int64    `toml:"obj-max-size"`
	JSONReqMaxSize       int64    `toml:"json-req-max-size"`
	UseUnsafeMemStore    bool     `toml:"use-unsafe-mem-store"`
	DbPoolSize           int      `toml:"db-pool-size"`
	MaxConn              int      `toml:"max-connections"`
	UseSerf              bool     `toml:"use-serf"`
	SerfEventAnnounce    bool     `toml:"serf-event-announce"`
	SerfAddr             string   `toml:"serf-addr"`
	UseShovey            bool     `toml:"use-shovey"`
	SignPrivKey          string   `toml:"sign-priv-key"`
	DotSearch            bool     `toml:"dot-search"`
	ConvertSearch        bool     `toml:"convert-search"`
	PgSearch             bool     `toml:"pg-search"`
	UseStatsd            bool     `toml:"use-statsd"`
	StatsdAddr           string   `toml:"statsd-addr"`
	StatsdType           string   `toml:"statsd-type"`
	StatsdInstance       string   `toml:"statsd-instance"`
	UseS3Upload          bool     `toml:"use-s3-upload"`
	AWSRegion            string   `toml:"aws-region"`
	S3Bucket             string   `toml:"s3-bucket"`
	AWSDisableSSL        bool     `toml:"aws-disable-ssl"`
	S3Endpoint           string   `toml:"s3-endpoint"`
	S3FilePeriod         int      `toml:"s3-file-period"`
	UseExtSecrets        bool     `toml:"use-external-secrets"`
	VaultAddr            string   `toml:"vault-addr"`
	VaultShoveyKey       string   `toml:"vault-shovey-key"`
	EnvVars              []string `toml:"env-vars"`
	IndexValTrim         int      `toml:"index-val-trim"`
	PprofWhitelist       []string `toml:"pprof-whitelist"`
	PurgeNodeStatusAfter string   `toml:"purge-status-after"`
	PurgeReportsAfter    string   `toml:"purge-reports-after"`
	PurgeSandboxesAfter  string   `toml:"purge-sandboxes-after"`
	PurgeNodeStatusDur   time.Duration
	PurgeReportsDur      time.Duration
	PurgeSandboxesDur    time.Duration
	SearchQueryDebug     bool
}

Conf is the master struct for holding configuration options.

type MySQLdb added in v0.5.0

type MySQLdb struct {
	Username    string            `long:"username" description:"MySQL username" env:"GOIARDI_MYSQL_USERNAME"`
	Password    string            `long:"password" description:"MySQL password" env:"GOIARDI_MYSQL_PASSWORD"`
	Protocol    string            `long:"protocol" description:"MySQL protocol (tcp or unix)" env:"GOIARDI_MYSQL_PROTOCOL"`
	Address     string            `long:"address" description:"MySQL IP address, hostname, or path to a socket" env:"GOIARDI_MYSQL_ADDRESS"`
	Port        string            `long:"port" description:"MySQL TCP port" env:"GOIARDI_MYSQL_PORT"`
	Dbname      string            `long:"dbname" description:"MySQL database name" env:"GOIARDI_MYSQL_DBNAME"`
	ExtraParams map[string]string `` /* 420-byte string literal not displayed */
}

MySQLdb holds MySQL connection options.

type Options

type Options struct {
	Version              bool         `short:"v" long:"version" description:"Print version info."`
	Verbose              []bool       `short:"V" long:"verbose" description:"Show verbose debug information. Repeat for more verbosity."`
	ConfFile             string       `short:"c" long:"config" description:"Specify a config file to use." env:"GOIARDI_CONFIG"`
	Ipaddress            string       `short:"I" long:"ipaddress" description:"Listen on a specific IP address." env:"GOIARDI_IPADDRESS"`
	Hostname             string       `` /* 140-byte string literal not displayed */
	Port                 int          `` /* 135-byte string literal not displayed */
	ProxyHostname        string       `` /* 251-byte string literal not displayed */
	ProxyPort            int          `` /* 254-byte string literal not displayed */
	IndexFile            string       `short:"i" long:"index-file" description:"File to save search index data to." env:"GOIARDI_INDEX_FILE"`
	DataStoreFile        string       `short:"D" long:"data-file" description:"File to save data store data to." env:"GOIARDI_DATA_FILE"`
	FreezeInterval       int          `` /* 258-byte string literal not displayed */
	LogFile              string       `short:"L" long:"log-file" description:"Log to file X" env:"GOIARDI_LOG_FILE"`
	SysLog               bool         `` /* 129-byte string literal not displayed */
	LogLevel             string       `` /* 274-byte string literal not displayed */
	TimeSlew             string       `` /* 196-byte string literal not displayed */
	ConfRoot             string       `` /* 196-byte string literal not displayed */
	UseAuth              bool         `` /* 188-byte string literal not displayed */
	UseSSL               bool         `` /* 244-byte string literal not displayed */
	SSLCert              string       `` /* 131-byte string literal not displayed */
	SSLKey               string       `long:"ssl-key" description:"SSL key file. If a relative path, will be set relative to --conf-root." env:"GOIARDI_SSL_KEY"`
	HTTPSUrls            bool         `` /* 264-byte string literal not displayed */
	DisableWebUI         bool         `` /* 143-byte string literal not displayed */
	UseMySQL             bool         `` /* 140-byte string literal not displayed */
	MySQL                MySQLdb      `group:"MySQL connection options (requires --use-mysql)" namespace:"mysql"`
	UsePostgreSQL        bool         `` /* 155-byte string literal not displayed */
	PostgreSQL           PostgreSQLdb `group:"PostgreSQL connection options (requires --use-postgresql)" namespace:"postgresql"`
	LocalFstoreDir       string       `` /* 204-byte string literal not displayed */
	LogEvents            bool         `long:"log-events" description:"Log changes to chef objects." env:"GOIARDI_LOG_EVENTS"`
	LogEventKeep         int          `` /* 206-byte string literal not displayed */
	SkipLogExtended      bool         `` /* 160-byte string literal not displayed */
	Export               string       `` /* 176-byte string literal not displayed */
	Import               string       `` /* 138-byte string literal not displayed */
	ObjMaxSize           int64        `` /* 150-byte string literal not displayed */
	JSONReqMaxSize       int64        `` /* 166-byte string literal not displayed */
	UseUnsafeMemStore    bool         `` /* 466-byte string literal not displayed */
	DbPoolSize           int          `` /* 195-byte string literal not displayed */
	MaxConn              int          `` /* 189-byte string literal not displayed */
	UseSerf              bool         `` /* 163-byte string literal not displayed */
	SerfEventAnnounce    bool         `` /* 171-byte string literal not displayed */
	SerfAddr             string       `` /* 150-byte string literal not displayed */
	UseShovey            bool         `long:"use-shovey" description:"Enable using shovey for sending jobs to nodes. Requires --use-serf." env:"GOIARDI_USE_SHOVEY"`
	SignPrivKey          string       `long:"sign-priv-key" description:"Path to RSA private key used to sign shovey requests." env:"GOIARDI_SIGN_PRIV_KEY"`
	DotSearch            bool         `long:"dot-search" description:"If set, searches will use . to separate elements instead of _." env:"GOIARDI_DOT_SEARCH"`
	ConvertSearch        bool         `` /* 147-byte string literal not displayed */
	PgSearch             bool         `` /* 246-byte string literal not displayed */
	UseStatsd            bool         `` /* 132-byte string literal not displayed */
	StatsdAddr           string       `` /* 139-byte string literal not displayed */
	StatsdType           string       `` /* 132-byte string literal not displayed */
	StatsdInstance       string       `` /* 172-byte string literal not displayed */
	UseS3Upload          bool         `` /* 222-byte string literal not displayed */
	AWSRegion            string       `long:"aws-region" description:"AWS region to use S3 uploads." env:"GOIARDI_AWS_REGION"`
	S3Bucket             string       `long:"s3-bucket" description:"The name of the S3 bucket storing the files." env:"GOIARDI_S3_BUCKET"`
	AWSDisableSSL        bool         `` /* 135-byte string literal not displayed */
	S3Endpoint           string       `` /* 206-byte string literal not displayed */
	S3FilePeriod         int          `` /* 182-byte string literal not displayed */
	UseExtSecrets        bool         `` /* 189-byte string literal not displayed */
	VaultAddr            string       `` /* 131-byte string literal not displayed */
	VaultShoveyKey       string       `` /* 179-byte string literal not displayed */
	IndexValTrim         int          `` /* 257-byte string literal not displayed */
	PprofWhitelist       []string     `` /* 206-byte string literal not displayed */
	PurgeReportsAfter    string       `` /* 193-byte string literal not displayed */
	PurgeNodeStatusAfter string       `` /* 197-byte string literal not displayed */
	PurgeSandboxesAfter  string       `` /* 246-byte string literal not displayed */
	// hidden argument to print a formatted man page to stdout and exit
	PrintManPage bool `long:"print-man-page" hidden:"true"`
	// hidden argument to enable logging full postgres search queries
	SearchQueryDebug bool `long:"sqdbg" hidden:"true"`
}

Options holds options set from the command line or (in most cases) environment variables, which are then merged with the options in Conf. Configurations from the command line/env vars are preferred to those set in the config file.

type PostgreSQLdb added in v0.6.0

type PostgreSQLdb struct {
	Username string `long:"username" description:"PostgreSQL user name" env:"GOIARDI_POSTGRESQL_USERNAME"`
	Password string `long:"password" description:"PostgreSQL password" env:"GOIARDI_POSTGRESQL_PASSWORD"`
	Host     string `long:"host" description:"PostgreSQL IP host, hostname, or path to a socket" env:"GOIARDI_POSTGRESQL_HOST"`
	Port     string `long:"port" description:"PostgreSQL TCP port" env:"GOIARDI_POSTGRESQL_PORT"`
	Dbname   string `long:"dbname" description:"PostgreSQL database name" env:"GOIARDI_POSTGRESQL_DBNAME"`
	SSLMode  string `long:"ssl-mode" description:"PostgreSQL SSL mode ('enable' or 'disable')" env:"GOIARDI_POSTGRESQL_SSL_MODE"`
}

PostgreSQLdb holds Postgres connection options.

type SigningKeys added in v0.8.0

type SigningKeys struct {
	sync.RWMutex
	PrivKey *rsa.PrivateKey
}

SigningKeys are the public and private keys for signing shovey requests.

Jump to

Keyboard shortcuts

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