From c2cf271ef27269131408acb10c7cc1ecaefb0573 Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Mon, 12 Feb 2024 14:28:14 +0100 Subject: [PATCH] Config property for passing environment variables (see #395) Rather than needing to update omero-py each time a new env variable needs passing to a script, this adds the ``` omero.processor.env_vars ``` property which can be updated. Likely needs more discussion since possibly this should be an "additional" list. --- src/omero/processor.py | 48 +++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/src/omero/processor.py b/src/omero/processor.py index 978dc80e1..3c534efdb 100755 --- a/src/omero/processor.py +++ b/src/omero/processor.py @@ -147,23 +147,37 @@ def __init__(self, ctx, interpreter, properties, params, iskill=False, # def make_env(self): - self.env = omero.util.Environment( - "CLASSPATH", - "DISPLAY", - "DYLD_LIBRARY_PATH", - "HOME", - "JYTHON_HOME", - "LC_ALL", - "LANG", - "LANGUAGE", - "LD_LIBRARY_PATH", - "MLABRAW_CMD_STR", - "OMERODIR", - "OMERO_TEMPDIR", - "OMERO_TMPDIR", - "PATH", - "PYTHONPATH", - ) + variables = self.ctx.get("omero.process.env_vars", None) + if variables is None: + variables = ( + # For backwards compatibility + "CLASSPATH", + "DISPLAY", + "DYLD_LIBRARY_PATH", + "HOME", + "JYTHON_HOME", + "LC_ALL", + "LANG", + "LANGUAGE", + "LD_LIBRARY_PATH", + "MLABRAW_CMD_STR", + "OMERODIR", + "OMERO_TEMPDIR", + "OMERO_TMPDIR", + "PATH", + "PYTHONPATH", + # issue:395 + "http_proxy", + "HTTP_PROXY", + "https_proxy", + "HTTPS_PROXY", + "no_proxy", + "NO_PROXY", + ) + else: + variables = variables.split(",") + + self.env = omero.util.Environment(*variables) # Since we know the location of our OMERO, we're going to # force the value for OMERO_HOME. This is useful in scripts