Documentation ¶
Index ¶
- Constants
- Variables
- func DisplayConfig(cfg Config) ([]byte, error)
- func GenDefaultConfig(file string) (err error)
- func GenESConfig(cfg Config) (es7cfg elastic7.Config, err error)
- func GetContexts(cfg Config) []string
- func IsValidCfg(b []byte) bool
- func TestContext(n string)
- func ToBytes(file string) (b []byte, err error)
- func UseContext(n string, cfg Config, file string) error
- type Cluster
- type Config
- type Context
- type Contexts
- type Token
- type User
- type Users
Constants ¶
View Source
const ( // Default configuration file name DefaultElasticConfigName string = "config" // Default configuration file path DefaultElasticFolderPath string = "$HOME/.elastic" // Default full path to configuration file DefaultElasticConfig string = "$HOME/.elastic/config" // Default configuration folder mode DefaultElasticFolderMode uint32 = 755 // Default configuration file mode DefaultElasticConfigMode uint32 = 0600 )
Variables ¶
View Source
var DefaultConfig = Config{ Clusters: []Cluster{ Cluster{ Name: "local", ElasticAddresses: []string{ "http://localhost:9200", "http://127.0.0.1:9200", }, AllowSelfSigned: "yes", }, }, Contexts: []Contexts{ Contexts{ Name: "local", Context: Context{ Cluster: "local", User: "elastic", }, }, Contexts{ Name: "elastic@local", Context: Context{ Cluster: "local", User: "elastic@local", }, }, }, Users: []Users{ Users{ Name: "elastic@local", User: User{ Name: "elastic", Password: "", ApiKey: "", Token: Token{ Value: "", Expiration: "", }, }, }, Users{ Name: "elastic", User: User{ Name: "elastic", Password: "changeme", ApiKey: "", Token: Token{ Value: "", Expiration: "", }, }, }, }, CurrentContext: "local", }
Default Config struct used in GenDefaultConfig. Connects to a local elasticsearch cluster
Functions ¶
func GenDefaultConfig ¶
Generate a configuration file for connecting to a local elasticsearch cluster if a file is not found by path
func IsValidCfg ¶
Test if a config file is valid by attempting to unmarshal into a Config struct
Types ¶
type Cluster ¶
type Cluster struct { Name string `yaml:"name"` ElasticAddresses []string `yaml:"elastic-addresses",omitempty` //KibanaAddresses []string `yaml:"kibana-addresses",omitempty` CloudID string `yaml:"cloud-id",omitempty` AllowSelfSigned string `yaml:"allowSelfSigned",omitempty` }
Connection details for a cluster
type Config ¶
type Config struct { Clusters []Cluster `yaml:"clusters"` Contexts []Contexts `yaml:"contexts"` Users []Users `yaml:"users"` CurrentContext string `yaml:"current-context",omitempty` }
File configuration
func ReadConfig ¶
Unmarshal bytes into a Config
type Context ¶
type Context struct { Cluster string `yaml:"cluster",omitempty` User string `yaml:"user",omitempty` }
A combination of a named Cluster and named User. Used for lookups of the respective objects
type Contexts ¶
type Contexts struct { Name string `yaml:"name",omitempty` Context Context `yaml:"context",omitempty` }
Named Context
type Token ¶
type Token struct { Value string `yaml:"value",omitempty` Expiration string `yaml:"expiration",omitempty` }
Token used for authentication
Click to show internal directories.
Click to hide internal directories.