(schemaUrl: ConfigExpr)
| 166 | } |
| 167 | |
| 168 | function evaluateUrl(schemaUrl: ConfigExpr) { |
| 169 | if (isLiteralExpr(schemaUrl)) { |
| 170 | // Handle string literal |
| 171 | return getStringLiteral(schemaUrl); |
| 172 | } else if (isInvocationExpr(schemaUrl)) { |
| 173 | const envFunction = schemaUrl as InvocationExpr; |
| 174 | const envName = getStringLiteral(envFunction.args[0]?.value as LiteralExpr)!; |
| 175 | const envValue = process.env[envName]; |
| 176 | if (!envValue) { |
| 177 | throw new CliError(`Environment variable ${envName} is not set`); |
| 178 | } |
| 179 | return envValue; |
| 180 | } else { |
| 181 | throw new CliError(`Unable to resolve the "url" field value.`); |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | function redactDatabaseUrl(url: string): string { |
| 186 | try { |
no test coverage detected