MCPcopy
hub / github.com/graphile/starter / encodeDotenvValue

Function encodeDotenvValue

scripts/lib/dotenv.js:19–34  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

17}
18
19function 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
36async function withDotenvUpdater(overrides, callback) {
37 let data;

Callers 1

addFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected