There is no ConfigManager in JupyterHub. That’s strictly for client-side
nbextensions in the single-user server.

Once your Authenticator is instantiated, the config is loaded as self.config.
That said, you shouldn’t ever need to access the config object directly.
Configuration is done through traitlets
<https://traitlets.readthedocs.io/en/stable/config.html#python-configuration-files>.
Once you have declared the configurable traits with .tag(config=True), you
can set them in your config file and instantiation takes care of the rest:

from traitlets import Unicodefrom jupyterhub.auth import Authenticator
class MyAuthenticator(Authenticator):
    thing = Unicode('default', help='helpful info').tag(config=True)

then in your jupyterhub_config.py, set this value:

c.MyAuthenticator.thing = 'not the default'

-MinRK
​

On Fri, Aug 5, 2016 at 11:41 PM, Ted Liefeld <[email protected]>
wrote:

> I have created a custom authenticator and I would like to paramaterize a
> few bits of it but I am struggling to understand how to get a hold of the
> populated ConfigManager instance from the Jupyterhub.
>
> I tried adding
>      from notebook.services.config import ConfigManager
> and then
>     cm = ConfigManager()
>     print("Config is " , cm.get("JupyterHub"))
>
> thinking this would get me the values for the "JupyterHub" section which I
> know has entries that are being used.  This is always coming back empty
> though.  I figure I need to get the populated instance from the JupyterHub
> application but I can't quite figure out how to get my hands on it.
>
> I also looked at the OAuth authenticator
> <https://github.com/jupyterhub/oauthenticator/blob/master/oauthenticator/oauth2.py>
> thinking it did the same thing, but it only ever does things like this
>     os.getenv('OAUTH_CALLBACK_URL', '')
> which is surprising since from the docs it looks like it puts params in
> the file
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jupyter/44d3543d-816a-4e6a-a9b8-94a06ba5045f%40googlegroups.com
> <https://groups.google.com/d/msgid/jupyter/44d3543d-816a-4e6a-a9b8-94a06ba5045f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAHNn8BWNrfO9_5X0xv4_uM_t8vJOmFR0saBr3GghFrmuGG-2Aw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to