| 17 | } |
| 18 | |
| 19 | function encodeDotenvValue(str) { |
| 20 | if (typeof str !== "string") { |
| 21 | throw new Error(`'${str}' is not a string`); |
| 22 | } |
| 23 | if (str.trim() !== str) { |
| 24 | // `dotenv` would escape this with single/double quotes but that won't work in docker-compose |
| 25 | throw new Error( |
| 26 | "We don't support leading/trailing whitespace in config variables" |
| 27 | ); |
| 28 | } |
| 29 | if (str.indexOf("\n") >= 0) { |
| 30 | // `dotenv` would escape this with single/double quotes and `\n` but that won't work in docker-compose |
| 31 | throw new Error("We don't support newlines in config variables"); |
| 32 | } |
| 33 | return str; |
| 34 | } |
| 35 | |
| 36 | async function withDotenvUpdater(overrides, callback) { |
| 37 | let data; |