mirror of
https://github.com/vercel/workflow.git
synced 2026-09-14 19:59:43 +08:00
26 lines
721 B
JavaScript
26 lines
721 B
JavaScript
#!/usr/bin/env node
|
|
|
|
// Start the Postgres World before starting the Astro server
|
|
// Needed since we test this in CI
|
|
// Astro doesn't have a hook for starting the Postgres World in production
|
|
|
|
async function main() {
|
|
if (process.env.WORKFLOW_TARGET_WORLD === '@workflow/world-postgres') {
|
|
console.log('Starting Postgres World...');
|
|
const { getWorld } = await import('workflow/runtime');
|
|
const world = await getWorld();
|
|
if (world.start) {
|
|
console.log('Starting World workers...');
|
|
await world.start();
|
|
}
|
|
}
|
|
|
|
// Now start the Astro server
|
|
await import('../dist/server/entry.mjs');
|
|
}
|
|
|
|
main().catch((error) => {
|
|
console.error('Failed to start server:', error);
|
|
process.exit(1);
|
|
});
|