Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load arbitrary .py config files from a conf.d dir #87

Merged
merged 4 commits into from Aug 2, 2018

Conversation

yuvipanda
Copy link
Collaborator

@yuvipanda yuvipanda commented Jul 31, 2018

We want to keep the amount of custom code we support extremely
small. This provides a nice escape hatch for everything else.

  • Add documentation on how to use this
  • Add a test for this


# Load arbitrary .py config files if they exist.
# This is our escape hatch
extra_configs = sorted(glob(os.path.join(INSTALL_PREFIX, 'config.d', '*.py')))
Copy link
Member

@minrk minrk Jul 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it 'jupyterhub_config.d' to make it clearer that it's really jupyterhub_config.py split into multiple files

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, @minrk! Will do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh - does .d indicate for historial reasons that a file is a partial file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@consideRatio yep! I picked it up from linux distros like debian - you have a /etc/sudoers file and a /etc/sudoers.d directory that can contain partials.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! I love when a piece like that falls into place! ❤️ @minrk @yuvipanda

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's even a plan to support this directly in traitlets by default, so we could get this for free in the future. There the pattern is exactly: anywhere you find app_config.py, also look in app_config.d.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, @minrk

@minrk
Copy link
Member

minrk commented Aug 1, 2018

Should we create the jupyterhub_config.d directory with a README during install?

@yuvipanda
Copy link
Collaborator Author

@minrk since i consider this an 'advanced use case', I think it's fine to not do that. But I'll add a note to the docs about needing to create the directory.

We want to keep the amount of custom code we support extremely
small. This provides a nice escape hatch for everything else.
Makes it clearer that these are jupyterhub_config.py snippets
rather than config.yaml snippets
@yuvipanda
Copy link
Collaborator Author

No tests for this, need to land #97 first.

@yuvipanda yuvipanda merged commit dc12759 into jupyterhub:master Aug 2, 2018
@yuvipanda yuvipanda deleted the escape-hatch branch August 2, 2018 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants