mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-07 18:14:10 +00:00
Add Configuration Reference
This commit is contained in:
@@ -60,11 +60,65 @@ default_role = 'literal'
|
|||||||
import recommonmark
|
import recommonmark
|
||||||
from recommonmark.transform import AutoStructify
|
from recommonmark.transform import AutoStructify
|
||||||
|
|
||||||
|
# -- Config -------------------------------------------------------------
|
||||||
|
from jupyterhub.app import JupyterHub
|
||||||
|
from docutils import nodes
|
||||||
|
from sphinx.directives.other import SphinxDirective
|
||||||
|
from contextlib import redirect_stdout
|
||||||
|
from io import StringIO
|
||||||
|
|
||||||
|
# create a temp instance of JupyterHub just to get the output of the generate-config
|
||||||
|
# and help --all commands.
|
||||||
|
jupyterhub_app = JupyterHub()
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigDirective(SphinxDirective):
|
||||||
|
"""Generate the configuration file output for use in the documentation."""
|
||||||
|
|
||||||
|
has_content = False
|
||||||
|
required_arguments = 0
|
||||||
|
optional_arguments = 0
|
||||||
|
final_argument_whitespace = False
|
||||||
|
option_spec = {}
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
# The generated configuration file for this version
|
||||||
|
generated_config = jupyterhub_app.generate_config_file()
|
||||||
|
# post-process output
|
||||||
|
home_dir = os.environ['HOME']
|
||||||
|
generated_config = generated_config.replace(home_dir, '$HOME', 1)
|
||||||
|
par = nodes.literal_block(text=generated_config)
|
||||||
|
return [par]
|
||||||
|
|
||||||
|
|
||||||
|
class HelpAllDirective(SphinxDirective):
|
||||||
|
"""Print the output of jupyterhub help --all for use in the documentation."""
|
||||||
|
|
||||||
|
has_content = False
|
||||||
|
required_arguments = 0
|
||||||
|
optional_arguments = 0
|
||||||
|
final_argument_whitespace = False
|
||||||
|
option_spec = {}
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
# The output of the help command for this version
|
||||||
|
buffer = StringIO()
|
||||||
|
with redirect_stdout(buffer):
|
||||||
|
jupyterhub_app.print_help('--help-all')
|
||||||
|
all_help = buffer.getvalue()
|
||||||
|
# post-process output
|
||||||
|
home_dir = os.environ['HOME']
|
||||||
|
all_help = all_help.replace(home_dir, '$HOME', 1)
|
||||||
|
par = nodes.literal_block(text=all_help)
|
||||||
|
return [par]
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
app.add_config_value('recommonmark_config', {'enable_eval_rst': True}, True)
|
app.add_config_value('recommonmark_config', {'enable_eval_rst': True}, True)
|
||||||
app.add_css_file('custom.css')
|
app.add_css_file('custom.css')
|
||||||
app.add_transform(AutoStructify)
|
app.add_transform(AutoStructify)
|
||||||
|
app.add_directive('jupyterhub-generate-config', ConfigDirective)
|
||||||
|
app.add_directive('jupyterhub-help-all', HelpAllDirective)
|
||||||
|
|
||||||
|
|
||||||
source_suffix = ['.rst', '.md']
|
source_suffix = ['.rst', '.md']
|
||||||
|
30
docs/source/reference/config-reference.rst
Normal file
30
docs/source/reference/config-reference.rst
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
==============================
|
||||||
|
Configuration Reference
|
||||||
|
==============================
|
||||||
|
|
||||||
|
.. important::
|
||||||
|
|
||||||
|
Make sure the version of JupyterHub for this documentation matches your
|
||||||
|
installation version, as the output of this command may change between versions.
|
||||||
|
|
||||||
|
JupyterHub configuration
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
As explained in the `Configuration Basics <../getting-started/config-basics.html#generate-a-default-config-file>`_
|
||||||
|
section, the ``jupyterhub-config.py`` can be automatically generated via
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
jupyterhub --generate-config
|
||||||
|
|
||||||
|
|
||||||
|
The following contains the output of that command for reference.
|
||||||
|
|
||||||
|
.. jupyterhub-generate-config::
|
||||||
|
|
||||||
|
JupyterHub help command output
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
This section contains the output of the command ``jupyterhub --help-all``.
|
||||||
|
|
||||||
|
.. jupyterhub-help-all::
|
@@ -24,3 +24,4 @@ what happens under-the-hood when you deploy and configure your JupyterHub.
|
|||||||
config-ghoauth
|
config-ghoauth
|
||||||
config-proxy
|
config-proxy
|
||||||
config-sudo
|
config-sudo
|
||||||
|
config-reference
|
||||||
|
Reference in New Issue
Block a user