# HG changeset patch # User RhodeCode Admin # Date 2021-12-01 12:53:38 # Node ID 9f402145d132b579264310bcdb337f6591b758f0 # Parent c6635c91b31edc820f6524f23f3a26b1e3c1515a system-info: expose env variables diff --git a/rhodecode/apps/admin/views/system_info.py b/rhodecode/apps/admin/views/system_info.py --- a/rhodecode/apps/admin/views/system_info.py +++ b/rhodecode/apps/admin/views/system_info.py @@ -20,8 +20,7 @@ import logging import urllib2 - - +import os import rhodecode from rhodecode.apps._base import BaseAppView @@ -40,6 +39,40 @@ class AdminSystemInfoSettingsView(BaseAp c = self._get_local_tmpl_context() return c + def get_env_data(self): + black_list = [ + 'NIX_LDFLAGS', + 'NIX_CFLAGS_COMPILE', + 'propagatedBuildInputs', + 'propagatedNativeBuildInputs', + 'postInstall', + 'buildInputs', + 'buildPhase', + 'preShellHook', + 'preShellHook', + 'preCheck', + 'preBuild', + 'postShellHook', + 'postFixup', + 'postCheck', + 'nativeBuildInputs', + 'installPhase', + 'installCheckPhase', + 'checkPhase', + 'configurePhase', + 'shellHook' + ] + secret_list = [ + 'RHODECODE_USER_PASS' + ] + + for k, v in sorted(os.environ.items()): + if k in black_list: + continue + if k in secret_list: + v = '*****' + yield k, v + @LoginRequired() @HasPermissionAllDecorator('hg.admin') def settings_system_info(self): @@ -55,6 +88,7 @@ class AdminSystemInfoSettingsView(BaseAp snapshot = str2bool(self.request.params.get('snapshot')) c.rhodecode_update_url = UpdateModel().get_update_url() + c.env_data = self.get_env_data() server_info = system_info.get_system_info(self.request.environ) for key, val in server_info.items(): diff --git a/rhodecode/templates/admin/settings/settings_system.mako b/rhodecode/templates/admin/settings/settings_system.mako --- a/rhodecode/templates/admin/settings/settings_system.mako +++ b/rhodecode/templates/admin/settings/settings_system.mako @@ -62,6 +62,25 @@ +
+
+

${_('Env Variables')}

+
+
+ + + + % for env_key, env_val in c.env_data: + + + + + % endfor +
${env_key}${env_val}
+ +
+
+