diff options
author | mrsdizzie <info@mrsdizzie.com> | 2019-03-19 18:40:13 -0400 |
---|---|---|
committer | techknowlogick <matti@mdranta.net> | 2019-03-19 18:40:13 -0400 |
commit | f125330fcf89550e380057d69dae61871b5b0c8b (patch) | |
tree | 844d9568e80296e5274ea47f484af72461737583 /routers | |
parent | 5c82ef098e9d6138298c32f700bf46d2d5b3b14b (diff) | |
download | gitea-f125330fcf89550e380057d69dae61871b5b0c8b.tar.gz gitea-f125330fcf89550e380057d69dae61871b5b0c8b.zip |
Include more variables on admin/config page (#6378)
Include the current CustomPath location in the admin section and also
display GITEA_WORK_DIR and/or GITEA_CUSTOM env var if they are set.
Right now there is no easy way to see this information, and if you try
and help most users they won't be able to tell you anything about these
values -- just that their custom template isn't working, files aren't in
the right place, etc... Now you can see all paths and if they were set
by ENV or not.
Diffstat (limited to 'routers')
-rw-r--r-- | routers/admin/admin.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 7d98e1af36..4a46c1f432 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -6,6 +6,7 @@ package admin import ( "fmt" + "os" "runtime" "strings" "time" @@ -211,6 +212,7 @@ func Config(ctx *context.Context) { ctx.Data["RunMode"] = strings.Title(macaron.Env) ctx.Data["GitVersion"] = setting.Git.Version ctx.Data["RepoRootPath"] = setting.RepoRootPath + ctx.Data["CustomRootPath"] = setting.CustomPath ctx.Data["StaticRootPath"] = setting.StaticRootPath ctx.Data["LogRootPath"] = setting.LogRootPath ctx.Data["ScriptType"] = setting.ScriptType @@ -240,6 +242,20 @@ func Config(ctx *context.Context) { ctx.Data["Git"] = setting.Git + type envVar struct { + Name, Value string + } + + envVars := map[string]*envVar{} + if len(os.Getenv("GITEA_WORK_DIR")) > 0 { + envVars["GITEA_WORK_DIR"] = &envVar{"GITEA_WORK_DIR", os.Getenv("GITEA_WORK_DIR")} + } + if len(os.Getenv("GITEA_CUSTOM")) > 0 { + envVars["GITEA_CUSTOM"] = &envVar{"GITEA_CUSTOM", os.Getenv("GITEA_CUSTOM")} + } + + ctx.Data["EnvVars"] = envVars + type logger struct { Mode, Config string } |