config

package
v6.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 12 Imported by: 41

Documentation

Index

Constants

View Source
const (
	DBMaxIdleConnectionsDefault     = 10 // if this is higher than MaxDBConnections it will be automatically adjusted below it by the db/sql library
	DBConnMaxLifetimeSecondsDefault = 60
)
View Source
const AllowStartup = false
View Source
const BlockStartup = true
View Source
const DefaultDBQueryTimeoutSecs = 20
View Source
const DefaultLDAPTimeoutSecs = 60

Variables

This section is empty.

Functions

func ValidateRoutingBlacklist

func ValidateRoutingBlacklist(blacklist RoutingBlacklist) error

Types

type Config

type Config struct {
	URL                    *url.URL `json:"-"`
	CertPath               string   `json:"-"`
	KeyPath                string   `json:"-"`
	ConfigHypnotoad        `json:"hypnotoad"`
	ConfigTrafficOpsGolang `json:"traffic_ops_golang"`
	ConfigTO               *ConfigTO   `json:"to"`
	SMTP                   *ConfigSMTP `json:"smtp"`
	ConfigPortal           `json:"portal"`
	ConfigLetsEncrypt      `json:"lets_encrypt"`
	ConfigAcmeRenewal      `json:"acme_renewal"`
	AcmeAccounts           []ConfigAcmeAccount `json:"acme_accounts"`
	DB                     ConfigDatabase      `json:"db"`
	Secrets                []string            `json:"secrets"`
	TrafficVaultEnabled    bool
	ConfigLDAP             *ConfigLDAP
	LDAPEnabled            bool
	LDAPConfPath           string `json:"ldap_conf_location"`
	ConfigInflux           *ConfigInflux
	InfluxEnabled          bool
	InfluxDBConfPath       string `json:"influxdb_conf_path"`
	Version                string
	UseIMS                 bool                    `json:"use_ims"`
	RoleBasedPermissions   bool                    `json:"role_based_permissions"`
	DefaultCertificateInfo *DefaultCertificateInfo `json:"default_certificate_info"`
}

Config reflects the structure of the cdn.conf file

func LoadCdnConfig

func LoadCdnConfig(cdnConfPath string) (Config, error)

func LoadConfig

func LoadConfig(cdnConfPath string, dbConfPath string, appVersion string) (Config, []error, bool)

func NewFakeConfig

func NewFakeConfig() Config

NewFakeConfig returns a fake Config struct with just enough data to view Routes.

func ParseConfig

func ParseConfig(cfg Config) (Config, error)

ParseConfig validates required fields, and parses non-JSON types

func (Config) DebugLog

func (c Config) DebugLog() log.LogLocation

DebugLog - troubleshooting messages

func (Config) ErrorLog

func (c Config) ErrorLog() log.LogLocation

ErrorLog - critical messages

func (Config) EventLog

func (c Config) EventLog() log.LogLocation

EventLog - access.log high level transactions

func (Config) GetCertPath

func (c Config) GetCertPath() string

GetCertPath - extracts path to cert .cert file

func (Config) GetKeyPath

func (c Config) GetKeyPath() string

GetKeyPath - extracts path to cert .key file

func (Config) InfoLog

func (c Config) InfoLog() log.LogLocation

InfoLog - information messages

func (Config) WarningLog

func (c Config) WarningLog() log.LogLocation

WarningLog - warning messages

type ConfigAcmeAccount

type ConfigAcmeAccount struct {
	AcmeProvider string `json:"acme_provider"`
	UserEmail    string `json:"user_email"`
	AcmeUrl      string `json:"acme_url"`
	Kid          string `json:"kid"`
	HmacEncoded  string `json:"hmac_encoded"`
}

ConfigAcmeAccount contains all account information for a single ACME provider to be registered with External Account Binding

type ConfigAcmeRenewal

type ConfigAcmeRenewal struct {
	SummaryEmail              string `json:"summary_email"`
	RenewDaysBeforeExpiration int    `json:"renew_days_before_expiration"`
}

ConfigAcmeRenewal continas configuration information for automated ACME renewals.

type ConfigDatabase

type ConfigDatabase struct {
	Description string `json:"description"`
	DBName      string `json:"dbname"`
	Hostname    string `json:"hostname"`
	User        string `json:"user"`
	Password    string `json:"password"`
	Port        string `json:"port"`
	Type        string `json:"type"`
	SSL         bool   `json:"ssl"`
}

ConfigDatabase reflects the structure of the database.conf file

type ConfigHypnotoad

type ConfigHypnotoad struct {
	Listen []string `json:"listen"`
}

ConfigHypnotoad carries http setting for hypnotoad (mojolicious) server

type ConfigInflux

type ConfigInflux struct {
	User        string `json:"user"`
	Password    string `json:"password"`
	DSDBName    string `json:"deliveryservice_stats_db_name"`
	CacheDBName string `json:"cache_stats_db_name"`
	Secure      *bool  `json:"secure"`
}

func GetInfluxConfig

func GetInfluxConfig(path string) (bool, *ConfigInflux, error)

type ConfigLDAP

type ConfigLDAP struct {
	AdminPass       string `json:"admin_pass"`
	SearchBase      string `json:"search_base"`
	AdminDN         string `json:"admin_dn"`
	Host            string `json:"host"`
	SearchQuery     string `json:"search_query"`
	Insecure        bool   `json:"insecure"`
	LDAPTimeoutSecs int    `json:"ldap_timeout_secs"`
}

func GetLDAPConfig

func GetLDAPConfig(LDAPConfPath string) (bool, *ConfigLDAP, error)

type ConfigLetsEncrypt

type ConfigLetsEncrypt struct {
	Email                     string `json:"user_email,omitempty"`
	SendExpEmail              bool   `json:"send_expiration_email"`
	ConvertSelfSigned         bool   `json:"convert_self_signed"`
	RenewDaysBeforeExpiration int    `json:"renew_days_before_expiration"`
	Environment               string `json:"environment"`
}

ConfigLetsEncrypt contains configuration information for integration with the Let's Encrypt certificate authority.

type ConfigPortal

type ConfigPortal struct {
	BaseURL          rfc.URL          `json:"base_url"`
	DocsURL          rfc.URL          `json:"docs_url"`
	EmailFrom        rfc.EmailAddress `json:"email_from"`
	PasswdResetPath  string           `json:"pass_reset_path"`
	UserRegisterPath string           `json:"user_register_path"`
}

ConfigPortal contains information that can direct users to a friendly UI

type ConfigSMTP

type ConfigSMTP struct {
	Address  string `json:"address"`
	Enabled  bool   `json:"enabled"`
	Password string `json:"password"`
	User     string `json:"user"`
}

ConfigSMTP contains configuration information for connecting to and authenticating with an SMTP server.

type ConfigTO

type ConfigTO struct {
	BaseURL               *rfc.URL          `json:"base_url"`
	EmailFrom             *rfc.EmailAddress `json:"email_from"`
	NoAccountFoundMessage *string           `json:"no_account_found_msg"`
}

ConfigTO contains information to identify Traffic Ops in a network sense.

type ConfigTrafficOpsGolang

type ConfigTrafficOpsGolang struct {
	// Deprecated in 5.0
	Insecure bool `json:"insecure"`
	// end deprecated
	Port                     string                     `json:"port"`
	ProxyTimeout             int                        `json:"proxy_timeout"`
	ProxyKeepAlive           int                        `json:"proxy_keep_alive"`
	ProxyTLSTimeout          int                        `json:"proxy_tls_timeout"`
	ProxyReadHeaderTimeout   int                        `json:"proxy_read_header_timeout"`
	ReadTimeout              int                        `json:"read_timeout"`
	RequestTimeout           int                        `json:"request_timeout"`
	ReadHeaderTimeout        int                        `json:"read_header_timeout"`
	WriteTimeout             int                        `json:"write_timeout"`
	IdleTimeout              int                        `json:"idle_timeout"`
	LogLocationError         string                     `json:"log_location_error"`
	LogLocationWarning       string                     `json:"log_location_warning"`
	LogLocationInfo          string                     `json:"log_location_info"`
	LogLocationDebug         string                     `json:"log_location_debug"`
	LogLocationEvent         string                     `json:"log_location_event"`
	MaxDBConnections         int                        `json:"max_db_connections"`
	DBMaxIdleConnections     int                        `json:"db_max_idle_connections"`
	DBConnMaxLifetimeSeconds int                        `json:"db_conn_max_lifetime_seconds"`
	DBQueryTimeoutSeconds    int                        `json:"db_query_timeout_seconds"`
	Plugins                  []string                   `json:"plugins"`
	PluginConfig             map[string]json.RawMessage `json:"plugin_config"`
	PluginSharedConfig       map[string]interface{}     `json:"plugin_shared_config"`
	ProfilingEnabled         bool                       `json:"profiling_enabled"`
	ProfilingLocation        string                     `json:"profiling_location"`
	// Deprecated: use 'port' in traffic_vault_config instead.
	RiakPort             *uint    `json:"riak_port"`
	WhitelistedOAuthUrls []string `json:"whitelisted_oauth_urls"`
	OAuthClientSecret    string   `json:"oauth_client_secret"`
	RoutingBlacklist     `json:"routing_blacklist"`
	SupportedDSMetrics   []string        `json:"supported_ds_metrics"`
	TLSConfig            *tls.Config     `json:"tls_config"`
	TrafficVaultBackend  string          `json:"traffic_vault_backend"`
	TrafficVaultConfig   json.RawMessage `json:"traffic_vault_config"`

	// CRConfigUseRequestHost is whether to use the client request host header in the CRConfig. If false, uses the tm.url parameter.
	// This defaults to false. Traffic Ops used to always use the host header, setting this true will resume that legacy behavior.
	// See https://github.com/apache/trafficcontrol/issues/2224
	// Deprecated: will be removed in the next major version.
	CRConfigUseRequestHost bool `json:"crconfig_snapshot_use_client_request_host"`
	// CRConfigEmulateOldPath is whether to emulate the legacy CRConfig request path when generating a new CRConfig. This primarily exists in the event a tool relies on the legacy path '/tools/write_crconfig'.
	// Deprecated: will be removed in the next major version.
	CRConfigEmulateOldPath bool `json:"crconfig_emulate_old_path"`
}

ConfigTrafficOpsGolang carries settings specific to traffic_ops_golang server

type DefaultCertificateInfo

type DefaultCertificateInfo struct {
	BusinessUnit string `json:"business_unit"`
	City         string `json:"city"`
	Organization string `json:"organization"`
	Country      string `json:"country"`
	State        string `json:"state"`
}

func (*DefaultCertificateInfo) Validate

func (d *DefaultCertificateInfo) Validate() (error, bool)

type RoutingBlacklist

type RoutingBlacklist struct {
	IgnoreUnknownRoutes bool  `json:"ignore_unknown_routes"`
	DisabledRoutes      []int `json:"disabled_routes"`
}

RoutingBlacklist contains a list of route IDs that are disabled, and whether or not to ignore unknown routes.

Jump to

Keyboard shortcuts

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