mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-12-22 15:47:59 +08:00
feat: support read config file from stdin
Some checks are pending
Trigger CMFA Update / trigger-CMFA-update (push) Waiting to run
Some checks are pending
Trigger CMFA Update / trigger-CMFA-update (push) Waiting to run
via `-f -`
This commit is contained in:
parent
9a959202ed
commit
f3a43fe3a6
8
main.go
8
main.go
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user