Skip to content

Enable arbitrary env vars to be propagated to Complement containers#382

Merged
kegsay merged 1 commit into
mainfrom
kegan/env-var-prop
May 27, 2022
Merged

Enable arbitrary env vars to be propagated to Complement containers#382
kegsay merged 1 commit into
mainfrom
kegan/env-var-prop

Conversation

@kegsay
Copy link
Copy Markdown
Member

@kegsay kegsay commented May 27, 2022

Fixes #6

This PR adds a new complement env var called COMPLEMENT_SHARE_ENV_PREFIX.
This can be set to any string e.g FOO_. If it is set, Complement will
look at the host environment for any env var with this prefix. If it finds
it, it will remove the prefix and add it to the Complement container.

For example, with a host env:

COMPLEMENT_SHARE_ENV_PREFIX=FOO_
FOO_DENDRITE_TRACE_HTTP=1

This will cause DENDRITE_TRACE_HTTP=1 to be set in the Complement container.

This addresses 2 desires:

  • The ability to ad-hoc set debugging env vars when a test is failing
    e.g to use os.Setenv("FOO_DENDRITE_TRACE_HTTP", "1") in a test to get more logging.
  • The ability to pass through arbitrary data to a Synapse container, as requested
    by @reivilibre

Fixes #6

This PR adds a new complement env var called `COMPLEMENT_SHARE_ENV_PREFIX`.
This can be set to any string e.g `FOO_`. If it is set, Complement will
look at the host environment for any env var with this prefix. If it finds
it, it will remove the prefix and add it to the Complement container.

For example, with a host env:
```
COMPLEMENT_SHARE_ENV_PREFIX=FOO_
FOO_DENDRITE_TRACE_HTTP=1
```
This will cause `DENDRITE_TRACE_HTTP=1` to be set in the Complement container.

This addresses 2 desires:
 - The ability to ad-hoc set debugging env vars when a test is failing
   e.g to use `os.Setenv("DENDRITE_TRACE_HTTP", "1")` in a test to get more logging.
 - The ability to pass through arbitrary data to a Synapse container, as requested
   by @reivilibre
@kegsay kegsay added the enhancement New feature or request label May 27, 2022
@kegsay kegsay requested a review from reivilibre May 27, 2022 11:46
Copy link
Copy Markdown
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — lovely thank you :)

@kegsay kegsay merged commit 1986a59 into main May 27, 2022
@kegsay kegsay deleted the kegan/env-var-prop branch May 27, 2022 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow os.Setenv to pass through to docker containers

2 participants