Read .env and merge it with explicitly passed parameters.
(self, dotenv_path, params)
| 78 | self._read_config(config_path, compose_bin) |
| 79 | |
| 80 | def _read_env(self, dotenv_path, params): |
| 81 | """ |
| 82 | Read .env and merge it with explicitly passed parameters. |
| 83 | """ |
| 84 | self.dotenv = dotenv_values(str(dotenv_path)) |
| 85 | if params is None: |
| 86 | self.params = {} |
| 87 | else: |
| 88 | self.params = {k: v for k, v in params.items() if k in self.dotenv} |
| 89 | |
| 90 | # forward the process' environment variables |
| 91 | self.env = os.environ.copy() |
| 92 | # set the defaults from the dotenv files |
| 93 | self.env.update(self.dotenv) |
| 94 | # override the defaults passed as parameters |
| 95 | self.env.update(self.params) |
| 96 | |
| 97 | # translate docker's architecture notation to a more widely used one |
| 98 | arch = self.env.get('ARCH', 'amd64') |
| 99 | self.env['ARCH_ALIAS'] = _arch_alias_mapping.get(arch, arch) |
| 100 | self.env['ARCH_SHORT'] = _arch_short_mapping.get(arch, arch) |
| 101 | |
| 102 | def _read_config(self, config_path, compose_bin): |
| 103 | """ |