From e28a7e00b99fdc2f5b50d4f7868322be16784479 Mon Sep 17 00:00:00 2001 From: yuzuki999 Date: Sun, 3 Sep 2023 02:59:54 +0800 Subject: [PATCH] add default CertConfig --- conf/cert.go | 6 ++++++ conf/node.go | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/conf/cert.go b/conf/cert.go index 1f289dc..23c2c96 100644 --- a/conf/cert.go +++ b/conf/cert.go @@ -10,3 +10,9 @@ type CertConfig struct { Email string `json:"Email"` DNSEnv map[string]string `json:"DNSEnv"` } + +func NewCertConfig() *CertConfig { + return &CertConfig{ + CertMode: "none", + } +} diff --git a/conf/node.go b/conf/node.go index 393849b..e0cd704 100644 --- a/conf/node.go +++ b/conf/node.go @@ -29,31 +29,33 @@ func (n *NodeConfig) UnmarshalJSON(data []byte) (err error) { if err != nil { return err } + n.ApiConfig = ApiConfig{ + APIHost: "http://127.0.0.1", + Timeout: 30, + } if len(r.ApiRaw) > 0 { err = json.Unmarshal(r.ApiRaw, &n.ApiConfig) if err != nil { return } } else { - n.ApiConfig = ApiConfig{ - APIHost: "http://127.0.0.1", - Timeout: 30, - } err = json.Unmarshal(data, &n.ApiConfig) if err != nil { return } } + + n.Options = Options{ + ListenIP: "0.0.0.0", + SendIP: "0.0.0.0", + CertConfig: NewCertConfig(), + } if len(r.OptRaw) > 0 { err = json.Unmarshal(r.OptRaw, &n.Options) if err != nil { return } } else { - n.Options = Options{ - ListenIP: "0.0.0.0", - SendIP: "0.0.0.0", - } err = json.Unmarshal(data, &n.Options) if err != nil { return