Skip to content

Commit a2e5e9f

Browse files
committed
chore: check .env eixsts
1 parent 1fa7f99 commit a2e5e9f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/cubejs-server-core/src/core/DevServer.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,12 @@ export class DevServer {
503503
if (!variables.CUBEJS_API_SECRET) {
504504
variables.CUBEJS_API_SECRET = options.apiSecret;
505505
}
506-
507-
const envs = dotenv.parse(fs.readFileSync(path.join(process.cwd(), '.env')));
506+
507+
let envs: Record<string, string> = {};
508+
const envPath = path.join(process.cwd(), '.env');
509+
if (fs.existsSync(envPath)) {
510+
envs = dotenv.parse(fs.readFileSync(envPath));
511+
}
508512

509513
const schemaPath = envs.CUBEJS_SCHEMA_PATH || 'model';
510514

0 commit comments

Comments
 (0)