Skip to content

Commit

Permalink
Merge pull request #297 from Zsailer/configmanager
Browse files Browse the repository at this point in the history
make config_dir_name in ConfigManager configurable.
  • Loading branch information
blink1073 committed Sep 1, 2020
2 parents 99bfb41 + b00f455 commit f4c429f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions jupyter_server/extension/serverextension.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def _get_extmanager_for_context(write_dir="jupyter_server_config.d", user=False,
Parameters
----------
write_dir : str [default: 'jupyter_server_config.d']
Name of config directory to write extension config.
user : bool [default: False]
Get the user's .jupyter config directory
sys_prefix : bool [default: False]
Expand All @@ -61,7 +62,7 @@ def _get_extmanager_for_context(write_dir="jupyter_server_config.d", user=False,
config_dir = _get_config_dir(user=user, sys_prefix=sys_prefix)
config_manager = ExtensionConfigManager(
read_config_path=[config_dir],
write_config_dir=os.path.join(config_dir, "jupyter_server_config.d"),
write_config_dir=os.path.join(config_dir, write_dir),
)
extension_manager = ExtensionManager(
config_manager=config_manager,
Expand Down
9 changes: 7 additions & 2 deletions jupyter_server/services/config/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
class ConfigManager(LoggingConfigurable):
"""Config Manager used for storing frontend config"""

config_dir_name = Unicode(
default="serverconfig",
help="""Name of the config directory."""
).tag(config=True)

# Public API

def get(self, section_name):
Expand All @@ -39,13 +44,13 @@ def update(self, section_name, new_data):

@default('read_config_path')
def _default_read_config_path(self):
return [os.path.join(p, 'serverconfig') for p in jupyter_config_path()]
return [os.path.join(p, self.config_dir_name) for p in jupyter_config_path()]

write_config_dir = Unicode()

@default('write_config_dir')
def _default_write_config_dir(self):
return os.path.join(jupyter_config_dir(), 'serverconfig')
return os.path.join(jupyter_config_dir(), self.config_dir_name)

write_config_manager = Instance(BaseJSONConfigManager)

Expand Down

0 comments on commit f4c429f

Please sign in to comment.