mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-04-19 19:59:13 +03:00
Add configurable bind address (#36)
This commit is contained in:
parent
5ec77ecd72
commit
b8142b80c2
2 changed files with 5 additions and 1 deletions
5
main.go
5
main.go
|
@ -24,10 +24,12 @@ var (
|
|||
func init() {
|
||||
// command-line flags
|
||||
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()
|
||||
|
||||
// update runtime config
|
||||
util.DisableLogin = *flagDisableLogin
|
||||
util.BindAddress = *flagBindAddress
|
||||
|
||||
// print app information
|
||||
fmt.Println("Wireguard UI")
|
||||
|
@ -37,6 +39,7 @@ func init() {
|
|||
fmt.Println("Build Time\t:", buildTime)
|
||||
fmt.Println("Git Repo\t:", "https://github.com/ngoduykhanh/wireguard-ui")
|
||||
fmt.Println("Authentication\t:", !util.DisableLogin)
|
||||
fmt.Println("Bind address\t:", util.BindAddress)
|
||||
|
||||
// initialize DB
|
||||
err := util.InitDB()
|
||||
|
@ -86,5 +89,5 @@ func main() {
|
|||
// servers other static files
|
||||
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
|
||||
var (
|
||||
DisableLogin bool
|
||||
BindAddress string
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue