mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-04-21 20:12:33 +03:00
Add configurable bind address
This commit is contained in:
parent
9dca2b7361
commit
6b67969a8d
3 changed files with 7 additions and 1 deletions
2
go.mod
2
go.mod
|
@ -12,6 +12,8 @@ require (
|
||||||
github.com/labstack/echo/v4 v4.1.16
|
github.com/labstack/echo/v4 v4.1.16
|
||||||
github.com/labstack/gommon v0.3.0
|
github.com/labstack/gommon v0.3.0
|
||||||
github.com/leodido/go-urn v1.2.0 // indirect
|
github.com/leodido/go-urn v1.2.0 // indirect
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
|
github.com/modern-go/reflect2 v1.0.1 // indirect
|
||||||
github.com/rs/xid v1.2.1
|
github.com/rs/xid v1.2.1
|
||||||
github.com/sdomino/scribble v0.0.0-20191024200645-4116320640ba
|
github.com/sdomino/scribble v0.0.0-20191024200645-4116320640ba
|
||||||
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086
|
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086
|
||||||
|
|
5
main.go
5
main.go
|
@ -24,10 +24,12 @@ var (
|
||||||
func init() {
|
func init() {
|
||||||
// command-line flags
|
// command-line flags
|
||||||
flagDisableLogin := flag.Bool("disable-login", false, "Disable login page. Turn off authentication.")
|
flagDisableLogin := flag.Bool("disable-login", false, "Disable login page. Turn off authentication.")
|
||||||
|
flagBindAddress := flag.String("bind-address", "0.0.0.0:5000", "Address:Port to which the app will be bound.")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
// update runtime config
|
// update runtime config
|
||||||
util.DisableLogin = *flagDisableLogin
|
util.DisableLogin = *flagDisableLogin
|
||||||
|
util.BindAddress = *flagBindAddress
|
||||||
|
|
||||||
// print app information
|
// print app information
|
||||||
fmt.Println("Wireguard UI")
|
fmt.Println("Wireguard UI")
|
||||||
|
@ -37,6 +39,7 @@ func init() {
|
||||||
fmt.Println("Build Time\t:", buildTime)
|
fmt.Println("Build Time\t:", buildTime)
|
||||||
fmt.Println("Git Repo\t:", "https://github.com/ngoduykhanh/wireguard-ui")
|
fmt.Println("Git Repo\t:", "https://github.com/ngoduykhanh/wireguard-ui")
|
||||||
fmt.Println("Authentication\t:", !util.DisableLogin)
|
fmt.Println("Authentication\t:", !util.DisableLogin)
|
||||||
|
fmt.Println("Bind address\t:", util.BindAddress)
|
||||||
|
|
||||||
// initialize DB
|
// initialize DB
|
||||||
err := util.InitDB()
|
err := util.InitDB()
|
||||||
|
@ -86,5 +89,5 @@ func main() {
|
||||||
// servers other static files
|
// servers other static files
|
||||||
app.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", assetHandler)))
|
app.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", assetHandler)))
|
||||||
|
|
||||||
app.Logger.Fatal(app.Start("0.0.0.0:5000"))
|
app.Logger.Fatal(app.Start(util.BindAddress))
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,4 +3,5 @@ package util
|
||||||
// Runtime config
|
// Runtime config
|
||||||
var (
|
var (
|
||||||
DisableLogin bool
|
DisableLogin bool
|
||||||
|
BindAddress string
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue