MCPcopy Index your code
hub / github.com/zenstackhq/zenstack / evaluateUrl

Function evaluateUrl

packages/cli/src/actions/proxy.ts:168–183  ·  view source on GitHub ↗
(schemaUrl: ConfigExpr)

Source from the content-addressed store, hash-verified

166}
167
168function 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
185function redactDatabaseUrl(url: string): string {
186 try {

Callers 1

runFunction · 0.85

Calls 3

isLiteralExprFunction · 0.90
getStringLiteralFunction · 0.90
isInvocationExprFunction · 0.90

Tested by

no test coverage detected