mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-05-23 00:15:19 +03:00
*: allows for BASE_PATH configuration (#183)
This commit is contained in:
parent
90bb2851bf
commit
87b08a8f7c
13 changed files with 108 additions and 84 deletions
|
@ -1,5 +1,7 @@
|
|||
package util
|
||||
|
||||
import "strings"
|
||||
|
||||
// Runtime config
|
||||
var (
|
||||
DisableLogin bool
|
||||
|
@ -17,6 +19,7 @@ var (
|
|||
EmailContent string
|
||||
SessionSecret []byte
|
||||
WgConfTemplate string
|
||||
BasePath string
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -32,3 +35,13 @@ const (
|
|||
UsernameEnvVar = "WGUI_USERNAME"
|
||||
PasswordEnvVar = "WGUI_PASSWORD"
|
||||
)
|
||||
|
||||
func ParseBasePath(basePath string) string {
|
||||
if !strings.HasPrefix(basePath, "/") {
|
||||
basePath = "/" + basePath
|
||||
}
|
||||
if strings.HasSuffix(basePath, "/") {
|
||||
basePath = strings.TrimSuffix(basePath, "/")
|
||||
}
|
||||
return basePath
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue