feat: support read config file from stdin
Some checks are pending
Trigger CMFA Update / trigger-CMFA-update (push) Waiting to run

via `-f -`
This commit is contained in:
wwqgtxx 2024-12-10 09:57:20 +08:00
parent 9a959202ed
commit f3a43fe3a6

View File

@ -5,6 +5,7 @@ import (
"encoding/base64" "encoding/base64"
"flag" "flag"
"fmt" "fmt"
"io"
"net" "net"
"os" "os"
"os/signal" "os/signal"
@ -99,6 +100,13 @@ func main() {
log.Fatalln("Initial configuration error: %s", err.Error()) log.Fatalln("Initial configuration error: %s", err.Error())
return return
} }
} else if configFile == "-" {
var err error
configBytes, err = io.ReadAll(os.Stdin)
if err != nil {
log.Fatalln("Initial configuration error: %s", err.Error())
return
}
} else { } else {
if configFile != "" { if configFile != "" {
if !filepath.IsAbs(configFile) { if !filepath.IsAbs(configFile) {