Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions packages/cli/src/actions/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ type Options = {
};

export async function run(options: Options) {
const allowedLogLevels = ['error', 'query'] as const;
const log = options.logLevel?.filter((level): level is (typeof allowedLogLevels)[number] =>
allowedLogLevels.includes(level as any),
);
Comment thread
jiashengguo marked this conversation as resolved.
const schemaFile = getSchemaFile(options.schema);
console.log(colors.gray(`Loading ZModel schema from: ${schemaFile}`));

Expand Down Expand Up @@ -66,11 +70,6 @@ export async function run(options: Options) {

const schemaModule = (await jiti.import(path.join(outputPath, 'schema'))) as any;

const allowedLogLevels = ['error', 'query'] as const;
const log = options.logLevel?.filter((level): level is (typeof allowedLogLevels)[number] =>
allowedLogLevels.includes(level as any),
);

const db = new ZenStackClient(schemaModule.schema, {
dialect: dialect,
log: log && log.length > 0 ? log : undefined,
Expand All @@ -87,8 +86,17 @@ export async function run(options: Options) {
}

function evaluateUrl(value: string): string {
// Remove surrounding quotes if present
let trimmedValue = value.trim();
if (
(trimmedValue.startsWith('"') && trimmedValue.endsWith('"')) ||
(trimmedValue.startsWith("'") && trimmedValue.endsWith("'"))
) {
trimmedValue = trimmedValue.slice(1, -1);
Comment thread
jiashengguo marked this conversation as resolved.
Outdated
}

// Check if it's an env() function call
const envMatch = value.trim().match(/^env\s*\(\s*['"]([^'"]+)['"]\s*\)$/);
const envMatch = trimmedValue.match(/^env\s*\(\s*['"]([^'"]+)['"]\s*\)$/);
if (envMatch) {
const varName = envMatch[1];
const envValue = process.env[varName!];
Expand All @@ -97,7 +105,7 @@ function evaluateUrl(value: string): string {
}
return envValue;
} else {
return value;
return trimmedValue;
}
}
Comment thread
jiashengguo marked this conversation as resolved.

Expand Down
Loading