config

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2015 License: Apache-2.0 Imports: 16 Imported by: 0

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.6"

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

View Source
const Version = "0.9.2"

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 Key = &SigningKeys{}

Key is the initialized shovey public and private keys.

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

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

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 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.

Types

type Conf

type Conf struct {
	Ipaddress         string
	Port              int
	Hostname          string
	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"`
	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"`
}

Conf is the master struct for holding configuration options.

type MySQLdb added in v0.5.0

type MySQLdb struct {
	Username    string
	Password    string
	Protocol    string
	Address     string
	Port        string
	Dbname      string
	ExtraParams map[string]string `toml:"extra_params"`
}

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."`
	Ipaddress         string `short:"I" long:"ipaddress" description:"Listen on a specific IP address."`
	Hostname          string `short:"H" long:"hostname" description:"Hostname to use for this server. Defaults to hostname reported by the kernel."`
	Port              int    `short:"P" long:"port" description:"Port to listen on. If port is set to 443, SSL will be activated. (default: 4545)"`
	IndexFile         string `short:"i" long:"index-file" description:"File to save search index data to."`
	DataStoreFile     string `short:"D" long:"data-file" description:"File to save data store data to."`
	FreezeInterval    int    `` /* 228-byte string literal not displayed */
	LogFile           string `short:"L" long:"log-file" description:"Log to file X"`
	SysLog            bool   `short:"s" long:"syslog" description:"Log to syslog rather than a log file. Incompatible with -L/--log-file."`
	TimeSlew          string `` /* 172-byte string literal not displayed */
	ConfRoot          string `` /* 172-byte string literal not displayed */
	UseAuth           bool   `short:"A" long:"use-auth" description:"Use authentication. Default: false."`
	UseSSL            bool   `` /* 222-byte string literal not displayed */
	SSLCert           string `long:"ssl-cert" description:"SSL certificate file. If a relative path, will be set relative to --conf-root."`
	SSLKey            string `long:"ssl-key" description:"SSL key file. If a relative path, will be set relative to --conf-root."`
	HTTPSUrls         bool   `` /* 239-byte string literal not displayed */
	DisableWebUI      bool   `long:"disable-webui" description:"If enabled, disables connections and logins to goiardi over the webui interface."`
	UseMySQL          bool   `long:"use-mysql" description:"Use a MySQL database for data storage. Configure database options in the config file."`
	UsePostgreSQL     bool   `` /* 126-byte string literal not displayed */
	LocalFstoreDir    string `` /* 144-byte string literal not displayed */
	LogEvents         bool   `long:"log-events" description:"Log changes to chef objects."`
	LogEventKeep      int    `` /* 177-byte string literal not displayed */
	Export            string `` /* 176-byte string literal not displayed */
	Import            string `` /* 138-byte string literal not displayed */
	ObjMaxSize        int64  `short:"Q" long:"obj-max-size" description:"Maximum object size in bytes for the file store. Default 10485760 bytes (10MB)."`
	JSONReqMaxSize    int64  `` /* 134-byte string literal not displayed */
	UseUnsafeMemStore bool   `` /* 414-byte string literal not displayed */
	DbPoolSize        int    `` /* 168-byte string literal not displayed */
	MaxConn           int    `` /* 166-byte string literal not displayed */
	UseSerf           bool   `` /* 140-byte string literal not displayed */
	SerfEventAnnounce bool   `` /* 137-byte string literal not displayed */
	SerfAddr          string `` /* 126-byte string literal not displayed */
	UseShovey         bool   `long:"use-shovey" description:"Enable using shovey for sending jobs to nodes. Requires --use-serf."`
	SignPrivKey       string `long:"sign-priv-key" description:"Path to RSA private key used to sign shovey requests."`
}

Options holds options set from the command line, which are then merged with the options in Conf. Configurations from the command line are preferred to those set in the config file.

type PostgreSQLdb added in v0.6.0

type PostgreSQLdb struct {
	Username string
	Password string
	Host     string
	Port     string
	Dbname   string
	SSLMode  string
}

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