martmull
2026-03-30 17:03:23 +02:00
committed by GitHub
parent 40abe1e6d0
commit 8985dfbc5d
21 changed files with 181 additions and 104 deletions
@@ -1,5 +1,7 @@
import { type ApiService } from '@/cli/utilities/api/api-service';
import { ConfigService } from '@/cli/utilities/config/config-service';
import { type OrchestratorState } from '@/cli/utilities/dev/orchestrator/dev-mode-orchestrator-state';
import { detectLocalServer } from '@/cli/utilities/server/detect-local-server';
export type CheckServerOrchestratorStepOutput = {
isReady: boolean;
@@ -25,11 +27,24 @@ export class CheckServerOrchestratorStep {
this.notify = notify;
}
private hasRetried = false;
async execute(): Promise<boolean> {
const step = this.state.steps.checkServer;
const validateAuth = await this.apiService.validateAuth();
if (!validateAuth.serverUp) {
const detectedUrl = await detectLocalServer();
if (detectedUrl && !this.hasRetried) {
this.hasRetried = true;
const configService = new ConfigService();
await configService.setConfig({ apiUrl: detectedUrl });
return this.execute();
}
if (!step.output.errorLogged) {
step.output = { isReady: false, errorLogged: true };
step.status = 'error';
@@ -58,7 +73,7 @@ export class CheckServerOrchestratorStep {
this.state.applyStepEvents([
{
message:
'Authentication failed. Run `twenty remote add <url>` to authenticate.',
'Authentication failed. Run `yarn twenty remote add` to authenticate.',
status: 'error',
},
]);