Browse Source

update: read debug and config flag from env

v1.x.x
dnomd343 2 years ago
parent
commit
ea1a8403f7
  1. 12
      cmd/xproxy.go

12
cmd/xproxy.go

@ -13,7 +13,7 @@ import (
"strconv" "strconv"
) )
var version = "0.9.4" var version = "0.9.5"
var v4RouteTable = 104 var v4RouteTable = 104
var v6RouteTable = 106 var v6RouteTable = 106
var v4TProxyPort = 7288 var v4TProxyPort = 7288
@ -43,8 +43,12 @@ func logInit(isDebug bool, logDir string) {
} }
func xproxyInit() { func xproxyInit() {
var isDebug = flag.Bool("debug", false, "Enable debug mode") xproxyConfig := "xproxy.yml"
var configName = flag.String("config", "xproxy.yml", "Config file name") if os.Getenv("CONFIG") != "" {
xproxyConfig = os.Getenv("CONFIG")
}
isDebug := flag.Bool("debug", os.Getenv("DEBUG") == "true", "Enable debug mode")
configName := flag.String("config", xproxyConfig, "Config file name")
flag.Parse() flag.Parse()
exposeDir = "/xproxy" // default folder exposeDir = "/xproxy" // default folder
@ -99,5 +103,5 @@ func main() {
blockWait() blockWait()
process.Exit(subProcess...) process.Exit(subProcess...)
custom.RunPostScript(&settings.Custom) custom.RunPostScript(&settings.Custom)
log.Infof("All done, goodbye!") log.Warningf("All done, goodbye!")
} }

Loading…
Cancel
Save