From 3124cf1f8087fdfa7f74afd05f5296b3256a5af8 Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Mon, 30 Jul 2018 22:35:55 -0700 Subject: [PATCH] Load arbitrary .py config files from a conf.d dir We want to keep the amount of custom code we support extremely small. This provides a nice escape hatch for everything else. --- tljh/jupyterhub_config.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tljh/jupyterhub_config.py b/tljh/jupyterhub_config.py index 1e28469..21976e9 100644 --- a/tljh/jupyterhub_config.py +++ b/tljh/jupyterhub_config.py @@ -3,8 +3,8 @@ JupyterHub config for the littlest jupyterhub. """ import copy import os - import yaml +from glob import glob from systemdspawner import SystemdSpawner from tljh import user, configurer @@ -47,3 +47,9 @@ if os.path.exists(config_overrides_path): else: config_overrides = {} 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, 'config.d', '*.py'))) +for ec in extra_configs: + load_subconfig(ec)