重构
This commit is contained in:
parent
7e15185359
commit
a1defc9aff
2
main.go
2
main.go
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"acme-client/src"
|
"acme-client/src"
|
||||||
"bufio"
|
"bufio"
|
||||||
"github.com/go-acme/lego/v4/log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
|
@ -135,7 +135,7 @@ func getCert() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !isDoGet {
|
if !isDoGet {
|
||||||
log.Println("日志文件已存在, 无需更新.\n如果需要强制更新, 请使用命令: get -f")
|
fmt.Println("日志文件已存在, 无需更新.\n如果需要强制更新, 请使用命令: get -f")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
domainData, err := doGetCert(domain.Name)
|
domainData, err := doGetCert(domain.Name)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package src
|
package src
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-acme/lego/v4/log"
|
|
||||||
"github.com/go-acme/lego/v4/platform/config/env"
|
"github.com/go-acme/lego/v4/platform/config/env"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ func InitConfig() {
|
||||||
_, err := os.Stat(confFile)
|
_, err := os.Stat(confFile)
|
||||||
|
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
log.Infof("客户端配置文件不存在,自动创建默认配置文件")
|
log.Println("客户端配置文件不存在,自动创建默认配置文件")
|
||||||
conf := defaultConfig()
|
conf := defaultConfig()
|
||||||
file, err := os.Create(confFile)
|
file, err := os.Create(confFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"github.com/go-acme/lego/v4/log"
|
"log"
|
||||||
"math/big"
|
"math/big"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user