Skip to content

Commit

Permalink
jupyter server extension now utilizes configuration settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Raney authored and Austin Raney committed Sep 27, 2021
1 parent 7ec1f85 commit e8d73c0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions hydroshare_jupyter_sync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

# local imports
from .config_setup import ConfigFile
from .handlers import get_route_handlers

# Constants
Expand Down Expand Up @@ -39,9 +40,19 @@ def _load_jupyter_server_extension(server_app):
"""
handlers = get_route_handlers(FRONTEND_PATH, BACKEND_PATH)

# `cookie_secret` inherited from `server_app`
server_app.web_app.add_handlers(".*$", handlers)
server_app.log.info(f"Registered {MODULE_NAME} extension")

# parse config file. if env variables present, they take precedence.
# looks for config in following order:
# 1. "~/.config/hydroshare_jupyter_sync/config"
# 2. "~/.hydroshare_jupyter_sync_config"
config = ConfigFile()

# pass config file settings to Tornado Application (web app)
server_app.web_app.settings.update(config.dict())


# For backward compatibility with the classical notebook
load_jupyter_server_extension = _load_jupyter_server_extension

0 comments on commit e8d73c0

Please sign in to comment.