25 lines
467 B
Go
25 lines
467 B
Go
|
|
package elasticsearch
|
||
|
|
|
||
|
|
import "os"
|
||
|
|
|
||
|
|
// Config holds Elasticsearch connection configuration (v0.10.2 F361)
|
||
|
|
type Config struct {
|
||
|
|
URL string
|
||
|
|
Index string
|
||
|
|
Enabled bool
|
||
|
|
}
|
||
|
|
|
||
|
|
// LoadConfig loads Elasticsearch config from environment
|
||
|
|
func LoadConfig() Config {
|
||
|
|
url := os.Getenv("ELASTICSEARCH_URL")
|
||
|
|
index := os.Getenv("ELASTICSEARCH_INDEX")
|
||
|
|
if index == "" {
|
||
|
|
index = "veza-platform"
|
||
|
|
}
|
||
|
|
return Config{
|
||
|
|
URL: url,
|
||
|
|
Index: index,
|
||
|
|
Enabled: url != "",
|
||
|
|
}
|
||
|
|
}
|