Skip to content
Snippets Groups Projects
Select Git revision
  • a653b7d26cdf793f2481d4133428aa0dd4fef252
  • develop default
  • master protected
  • feature/frontend-tests
  • 0.98
  • 0.97
  • 0.96
  • 0.95
  • 0.94
  • 0.93
  • 0.92
  • 0.91
  • 0.90
  • 0.89
  • 0.88
  • 0.87
  • 0.86
  • 0.85
  • 0.84
  • 0.83
  • 0.82
  • 0.81
  • 0.80
  • 0.79
24 results

api.py

Blame
  • conf.py 2.32 KiB
    # Configuration file for the Sphinx documentation builder.
    #
    # For the full list of built-in configuration values, see the documentation:
    # https://www.sphinx-doc.org/en/master/usage/configuration.html
    
    from datetime import datetime
    import json
    import os
    import sys
    import tempfile
    
    sys.path.insert(
        0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
    )
    
    from mapping_provider import create_app
    
    
    # -- Project information -----------------------------------------------------
    # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
    
    project = 'GÉANT Mapping Provider'
    copyright = f"{datetime.now().year}, GÉANT"
    author = 'swd@geant.org'
    release = '0.0'
    
    # -- General configuration ---------------------------------------------------
    # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
    
    extensions = [
        "sphinx_rtd_theme",
        "sphinx.ext.autodoc",
        "sphinx.ext.coverage",
        "sphinxcontrib.plantuml",
        "sphinxcontrib.openapi",
    ]
    
    # tags is injected by sphinx into conf.py
    # toggle this by running ``sphinx-build -t drawio``
    if tags.has("drawio"):  # noqa F821
        extensions.append("sphinxcontrib.drawio")
    
    templates_path = ['_templates']
    exclude_patterns = []
    
    plantuml = f'java -jar {os.path.expanduser("~/bin/plantuml.jar")}'
    
    
    
    # -- Options for HTML output -------------------------------------------------
    # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
    
    html_theme = 'sphinx_rtd_theme'
    html_static_path = ['_static']
    
    
    # we need a minimal/parseable config file in order to
    # start the server and dump the schema
    with tempfile.NamedTemporaryFile(delete=False) as f:
    
        bogus_config = {
            'inventory': 'http://bogus',
            'reporting': 'https://bogus',
            'correlator_exchange': 'bogus',
            'brian': {
                'hostname': 'bogus',
                'username': 'bogus',
                'password': 'bogus',
                'database': 'bogus',
                'measurement': 'bogus',
            }
        }
        with open(f.name, 'w') as f:
            json.dump(bogus_config, f)
            f.flush()
            os.environ['SETTINGS_FILENAME'] = f.name
    
        api_schema = create_app().openapi()
    
    openapi_filename = os.path.join(os.path.dirname(__file__), "openapi.json")
    with open(openapi_filename, 'w') as f:
        json.dump(api_schema, f, indent=4)