Skip to content

Commit

Permalink
Config property for passing environment variables (see #395)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joshmoore committed Feb 12, 2024
1 parent 1ca2f87 commit c2cf271
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions src/omero/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c2cf271

Please sign in to comment.