pass environment variables to Notebooks from ADS (#6389)

* get the new environment variables for notebook

* comments

* Update serverInstance.ts

address comments

* be more specific when taking env variables
This commit is contained in:
Alan Ren
2019-07-18 10:40:07 -07:00
committed by GitHub
parent d74c2d6c8d
commit 0c5d5f1dd5

View File

@@ -377,8 +377,13 @@ export class PerNotebookServerInstance implements IServerInstance {
return childProcess;
}
private getEnvWithConfigPaths(env: {}): any {
private getEnvWithConfigPaths(env: { [key: string]: string }): any {
// Take the variables that starts with 'AZDATA_NB_VAR_' from process.env object so that we can pass information to notebooks
let newEnv: { [key: string]: string } = Object.assign({}, env);
Object.keys(process.env).filter(key => key.startsWith('AZDATA_NB_VAR_')).forEach(key => {
newEnv[key] = process.env[key];
});
newEnv['JUPYTER_CONFIG_DIR'] = this.instanceConfigRoot;
newEnv['JUPYTER_PATH'] = this.instanceDataRoot;
return newEnv;