Sfoglia il codice sorgente

Commands: "xray run -dump" supports reading JSON from STDIN (#5550)

Fixes https://github.com/XTLS/Xray-core/issues/5534
nobody 5 giorni fa
parent
commit
d75b33a3a3
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. 5 1
      core/config.go

+ 5 - 1
core/config.go

@@ -64,7 +64,11 @@ func GetMergedConfig(args cmdarg.Arg) (string, error) {
 	var files []*ConfigSource
 	supported := []string{"json", "yaml", "toml"}
 	for _, file := range args {
-		format := GetFormat(file)
+		format := "json"
+		if file != "stdin:" {
+			format = GetFormat(file)
+		}
+
 		if slices.Contains(supported, format) {
 			files = append(files, &ConfigSource{
 				Name:   file,