Initial config setup

This commit is contained in:
Jordan Bradford
2024-02-02 21:51:23 -05:00
parent 6dd2ee812a
commit d292457803
3 changed files with 11 additions and 0 deletions

1
tljh/config-schema.json Normal file
View File

@@ -0,0 +1 @@
file:///home/bradfojb/Desktop/Personal-Repos/the-littlest-jupyterhub/schema.json

View File

@@ -154,6 +154,13 @@ def remove_item_from_config(config, property_path, value):
return config_copy
def validate_config(config):
import json
import jsonschema
config_schema = json.load("config-schema.json")
jsonschema.validate(instance=config, schema=config_schema)
def show_config(config_path):
"""
Pretty print config from given config_path
@@ -180,6 +187,7 @@ def set_config_value(config_path, key_path, value):
config = {}
config = set_item_in_config(config, key_path, value)
validate_config(config)
with open(config_path, "w") as f:
yaml.dump(config, f)

View File

@@ -17,6 +17,8 @@ jupyterhub-tmpauthenticator>=1.0.0,<2
oauthenticator[azuread]>=16.0.4,<17
jupyterhub-idle-culler>=1.2.1,<2
jsonschema
# pycurl is installed to improve reliability and performance for when JupyterHub
# makes web requests. JupyterHub will use tornado's CurlAsyncHTTPClient when
# making requests over tornado's SimpleHTTPClient automatically if pycurl is