summaryrefslogtreecommitdiffstats
path: root/modules/setting/setting.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/setting/setting.go')
-rw-r--r--modules/setting/setting.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 5fb1d52d0b..7442774488 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -6,6 +6,7 @@ package setting
import (
"fmt"
+ "net/url"
"os"
"os/exec"
"path"
@@ -31,9 +32,10 @@ const (
var (
// App settings.
- AppVer string
- AppName string
- AppUrl string
+ AppVer string
+ AppName string
+ AppUrl string
+ AppRootSubUrl string
// Server settings.
Protocol Scheme
@@ -165,6 +167,12 @@ func NewConfigContext() {
AppUrl += "/"
}
+ url, err := url.Parse(AppUrl)
+ if err != nil {
+ log.Fatal(4, "Invalid ROOT_URL %s: %s", AppUrl, err)
+ }
+ AppRootSubUrl = strings.TrimSuffix(url.Path, "/")
+
Protocol = HTTP
if Cfg.MustValue("server", "PROTOCOL") == "https" {
Protocol = HTTPS