Skip to content

Commit

Permalink
feat: support read config file from stdin
Browse files Browse the repository at this point in the history
via `-f -`
  • Loading branch information
wwqgtxx committed Dec 10, 2024
1 parent 9a95920 commit f3a43fe
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/base64"
"flag"
"fmt"
"io"
"net"
"os"
"os/signal"
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit f3a43fe

Please sign in to comment.