/** * CQL Minus - cqlminus * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Paolo Lulli * @copyright Paolo Lulli 2026 */ package config import ( "encoding/json" "fmt" "os" ) type Config struct { Endpoint string `json:"endpoint"` Keyspace string `json:"keyspace"` Username string `json:"username"` Password string `json:"password"` TlsKeyFile string `json:"tlsKeyFile"` TlsCertificate string `json:"tlsCertificate"` TlsVerifyServer string `json:"tlsVerifyServer"` TlsCA string `json:"tlsCA"` } func LoadConfig(path string) (*Config, error) { data, err := os.ReadFile(path) if err != nil { return nil, fmt.Errorf("reading config file: %w", err) } var cfg Config if err := json.Unmarshal(data, &cfg); err != nil { return nil, fmt.Errorf("parsing config file: %w", err) } if cfg.Endpoint == "" { return nil, fmt.Errorf("please configure server:port as endpoint") } return &cfg, nil }