config

package
v8.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLDAPTimeoutSecs    = 60
	DefaultDBQueryTimeoutSecs = 20
	DefaultDBPort             = "5432"
	MinPort                   = 1
	MaxPort                   = 65535
)
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

Variables

This section is empty.

Functions

func ValidateRoutingBlacklist

func ValidateRoutingBlacklist(blacklist RoutingBlacklist) error

Types

type BackendConfig

type BackendConfig struct {
	Routes []BackendRoute `json:"routes"`
}

BackendConfig is a structure that holds the configuration supplied to Traffic Ops, which makes it act as a reverse proxy to the specified routes.

func LoadBackendConfig

func LoadBackendConfig(backendConfigPath string) (BackendConfig, error)

type BackendRoute

type BackendRoute struct {
	Path        string   `json:"path"`
	Method      string   `json:"method"`
	Hosts       []Host   `json:"hosts"`
	Opts        Options  `json:"opts"`
	ID          int      `json:"routeId"`
	Insecure    bool     `json:"insecure"`
	Permissions []string `json:"permissions"`
	Index       int
}

BackendRoute holds all the information about a configured route, for which Traffic Ops serves as a reverse proxy.

type CdniConf

type CdniConf struct {
	DCdnId string `json:"dcdn_id"`
}

type ClientCertAuth

type ClientCertAuth struct {
	RootCertsDir string `json:"root_certificates_directory"`
}

type Config

type Config struct {
	URL                                       *url.URL `json:"-"`
	CertPath                                  string   `json:"-"`
	KeyPath                                   string   `json:"-"`
	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
	UserCacheRefreshIntervalSec               int `json:"user_cache_refresh_interval_sec"`
	ServerUpdateStatusCacheRefreshIntervalSec int `json:"server_update_status_cache_refresh_interval_sec"`
	LDAPEnabled                               bool
	LDAPConfPath                              string `json:"ldap_conf_location"`
	ConfigInflux                              *ConfigInflux
	InfluxEnabled                             bool
	InfluxDBConfPath                          string `json:"influxdb_conf_path"`
	Version                                   string
	DisableAutoCertDeletion                   bool                    `json:"disable_auto_cert_deletion"`
	UseIMS                                    bool                    `json:"use_ims"`
	RoleBasedPermissions                      bool                    `json:"role_based_permissions"`
	DefaultCertificateInfo                    *DefaultCertificateInfo `json:"default_certificate_info"`
	Cdni                                      *CdniConf               `json:"cdni"`
	ClientCertAuth                            *ClientCertAuth         `json:"client_certificate_authentication"`
}

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 - get the path to cert .cert file

func (Config) GetKeyPath

func (c Config) GetKeyPath() string

GetKeyPath - get the 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 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
	//Moved from Hypnotoad-listen section
	Cert                     string                     `json:"cert"`
	Key                      string                     `json:"key"`
	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"`
	OAuthUserAttribute   string   `json:"oauth_user_attribute"`
	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 Host

type Host struct {
	Protocol string `json:"protocol"`
	Hostname string `json:"hostname"`
	Port     int    `json:"port"`
}

Host is a structure that holds the host info for the backend route.

type Options

type Options struct {
	Algorithm string `json:"alg"`
}

Options is a structure used to hold the route configuration options that can be supplied for the backend routes.

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