system-info: expose env variables

This commit is contained in:
RhodeCode Admin 2021-12-01 13:53:38 +01:00
parent 6661b23cd5
commit b0f3ddc600
2 changed files with 55 additions and 2 deletions

View file

@ -20,8 +20,7 @@
import logging
import urllib2
import os
import rhodecode
from rhodecode.apps._base import BaseAppView
@ -40,6 +39,40 @@ class AdminSystemInfoSettingsView(BaseAppView):
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(BaseAppView):
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():

View file

@ -62,6 +62,25 @@
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">${_('Env Variables')}</h3>
</div>
<div class="panel-body">
<table>
<th></th>
<th></th>
% for env_key, env_val in c.env_data:
<tr>
<td style="vertical-align: top">${env_key}</td>
<td>${env_val}</td>
</tr>
% endfor
</table>
</div>
</div>
<script>
$('#check_for_update').click(function(e){
$('#update_notice').show();