Read all key=value pairs from the .env file into a dict.
(self)
| 36 | # ------------------------------------------------------------------ |
| 37 | |
| 38 | def _read_env_dict(self): |
| 39 | """Read all key=value pairs from the .env file into a dict.""" |
| 40 | env = {} |
| 41 | if os.path.exists(self.env_file_path): |
| 42 | with open(self.env_file_path, 'r') as f: |
| 43 | for line in f: |
| 44 | line = line.strip() |
| 45 | if line and not line.startswith('#') and '=' in line: |
| 46 | key, value = line.split('=', 1) |
| 47 | env[key] = value |
| 48 | return env |
| 49 | |
| 50 | def _write_env_dict(self, env): |
| 51 | """Persist a full dict back to the .env file.""" |
no outgoing calls
no test coverage detected