mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Merge pull request #87 from yuvipanda/escape-hatch
Load arbitrary .py config files from a conf.d dir
This commit is contained in:
@@ -83,6 +83,7 @@ Topic guides provide in-depth explanations of specific topics.
|
|||||||
topic/installer-actions
|
topic/installer-actions
|
||||||
topic/tljh-config
|
topic/tljh-config
|
||||||
topic/authenticator-configuration
|
topic/authenticator-configuration
|
||||||
|
topic/escape-hatch
|
||||||
|
|
||||||
|
|
||||||
Troubleshooting
|
Troubleshooting
|
||||||
|
|||||||
17
docs/topic/escape-hatch.rst
Normal file
17
docs/topic/escape-hatch.rst
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
.. _topic/escape-hatch:
|
||||||
|
|
||||||
|
========================================
|
||||||
|
Custom ``jupyterhub_config.py`` snippets
|
||||||
|
========================================
|
||||||
|
|
||||||
|
Sometimes you need to customize TLJH in ways that are not officially supported.
|
||||||
|
We provide an easy escape hatch for those cases with a ``jupyterhub_conf.d``
|
||||||
|
directory that lets you load multiple ``jupyterhub_config.py`` snippets for
|
||||||
|
your configuration. You need to create the directory when you use it for
|
||||||
|
the first time.
|
||||||
|
|
||||||
|
Any files in ``/opt/tljh/jupyterhub_config.d`` that end in ``.py`` will be
|
||||||
|
loaded in alphabetical order as python files to provide configuration for
|
||||||
|
JupyterHub. Any config that can go in a regular ``jupyterhub_config.py``
|
||||||
|
file is valid in these files. They will be loaded *after* any of the config
|
||||||
|
options specified with ``tljh-config`` are loaded.
|
||||||
@@ -3,8 +3,8 @@ JupyterHub config for the littlest jupyterhub.
|
|||||||
"""
|
"""
|
||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
from glob import glob
|
||||||
|
|
||||||
from systemdspawner import SystemdSpawner
|
from systemdspawner import SystemdSpawner
|
||||||
from tljh import user, configurer
|
from tljh import user, configurer
|
||||||
@@ -47,3 +47,9 @@ if os.path.exists(config_overrides_path):
|
|||||||
else:
|
else:
|
||||||
config_overrides = {}
|
config_overrides = {}
|
||||||
configurer.apply_config(config_overrides, c)
|
configurer.apply_config(config_overrides, c)
|
||||||
|
|
||||||
|
# Load arbitrary .py config files if they exist.
|
||||||
|
# This is our escape hatch
|
||||||
|
extra_configs = sorted(glob(os.path.join(INSTALL_PREFIX, 'jupyterhub_config.d', '*.py')))
|
||||||
|
for ec in extra_configs:
|
||||||
|
load_subconfig(ec)
|
||||||
|
|||||||
Reference in New Issue
Block a user