Skip to content

Commit

Permalink
Load and include template config from JSON file
Browse files Browse the repository at this point in the history
  • Loading branch information
mkcor committed Jul 25, 2019
1 parent 4a5027c commit d17af8a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions voila/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@
import tornado.web

from traitlets.config.application import Application
from traitlets.config.loader import JSONFileConfigLoader
from traitlets import Unicode, Integer, Bool, Dict, List, default

from jupyter_server.services.kernels.kernelmanager import MappingKernelManager
from jupyter_server.services.kernels.handlers import KernelHandler, ZMQChannelsHandler
from jupyter_server.services.contents.largefilemanager import LargeFileManager
from jupyter_server.base.handlers import path_regex
from jupyter_server.config_manager import recursive_update
from jupyter_server.utils import url_path_join
from jupyter_server.services.config import ConfigManager
from jupyter_server.base.handlers import FileFindHandler
Expand Down Expand Up @@ -339,6 +341,12 @@ def setup_template_dirs(self):
self.static_paths,
self.template_paths,
self.voila_configuration.template)
# then we load the template-related config
loader = JSONFileConfigLoader('conf.json', self.nbconvert_template_paths)
conf = loader.load_config()
# and update the overall config with it, preserving CLI config priority
recursive_update(dict(conf), dict(self.voila_configuration.config))
self.voila_configuration.config.VoilaConfiguration = conf.VoilaConfiguration
self.log.debug('using template: %s', self.voila_configuration.template)
self.log.debug('nbconvert template paths:\n\t%s', '\n\t'.join(self.nbconvert_template_paths))
self.log.debug('template paths:\n\t%s', '\n\t'.join(self.template_paths))
Expand Down

0 comments on commit d17af8a

Please sign in to comment.