Documentation ¶
Overview ¶
Package config contains the top level configuration structures and logic
Index ¶
- Constants
- Variables
- type AgentVersions
- type Auth
- type BBolt
- type Config
- type GoogleCloudTracing
- type Logging
- type Metrics
- type Network
- type OTLPMetrics
- type OTLPTracing
- type Override
- func DefaultOverrides() []*Override
- func NewHiddenOverride(field, usage string, def any) *Override
- func NewOverride(field, usage string, def any) *Override
- func NewOverrideWithShortHand(field, shorthand, usage string, def any) *Override
- func NewOverrideWithoutPrefix(field, usage string, def any) *Override
- type Store
- type TLS
- type Tracing
Constants ¶
const ( // DefaultUsername is the default username used for communication between client and server. DefaultUsername = "admin" // DefaultPassword is the default password used for communication between client and server. DefaultPassword = "admin" )
const ( // DefaultOutput is the default output format of the CLI DefaultOutput = "table" // EnvDevelopment should be used for development and uses debug logging and normal gin request logging to stdout. EnvDevelopment = "development" // EnvTest should be used for tests and uses debug logging with json gin request logging to the log file. EnvTest = "test" // EnvProduction the the default and should be used in production and uses info logging with json gin request logging to the log file. EnvProduction = "production" // DefaultRolloutsInterval is the interval at which rollouts are updated DefaultRolloutsInterval = 5 * time.Second // DefaultMetricsInterval is the interval at which metrics are exported DefaultMetricsInterval = 1 * time.Minute )
const ( // LoggingOutputFile will write logs to the file specified by LogFilePath LoggingOutputFile = "file" // LoggingOutputStdout will write logs to stdout LoggingOutputStdout = "stdout" )
const ( // MetricsTypeOTLP is the OTLP metrics type MetricsTypeOTLP = "otlp" // MetricsTypeNop is the metrics type that does nothing MetricsTypeNop = "" )
const ( // DefaultHost is the default host to which the server will bind. DefaultHost = "127.0.0.1" // DefaultPort is the default port on which the server will serve. DefaultPort = "3001" )
const ( // DefaultMaxEvents is the default maximum number of events to merge into a single event. DefaultMaxEvents = 100 // StoreTypeMap is the type of store that uses an in-memory store. StoreTypeMap = "map" // StoreTypeBBolt is the type of store that uses bbolt. StoreTypeBBolt = "bbolt" )
const ( // TracerTypeGoogleCloud is the type of tracer that sends traces to Google Cloud Monitoring TracerTypeGoogleCloud = "google" // TracerTypeOTLP is the type of tracer that sends traces to an OTLP endpoint TracerTypeOTLP = "otlp" // TracerTypeNop is the type of tracer that does nothing TracerTypeNop = "" )
const DefaultSyncInterval = 1 * time.Hour
DefaultSyncInterval is the default interval at which agent-versions will be synchronized with GitHub.
Variables ¶
var ( // DefaultSecretKey is the default value for secret key. // Having this be hard coded allows us to determine if a user has changed from defaults. DefaultSecretKey = "38f6b093-ed43-457d-9564-1b55006f66b2" // DefaultSessionSecret is the default value for session secret. // Having this be hard coded allows us to determine if a user has changed from defaults. DefaultSessionSecret = "5cdd2530-c4ee-4294-ad8f-217a9406eaf2" )
#nosec G101 -- these credentials are use to detect if we need to replace them and are only valid for first install
var DefaultBBoltPath = filepath.Join(common.GetHome(), "storage")
DefaultBBoltPath is the default path to the bbolt file.
var DefaultLoggingFilePath = filepath.Join(common.GetHome(), "bindplane.log")
DefaultLoggingFilePath is the default path for the bindplane log file
Functions ¶
This section is empty.
Types ¶
type AgentVersions ¶
type AgentVersions struct {
SyncInterval time.Duration `mapstructure:"syncInterval,omitempty" yaml:"syncInterval,omitempty"`
}
AgentVersions is the configuration for serving and checking agent versions.
func (*AgentVersions) Validate ¶
func (c *AgentVersions) Validate() error
Validate validates the agent versions configuration.
type Auth ¶
type Auth struct { // SecretKey is a shared secret between the server and the agent to ensure agents are authorized to communicate with the server. SecretKey string `mapstructure:"secretKey,omitempty" yaml:"secretKey,omitempty"` // Username is the basic auth username used for communication between client and server. Username string `mapstructure:"username" yaml:"username,omitempty"` // Password is the basic auth password used for communication between client and server. Password string `mapstructure:"password" yaml:"password,omitempty"` // SessionSecret is the secret used to sign the session cookie. SessionSecret string `mapstructure:"sessionSecret" yaml:"sessionSecret,omitempty"` }
Auth is the configuration for authentication
type BBolt ¶
type BBolt struct { // Path is the path to the bbolt file. Path string `mapstructure:"path,omitempty" yaml:"path,omitempty"` }
BBolt is the configuration for a bbolt store.
type Config ¶
type Config struct { // ProfileName is the name of the profile associated with this config file if there is one ProfileName string `mapstructure:"name,omitempty" yaml:"name,omitempty"` // APIVersion is the version of the configuration file APIVersion string `mapstructure:"apiVersion,omitempty" yaml:"apiVersion,omitempty"` // Env is the environment of the service Env string `mapstructure:"env,omitempty" yaml:"env,omitempty"` // Output is the output format of the CLI Output string `mapstructure:"output,omitempty" yaml:"output,omitempty"` // Offline mode indicates if the server should be considered offline. An offline server will not attempt to contact // any other services. It will still allow agents to connect and serve api requests. Offline bool `mapstructure:"offline,omitempty" yaml:"offline,omitempty"` // RolloutsInterval is the interval at which rollouts' progress is updated. RolloutsInterval time.Duration `mapstructure:"rolloutsInterval" yaml:"rolloutsInterval,omitempty"` // Auth is the configuration for authentication Auth Auth `mapstructure:"auth,omitempty" yaml:"auth,omitempty"` // Network is the configuration for networking Network Network `mapstructure:"network" yaml:"network,omitempty"` // AgentVersions is the configuration for agent versions AgentVersions AgentVersions `mapstructure:"agentVersions,omitempty" yaml:"agentVersions,omitempty"` // Store is the configuration for storage Store Store `mapstructure:"store,omitempty" yaml:"store,omitempty"` // Tracing is the tracer configuration for the server Tracing Tracing `mapstructure:"tracing,omitempty" yaml:"tracing,omitempty"` // Logging configuration for the logger Logging Logging `yaml:"logging,omitempty" mapstructure:"logging,omitempty"` // Metrics is the configuration for sending APM metrics Metrics Metrics `yaml:"metrics,omitempty" mapstructure:"metrics,omitempty"` }
Config is the configuration of BindPlane
func (*Config) BindPlaneInsecureSkipVerify ¶
BindPlaneInsecureSkipVerify returns the BindPlane InsecureSkipVerify
func (*Config) BindPlaneURL ¶
BindPlaneURL returns the BindPlane URL
type GoogleCloudTracing ¶
type GoogleCloudTracing struct { // ProjectID is the Google Cloud project ID to use when sending traces. ProjectID string `mapstructure:"projectID,omitempty" yaml:"projectID,omitempty"` // CredentialsFile is the path to the Google Cloud credentials file to use when sending traces. CredentialsFile string `mapstructure:"credentialsFile,omitempty" yaml:"credentialsFile,omitempty"` }
GoogleCloudTracing is the configuration for tracing to Google Cloud Monitoring
func (*GoogleCloudTracing) Validate ¶
func (t *GoogleCloudTracing) Validate() error
Validate validates the Google Cloud tracing configuration.
type Logging ¶
type Logging struct { // FilePath is the path of the bindplane log file, defaulting to $HOME/.bindplane/bindplane.log FilePath string `mapstructure:"filePath" yaml:"filePath,omitempty"` // Output indicates where logs should be written, defaulting to "file" Output string `mapstructure:"output" yaml:"output,omitempty"` }
Logging contains configuration for logging.
type Metrics ¶ added in v1.25.0
type Metrics struct { // Type is the type of metrics to send Type string `mapstructure:"type,omitempty" yaml:"type,omitempty"` // Interval is the interval to send metrics at Interval time.Duration `mapstructure:"interval,omitempty" yaml:"interval,omitempty"` // OTLP is the config for sending OTLP metrics OTLP OTLPMetrics `mapstructure:"otlp,omitempty" yaml:"otlp,omitempty"` }
Metrics is the config for sending APM metrics
type Network ¶
type Network struct { // Host is the Host to which the server will bind. Host string `mapstructure:"host" yaml:"host,omitempty"` // Port is the Port on which the server will serve. Port string `mapstructure:"port" yaml:"port,omitempty"` // RemoteURL is the remote URL of the server. If not provided, this will be constructed from the Host and Port. RemoteURL string `mapstructure:"remoteURL" yaml:"remoteURL,omitempty"` TLS `mapstructure:",squash" yaml:",inline"` }
Network is the configuration for networking in BindPlane
func (*Network) BindAddress ¶
BindAddress is the address (host:port) to which the server will bind
func (*Network) ServerScheme ¶
ServerScheme returns http or https
func (*Network) ServerURL ¶
ServerURL returns the server URL of the server. This will be the RemoteURL if provided, otherwise it will be constructed from the Host and Port.
func (*Network) WebsocketScheme ¶
WebsocketScheme returns ws or wss
func (*Network) WebsocketURL ¶
WebsocketURL returns the websocket URL of the server. This will be the RemoteURL if provided, otherwise it will be constructed from the Host and Port.
type OTLPMetrics ¶ added in v1.25.0
type OTLPMetrics struct { // Endpoint is the gRPC endpoint to send metrics to Endpoint string `mapstructure:"endpoint,omitempty" yaml:"endpoint,omitempty"` // Insecure is whether to use an insecure connection Insecure bool `mapstructure:"insecure,omitempty" yaml:"insecure,omitempty"` }
OTLPMetrics is the config for sending OTLP metrics
type OTLPTracing ¶
type OTLPTracing struct { // Endpoint is the OTLP endpoint to send traces to. Endpoint string `mapstructure:"endpoint,omitempty" yaml:"endpoint,omitempty"` // Insecure disables TLS verification Insecure bool `mapstructure:"insecure,omitempty" yaml:"insecure,omitempty"` }
OTLPTracing is the configuration for tracing to an OTLP endpoint
func (*OTLPTracing) Validate ¶
func (t *OTLPTracing) Validate() error
Validate validates the OTLP tracing configuration.
type Override ¶
type Override struct { // Field is the config field to override Field string // Flag is the flag that will override the field Flag string // Env is the environment variable that will override the field Env string // Usage is the usage for the override Usage string // Default is the default value for the override Default any // ShortHand is the shorthand for the flag ShortHand string // Hidden signals if the cli flag should be hidden in the help menu Hidden bool }
Override is a configuration override
func DefaultOverrides ¶
func DefaultOverrides() []*Override
DefaultOverrides returns the default overrides
func NewHiddenOverride ¶
NewHiddenOverride creates a new override that is hidden
func NewOverride ¶
NewOverride creates a new override
func NewOverrideWithShortHand ¶
NewOverrideWithShortHand creates a new override with a shorthand
func NewOverrideWithoutPrefix ¶
NewOverrideWithoutPrefix creates a new override without the original field prefix for the flag and env
type Store ¶
type Store struct { // Type is the type of store. Type string `mapstructure:"type,omitempty" yaml:"type,omitempty"` // MaxEvents is the maximum number of events to merge into a single event. MaxEvents int `mapstructure:"maxEvents,omitempty" yaml:"maxEvents,omitempty"` // BBolt is the configuration for a bbolt store. BBolt BBolt `mapstructure:"bbolt,omitempty" yaml:"bbolt,omitempty"` }
Store is the configuration for a store.
type TLS ¶
type TLS struct { // Certificate is the path to the x509 PEM encoded certificate file that will be used to // establish TLS connections. // // When operating in server mode, this certificate is presented to clients. // When operating in client mode with mTLS, this certificate is used for authentication // against the server. Certificate string `mapstructure:"tlsCert" yaml:"tlsCert,omitempty"` // PrivateKey is the matching x509 PEM encoded private key for the Certificate. PrivateKey string `mapstructure:"tlsKey" yaml:"tlsKey,omitempty"` // CertificateAuthority is one or more file paths to x509 PEM encoded certificate authority chains. // These certificate authorities are used for trusting incoming client mTLS connections. CertificateAuthority []string `mapstructure:"tlsCa" yaml:"tlsCa,omitempty"` // InsecureSkipVerify controls whether a client verifies the server's certificate chain and host name. If // InsecureSkipVerify is true, crypto/tls accepts any certificate presented by the server and any host name in that // certificate. // // It is also used to signal that clients, like the agent metrics pipeline, should connect to the server with // tls.insecure set to true. // // In this mode, TLS is susceptible to machine-in-the-middle attacks. This should be used only for testing only. InsecureSkipVerify bool `mapstructure:"tlsSkipVerify" yaml:"tlsSkipVerify,omitempty"` }
TLS is the configuration for TLS connections
func (*TLS) TLSEnabled ¶
TLSEnabled returns true if TLS is configured
type Tracing ¶
type Tracing struct { // Type specifies the type of tracing to use. Type string `mapstructure:"type,omitempty" yaml:"type,omitempty"` // SamplingRate is the rate at which traces are sampled. Valid values are between 0 and 1. SamplingRate float64 `mapstructure:"samplingRate,omitempty" yaml:"samplingRate,omitempty"` // GoogleCloud is used to send traces to Google Cloud when TraceType is set to "google". GoogleCloud GoogleCloudTracing `mapstructure:"googleCloud,omitempty" yaml:"googleCloud,omitempty"` // OTLP is used to send traces to an Open Telemetry OTLP receiver when TraceType is set to "otlp". OTLP OTLPTracing `mapstructure:"otlp,omitempty" yaml:"otlp,omitempty"` }
Tracing is the configuration for tracing