Skip to content

Commit

Permalink
Merge pull request #2226 from DOAJ/features/3577_turn_off_config_module
Browse files Browse the repository at this point in the history
turn off config module
  • Loading branch information
Steven-Eardley committed Apr 10, 2023
2 parents b7287e9 + 599bd46 commit f99af12
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions portality/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
DEBUG_TB_TEMPLATE_EDITOR_ENABLED = True
DEBUG_TB_INTERCEPT_REDIRECTS = False

# set to True to enable the env list panel in the debug toolbar
DEBUG_TB_ENV_LIST_ENABLED = False

#######################################
# Elasticsearch configuration
#~~->Elasticsearch:Technology
Expand Down
11 changes: 11 additions & 0 deletions portality/ui/debug_toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,16 @@ class DoajDebugToolbar(DebugToolbarExtension):

def _default_config(self, app):
config = super()._default_config(app)

# add branch name panel
config['DEBUG_TB_PANELS'] += (f'{BranchNamePanel.__module__}.{BranchNamePanel.__name__}',)

# remove env list panel if not enabled
key_env_list = 'flask_debugtoolbar.panels.config_vars.ConfigVarsDebugPanel'
panels = list(config['DEBUG_TB_PANELS'])

if not app.config.get('DEBUG_TB_ENV_LIST_ENABLED', False) and key_env_list in panels:
panels.remove(key_env_list)
config['DEBUG_TB_PANELS'] = tuple(panels)

return config

0 comments on commit f99af12

Please sign in to comment.