config

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPanelsPath      = "schemas/panels"
	DefaultQueriesPath     = "schemas/queries"
	DefaultDatasourcesPath = "schemas/datasources"
	DefaultVariablesPath   = "schemas/variables"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Readonly will deactivate any HTTP POST, PUT, DELETE endpoint
	Readonly bool `json:"readonly" yaml:"readonly"`
	// Database contains the different configuration depending on the database you want to use
	Database Database `json:"database" yaml:"database"`
	// Schemas contains the configuration to get access to the CUE schemas
	Schemas Schemas `json:"schemas" yaml:"schemas"`
	// ImportantDashboards contains important dashboard selectors
	ImportantDashboards []dashboardSelector `json:"important_dashboards,omitempty" yaml:"important_dashboards,omitempty"`
	// Information contains markdown content to be display on the home page
	Information string `json:"information,omitempty" yaml:"information,omitempty"`
}

func Resolve

func Resolve(configFile string) (Config, error)

type Database

type Database struct {
	File *File `json:"file,omitempty" yaml:"file,omitempty"`
	SQL  *SQL  `json:"sql,omitempty" yaml:"sql,omitempty"`
}

func (*Database) Verify

func (d *Database) Verify() error

type File

type File struct {
	Folder    string        `json:"folder" yaml:"folder"`
	Extension FileExtension `json:"extension" yaml:"extension"`
}

func (*File) Verify

func (f *File) Verify() error

type FileExtension

type FileExtension string
const (
	YAMLExtension FileExtension = "yaml"
	JSONExtension FileExtension = "json"
)

type SQL added in v0.24.0

type SQL struct {
	// TLS configuration
	TLSConfig *config.TLSConfig `json:"tls_config,omitempty" yaml:"tls_config,omitempty"`
	// Username
	User config.Secret `json:"user,omitempty" yaml:"user,omitempty"`
	// Password (requires User)
	Password config.Secret `json:"password,omitempty" yaml:"password,omitempty"`
	// Network type
	Net string `json:"net,omitempty" yaml:"net,omitempty"`
	// Network address (requires Net)
	Addr config.Secret `json:"addr,omitempty" yaml:"addr,omitempty"`
	// Database name
	DBName string `json:"db_name" yaml:"db_name"`
	// Connection collation
	Collation string `json:"collation,omitempty" yaml:"collation,omitempty"`
	// Location for time.Time values
	Loc *time.Location `json:"loc,omitempty" yaml:"loc,omitempty"`
	// Max packet size allowed
	MaxAllowedPacket int `json:"max_allowed_packet" yaml:"maxAllowedPacket"`
	// Server public key name
	ServerPubKey string `json:"server_pub_key" yaml:"server_pub_key"`
	// Dial timeout
	Timeout time.Duration `json:"timeout" yaml:"timeout"`
	// I/O read timeout
	ReadTimeout time.Duration `json:"read_timeout" yaml:"read_timeout"`
	// I/O write timeout
	WriteTimeout time.Duration `json:"write_timeout" yaml:"write_timeout"`
	// Allow all files to be used with LOAD DATA LOCAL INFILE
	AllowAllFiles bool `json:"allow_all_files" yaml:"allow_all_files"`
	// Allows the cleartext client side plugin
	AllowCleartextPasswords bool `json:"allow_cleartext_passwords" yaml:"allow_cleartext_passwords"`
	// Allows fallback to unencrypted connection if server does not support TLS
	AllowFallbackToPlaintext bool `json:"allow_fallback_to_plaintext" yaml:"allow_fallback_to_plaintext"`
	// Allows the native password authentication method
	AllowNativePasswords bool `json:"allow_native_passwords" yaml:"allow_native_passwords"`
	// Allows the old insecure password method
	AllowOldPasswords bool `json:"allow_old_passwords" yaml:"allow_old_passwords"`
	// Check connections for liveness before using them
	CheckConnLiveness bool `json:"check_conn_liveness" yaml:"check_conn_liveness"`
	// Return number of matching rows instead of rows changed
	ClientFoundRows bool `json:"client_found_rows" yaml:"client_found_rows"`
	// Prepend table alias to column names
	ColumnsWithAlias bool `json:"columns_with_alias" yaml:"columns_with_alias"`
	// Interpolate placeholders into query string
	InterpolateParams bool `json:"interpolate_params" yaml:"interpolate_params"`
	// Allow multiple statements in one query
	MultiStatements bool `json:"multi_statements" yaml:"multi_statements"`
	// Parse time values to time.Time
	ParseTime bool `json:"parse_time" yaml:"parse_time"`
	// Reject read-only connections
	RejectReadOnly bool `json:"reject_read_only" yaml:"reject_read_only"`
}

func (*SQL) Verify added in v0.24.0

func (s *SQL) Verify() error

type Schemas

type Schemas struct {
	PanelsPath      string        `yaml:"panels_path,omitempty"`
	QueriesPath     string        `yaml:"queries_path,omitempty"`
	DatasourcesPath string        `yaml:"datasources_path,omitempty"`
	VariablesPath   string        `yaml:"variables_path,omitempty"`
	Interval        time.Duration `yaml:"interval,omitempty"`
}

func (Schemas) MarshalJSON added in v0.13.0

func (s Schemas) MarshalJSON() ([]byte, error)

func (*Schemas) Verify

func (s *Schemas) Verify() error

Jump to

Keyboard shortcuts

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