From f3a43fe3a612a1dffca4f5816ebdaa9a9d93d059 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Tue, 10 Dec 2024 09:57:20 +0800 Subject: [PATCH] feat: support read config file from stdin via `-f -` --- main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.go b/main.go index 685fc89f..9a2222df 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "encoding/base64" "flag" "fmt" + "io" "net" "os" "os/signal" @@ -99,6 +100,13 @@ func main() { log.Fatalln("Initial configuration error: %s", err.Error()) 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 { if configFile != "" { if !filepath.IsAbs(configFile) {