go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
42.98k stars 5.3k forks source link

Admin interface: config summary shows unused option #31505

Open balki opened 4 days ago

balki commented 4 days ago

Description

On the configuration summary page - [gitea-instance]/admin/config , I see below setting

Reverse Authentication User    X-WEBAUTH-USER

This setting is not applicable unless ENABLE_REVERSE_PROXY_AUTHENTICATION is true. This is false by default.

Displaying this setting is confusing, useless and not applicable.


Possible solution is to guard this entry with a check (untested)

❯ git diff  
diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl
index 8c16429920..f7de7c1b74 100644
--- a/templates/admin/config.tmpl
+++ b/templates/admin/config.tmpl
@@ -44,8 +44,10 @@
                                <dd>{{.LogRootPath}}</dd>
                                <dt>{{ctx.Locale.Tr "admin.config.script_type"}}</dt>
                                <dd>{{.ScriptType}}</dd>
+                {{if .Service.EnableReverseProxyAuth}}
                                <dt>{{ctx.Locale.Tr "admin.config.reverse_auth_user"}}</dt>
                                <dd>{{.ReverseProxyAuthUser}}</dd>
+                {{end}}
                        </dl>
                </div>

Screenshots

image

Gitea Version

1.22.0

Can you reproduce the bug on the Gitea demo site?

N/A

Operating System

Linux

Browser Version

Firefox

yp05327 commented 4 days ago

Can you create a PR to fix it. 😄

balki commented 3 days ago

I can create with just the proposed change. But may be it needs a minor redesign. I see there is a similar another setting ENABLE_REVERSE_PROXY_AUTHENTICATION_API which also may need to be checked.. There are more similar settings that are not in the summary now.

REVERSE_PROXY_AUTHENTICATION_EMAIL
REVERSE_PROXY_AUTHENTICATION_FULL_NAME
yp05327 commented 3 days ago

Maybe it is better to genereted /admin/config by code, but not hard coding it in templates.