Set a new environment variable in the container. Parameters ---------- name: Name of the environment variable (e.g., "HOST"). value: Value of the environment variable. (e.g., "localhost"). expand: Replace "${VAR}" or "$VAR"
(
self,
name: str,
value: str,
*,
expand: bool | None = False,
)
| 3005 | return Container(_ctx) |
| 3006 | |
| 3007 | def with_env_variable( |
| 3008 | self, |
| 3009 | name: str, |
| 3010 | value: str, |
| 3011 | *, |
| 3012 | expand: bool | None = False, |
| 3013 | ) -> Self: |
| 3014 | """Set a new environment variable in the container. |
| 3015 | |
| 3016 | Parameters |
| 3017 | ---------- |
| 3018 | name: |
| 3019 | Name of the environment variable (e.g., "HOST"). |
| 3020 | value: |
| 3021 | Value of the environment variable. (e.g., "localhost"). |
| 3022 | expand: |
| 3023 | Replace "${VAR}" or "$VAR" in the value according to the current |
| 3024 | environment variables defined in the container (e.g. |
| 3025 | "/opt/bin:$PATH"). |
| 3026 | """ |
| 3027 | _args = [ |
| 3028 | Arg("name", name), |
| 3029 | Arg("value", value), |
| 3030 | Arg("expand", expand, False), |
| 3031 | ] |
| 3032 | _ctx = self._select("withEnvVariable", _args) |
| 3033 | return Container(_ctx) |
| 3034 | |
| 3035 | def with_error(self, err: str) -> Self: |
| 3036 | """Raise an error. |
no test coverage detected