From 7073f29441967ce8b99183bbc9233c9fa662a8ed Mon Sep 17 00:00:00 2001 From: Kevin Mader Date: Mon, 13 Aug 2018 22:02:39 +0200 Subject: [PATCH 1/3] Update server_extension.py adding header code --- appmode/server_extension.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appmode/server_extension.py b/appmode/server_extension.py index a4ff236..8319748 100644 --- a/appmode/server_extension.py +++ b/appmode/server_extension.py @@ -6,6 +6,7 @@ from notebook.base.handlers import IPythonHandler, FilesRedirectHandler, path_regex import notebook.notebook.handlers as orig_handler from tornado import web +import json class AppmodeHandler(IPythonHandler): #=========================================================================== @@ -17,6 +18,7 @@ def get(self, path): user_name = path_split.pop(1) # global environment variables are lazy but easiest way to pass username os.environ['APPMODE_USER']=user_name + os.environ['APPMODE_HEADER'] = json.dumps(self.settings.get('headers', {})) path = '/'.join(path_split) path = path.strip('/') self.log.info('Appmode get: %s', path) From cdb5e7dfe468a883f4c884c7a4866ca20ef2fe35 Mon Sep 17 00:00:00 2001 From: Kevin Mader Date: Mon, 13 Aug 2018 23:14:46 +0200 Subject: [PATCH 2/3] Update server_extension.py changing header to settings --- appmode/server_extension.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appmode/server_extension.py b/appmode/server_extension.py index 8319748..4c90508 100644 --- a/appmode/server_extension.py +++ b/appmode/server_extension.py @@ -18,7 +18,7 @@ def get(self, path): user_name = path_split.pop(1) # global environment variables are lazy but easiest way to pass username os.environ['APPMODE_USER']=user_name - os.environ['APPMODE_HEADER'] = json.dumps(self.settings.get('headers', {})) + os.environ['APPMODE_SETTINGS'] = json.dumps(self.settings) path = '/'.join(path_split) path = path.strip('/') self.log.info('Appmode get: %s', path) From cdfc7b29822879463f724c0e0f4e67b5c03aa7ed Mon Sep 17 00:00:00 2001 From: Kevin Mader Date: Mon, 13 Aug 2018 23:15:46 +0200 Subject: [PATCH 3/3] Update example_app.ipynb added line for settings output --- example_app.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example_app.ipynb b/example_app.ipynb index 2c1686f..d7e4ba1 100644 --- a/example_app.ipynb +++ b/example_app.ipynb @@ -7,7 +7,8 @@ "outputs": [], "source": [ "import os\n", - "USERNAME=os.environ.get('APPMODE_USER', 'Not logged in')" + "USERNAME=os.environ.get('APPMODE_USER', 'Not logged in')\n", + "print(os.environ.get('APPMODE_SETTINGS', ''), 'settings loaded')" ] }, {