Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions jupyterhub/files/hub/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,16 +478,33 @@ def camelCaseify(s):
c.CryptKeeper.keys = get_secret_value("hub.config.CryptKeeper.keys").split(";")

# load hub.config values, except potentially seeded secrets already loaded
for app, cfg in get_config("hub.config", {}).items():
if app == "JupyterHub":
for section, cfg in get_config("hub.config", {}).items():
if section == "JupyterHub":
cfg.pop("proxy_auth_token", None)
cfg.pop("cookie_secret", None)
cfg.pop("services", None)
elif app == "ConfigurableHTTPProxy":
elif section == "ConfigurableHTTPProxy":
cfg.pop("auth_token", None)
elif app == "CryptKeeper":
elif section == "CryptKeeper":
cfg.pop("keys", None)
c[app].update(cfg)

if not section[:1].isupper():
# traitlets config sections are Configurable class names
# that MUST start with upper-case
# if it starts with lowercase, it must be a mistake
# (e.g. putting `hub.loadRoles` under `hub.config.loadRoles`),
# and will have no effect, so warn or raise here
print(
f"FATAL: Invalid hub.config section name: {section}."
" hub.config sections must be Configurable class names (e.g. JupyterHub)."
" Maybe misplaced or misspelled config?",
file=sys.stderr,
)
# make this fatal:
sys.exit(1)

print(f"Loading pass-through config section hub.config.{section}")
c[section].update(cfg)

# load /usr/local/etc/jupyterhub/jupyterhub_config.d config files
config_dir = "/usr/local/etc/jupyterhub/jupyterhub_config.d"
Expand Down
14 changes: 13 additions & 1 deletion jupyterhub/values.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ properties:
for more info.
config:
type: object
additionalProperties: true
additionalProperties: false
description: |
JupyterHub and its components (authenticators, spawners, etc), are
Python classes that expose its configuration through
Expand Down Expand Up @@ -271,6 +271,18 @@ properties:
the `--values` or `-f` flag. During merging, lists are replaced while
dictionaries are updated.
```
# check that the first character is Capital,
# which is required for valid section names
# can't know all possible Configurable class names in advance, though
patternProperties:
"^[A-Z].*$":
type: object
additionalProperties: true
description: |
Pass-through traitlets configuration of Configurable classes.
Keys must always be class names that start with capitals,
and values must be objects.

properties:
JupyterHub:
type: object
Expand Down
Loading