feat: standalone collab server (#767)

* feat: standalone collab server

* * custom collab server port env
* fix collab start script command

* * API prefix
* Log startup PORT

* Tweak collab debounce
This commit is contained in:
Philip Okugbe
2025-02-25 13:15:51 +00:00
committed by GitHub
parent 08829ea721
commit 4b9ab4f63c
10 changed files with 119 additions and 22 deletions

View File

@ -145,4 +145,15 @@ export class EnvironmentService {
isSelfHosted(): boolean {
return !this.isCloud();
}
getCollabUrl(): string {
return this.configService.get<string>('COLLAB_URL');
}
isCollabDisableRedis(): boolean {
const isStandalone = this.configService
.get<string>('COLLAB_DISABLE_REDIS', 'false')
.toLowerCase();
return isStandalone === 'true';
}
}

View File

@ -5,6 +5,7 @@ import {
IsOptional,
IsUrl,
MinLength,
ValidateIf,
validateSync,
} from 'class-validator';
import { plainToInstance } from 'class-transformer';
@ -48,6 +49,11 @@ export class EnvironmentVariables {
@IsOptional()
@IsIn(['local', 's3'])
STORAGE_DRIVER: string;
@IsOptional()
@ValidateIf((obj) => obj.COLLAB_URL != '' && obj.COLLAB_URL != null)
@IsUrl({ protocols: ['http', 'https'], require_tld: false })
COLLAB_URL: string;
}
export function validate(config: Record<string, any>) {

View File

@ -38,6 +38,7 @@ export class StaticModule implements OnModuleInit {
FILE_UPLOAD_SIZE_LIMIT:
this.environmentService.getFileUploadSizeLimit(),
DRAWIO_URL: this.environmentService.getDrawioUrl(),
COLLAB_URL: this.environmentService.getCollabUrl(),
};
const windowScriptContent = `<script>window.CONFIG=${JSON.stringify(configString)};</script>`;