mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
clientv3: make YamlConfig struct private
This commit is contained in:
parent
ba1c0a2b12
commit
04ef861c3d
@ -45,7 +45,7 @@ type Config struct {
|
||||
Logger Logger
|
||||
}
|
||||
|
||||
type YamlConfig struct {
|
||||
type yamlConfig struct {
|
||||
Endpoints []string `json:"endpoints"`
|
||||
DialTimeout time.Duration `json:"dial-timeout"`
|
||||
InsecureTransport bool `json:"insecure-transport"`
|
||||
@ -61,7 +61,7 @@ func configFromFile(fpath string) (*Config, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
yc := &YamlConfig{}
|
||||
yc := &yamlConfig{}
|
||||
|
||||
err = yaml.Unmarshal(b, yc)
|
||||
if err != nil {
|
||||
|
@ -32,22 +32,22 @@ var (
|
||||
|
||||
func TestConfigFromFile(t *testing.T) {
|
||||
tests := []struct {
|
||||
ym *YamlConfig
|
||||
ym *yamlConfig
|
||||
|
||||
werr bool
|
||||
}{
|
||||
{
|
||||
&YamlConfig{},
|
||||
&yamlConfig{},
|
||||
false,
|
||||
},
|
||||
{
|
||||
&YamlConfig{
|
||||
&yamlConfig{
|
||||
InsecureTransport: true,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
&YamlConfig{
|
||||
&yamlConfig{
|
||||
Keyfile: privateKeyPath,
|
||||
Certfile: certPath,
|
||||
CAfile: caPath,
|
||||
@ -56,14 +56,14 @@ func TestConfigFromFile(t *testing.T) {
|
||||
false,
|
||||
},
|
||||
{
|
||||
&YamlConfig{
|
||||
&yamlConfig{
|
||||
Keyfile: "bad",
|
||||
Certfile: "bad",
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
&YamlConfig{
|
||||
&yamlConfig{
|
||||
Keyfile: privateKeyPath,
|
||||
Certfile: certPath,
|
||||
CAfile: "bad",
|
||||
|
Loading…
x
Reference in New Issue
Block a user