Repository: jupyterhub/jupyterhub

Issue:
two flags  on start up
here is the output from terminal:

```
[I 2018-03-16 10:39:28.004 JupyterHub app:834] Loading cookie_secret from /srv/jupyterhub/jupyterhub_cookie_secret
[I 2018-03-16 10:39:28.124 JupyterHub app:1528] Hub API listening on http://127.0.0.1:8081/hub/
[W 2018-03-16 10:39:28.125 JupyterHub proxy:415] 
    Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require restarting the proxy.
    Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message.
    
[I 2018-03-16 10:39:28.126 JupyterHub proxy:458] Starting proxy @ https://*:8000/
10:39:28.338 - info: [ConfigProxy] Proxying https://*:8000 to (no default)
10:39:28.341 - info: [ConfigProxy] Proxy API at http://127.0.0.1:8001/api/routes
10:39:28.679 - info: [ConfigProxy] 200 GET /api/routes 
[W 2018-03-16 10:39:28.680 JupyterHub proxy:304] Adding missing default route
[I 2018-03-16 10:39:28.680 JupyterHub proxy:370] Adding default route for Hub: / => http://127.0.0.1:8081
10:39:28.728 - info: [ConfigProxy] Adding route / -> http://127.0.0.1:8081
10:39:28.729 - info: [ConfigProxy] 201 POST /api/routes/ 
[I 2018-03-16 10:39:28.730 JupyterHub app:1581] JupyterHub is now running at https://:8000/
```

everything starts up fine and is totally useable but the two flags im getting: 
Generating CONFIGPROXY_AUTH_TOKEN.
Adding missing default route

how can i generate a proxy auth token? I have googled to the end but only seem to find deprecated info 

second how can i get a default route set? 




Discussion:
To generate the `CONFIGPROXY_AUTH_TOKEN` take a look at the [security section](http://jupyterhub.readthedocs.io/en/latest/getting-started/security-basics.html#proxy-authentication-token) of the documentation.

I don't think the default route message is anything to worry about. When the proxy starts up there are no routes set and it automatically configures itself.
I have looked into the security part and the first part of the docs : c.JupyterHub.proxy_auth_token is deprecated.  the second option export CONFIGPROXY_AUTH_TOKEN='openssl rand -hex 32' . but im not sure where to put this?  if I put it into the .config as is, it throws all sorts of errors.   

Resolving patch:
diff --git a/jupyterhub/proxy.py b/jupyterhub/proxy.py
--- a/jupyterhub/proxy.py
+++ b/jupyterhub/proxy.py
@@ -365,7 +365,7 @@ class ConfigurableHTTPProxy(Proxy):
     If the proxy should not be run as a subprocess of the Hub,
     (e.g. in a separate container),
     set::
-    
+
         c.ConfigurableHTTPProxy.should_start = False
     """
 
@@ -383,14 +383,10 @@ class ConfigurableHTTPProxy(Proxy):
 
     @default('auth_token')
     def _auth_token_default(self):
-        token = os.environ.get('CONFIGPROXY_AUTH_TOKEN', None)
-        if not token:
-            self.log.warning('\n'.join([
-                "",
-                "Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require restarting the proxy.",
-                "Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message.",
-                "",
-            ]))
+        token = os.environ.get('CONFIGPROXY_AUTH_TOKEN', '')
+        if self.should_start and not token:
+            # generating tokens is fine if the Hub is starting the proxy
+            self.log.info("Generating new CONFIGPROXY_AUTH_TOKEN")
             token = utils.new_token()
         return token
 
@@ -403,6 +399,17 @@ def _auth_token_default(self):
 
     _check_running_callback = Any(help="PeriodicCallback to check if the proxy is running")
 
+    def __init__(self, **kwargs):
+        super().__init__(**kwargs)
+        # check for required token if proxy is external
+        if not self.auth_token and not self.should_start:
+            raise ValueError(
+                "%s.auth_token or CONFIGPROXY_AUTH_TOKEN env is required"
+                " if Proxy.should_start is False" % self.__class__.__name__
+            )
+
+
+
     async def start(self):
         public_server = Server.from_url(self.public_url)
         api_server = Server.from_url(self.api_url)


Test patch:
diff --git a/jupyterhub/tests/test_app.py b/jupyterhub/tests/test_app.py
--- a/jupyterhub/tests/test_app.py
+++ b/jupyterhub/tests/test_app.py
@@ -176,6 +176,7 @@ def test_resume_spawners(tmpdir, request):
     def new_hub():
         app = MockHub()
         app.config.ConfigurableHTTPProxy.should_start = False
+        app.config.ConfigurableHTTPProxy.auth_token = 'unused'
         yield app.initialize([])
         return app
     app = yield new_hub()