From fa363658dfef926f2b94af0be52787821812899d Mon Sep 17 00:00:00 2001 From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com> Date: Sat, 3 Feb 2024 13:08:27 -0500 Subject: [PATCH] Update schema based on values in `configurer.py` --- tljh/config.py | 3 ++- tljh/config_schema.py | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/tljh/config.py b/tljh/config.py index 09ee92e..1c4967b 100644 --- a/tljh/config.py +++ b/tljh/config.py @@ -156,7 +156,8 @@ def remove_item_from_config(config, property_path, value): def validate_config(config): import jsonschema - from config_schema import config_schema + + from .config_schema import config_schema try: jsonschema.validate(instance=config, schema=config_schema) diff --git a/tljh/config_schema.py b/tljh/config_schema.py index b0595b3..2a0c5f0 100644 --- a/tljh/config_schema.py +++ b/tljh/config_schema.py @@ -2,6 +2,9 @@ config_schema = { "$schema": "http://json-schema.org/draft-07/schema#", "title": "Littlest JupyterHub YAML config file", "definitions": { + "BaseURL": { + "type": "string", + }, "Users": { "type": "object", "additionalProperties": False, @@ -12,6 +15,26 @@ config_schema = { "admin": {"type": "array", "items": {"type": "string"}}, }, }, + "Services": { + "type": "object", + "properties": { + "cull": { + "type": "object", + "additionalProperties": False, + "properties": { + "enabled": {"type": "boolean"}, + "timeout": {"type": "integer"}, + "every": {"type": "integer"}, + "concurrency": {"type": "integer"}, + "users": { + "type": "boolean", + }, + "max_age": {"type": "integer"}, + "remove_named_servers": {"type": "boolean"}, + }, + } + }, + }, "HTTP": { "type": "object", "additionalProperties": False, @@ -65,13 +88,30 @@ config_schema = { } }, }, + "TraefikAPI": { + "type": "object", + "additionalProperties": False, + "properties": { + "ip": {"type": "string", "format": "ipv4"}, + "port": {"type": "integer"}, + "username": { + "type": "string", + }, + "password": { + "type": "string", + }, + }, + }, }, "properties": { "additionalProperties": False, + "base_url": {"$ref": "#/definitions/BaseURL"}, "user_environment": {"$ref": "#/definitions/UserEnvironment"}, "users": {"$ref": "#/definitions/Users"}, "limits": {"$ref": "#/definitions/Limits"}, "https": {"$ref": "#/definitions/HTTPS"}, "http": {"$ref": "#/definitions/HTTP"}, + "traefik_api": {"$ref": "#/definitions/TraefikAPI"}, + "services": {"$ref": "#/definitions/Services"}, }, }