Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-7960 - Move config api to tldraw server #5293

Merged
merged 20 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ data:
SC_THEME: "{{ SC_THEME }}"
SC_SHORTNAME: "{{ SC_SHORTNAME }}"
SC_DOMAIN: "{{ DOMAIN }}"
TLDRAW__WEBSOCKET_URL: "wss://{{ DOMAIN }}/tldraw-server"
SHLVL: "1"
# Prints slow requests above 4 s in log
# LEAD_TIME: "4000"
Expand Down
8 changes: 6 additions & 2 deletions apps/server/src/modules/server/api/dto/config.response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ export class ConfigResponse {
@ApiProperty()
FEATURE_TLDRAW_ENABLED: boolean;

@ApiProperty()
TLDRAW__WEBSOCKET_URL: string;

@ApiProperty()
TLDRAW__ASSETS_ENABLED: boolean;

@ApiProperty()
TLDRAW__ASSETS_MAX_SIZE: number;
TLDRAW__ASSETS_MAX_SIZE_BYTES: number;

@ApiProperty()
TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST: string[];
Expand Down Expand Up @@ -292,7 +295,8 @@ export class ConfigResponse {
this.MIGRATION_WIZARD_DOCUMENTATION_LINK = config.MIGRATION_WIZARD_DOCUMENTATION_LINK;
this.FEATURE_TLDRAW_ENABLED = config.FEATURE_TLDRAW_ENABLED;
this.TLDRAW__ASSETS_ENABLED = config.TLDRAW__ASSETS_ENABLED;
this.TLDRAW__ASSETS_MAX_SIZE = config.TLDRAW__ASSETS_MAX_SIZE;
this.TLDRAW__WEBSOCKET_URL = config.TLDRAW__WEBSOCKET_URL;
this.TLDRAW__ASSETS_MAX_SIZE_BYTES = config.TLDRAW__ASSETS_MAX_SIZE_BYTES;
this.TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST = config.TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST;
this.FEATURE_VIDEOCONFERENCE_ENABLED = config.FEATURE_VIDEOCONFERENCE_ENABLED;
this.FEATURE_SCHULCONNEX_COURSE_SYNC_ENABLED = config.FEATURE_SCHULCONNEX_COURSE_SYNC_ENABLED;
Expand Down
3 changes: 2 additions & 1 deletion apps/server/src/modules/server/api/test/server.api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ describe('Server Controller (API)', () => {
'TEACHER_STUDENT_VISIBILITY__IS_ENABLED_BY_DEFAULT',
'TEACHER_STUDENT_VISIBILITY__IS_VISIBLE',
'TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST',
'TLDRAW__WEBSOCKET_URL',
'TLDRAW__ASSETS_ENABLED',
'TLDRAW__ASSETS_MAX_SIZE',
'TLDRAW__ASSETS_MAX_SIZE_BYTES',
'FEATURE_SCHULCONNEX_COURSE_SYNC_ENABLED',
'FEATURE_MEDIA_SHELF_ENABLED',
'BOARD_COLLABORATION_URI',
Expand Down
6 changes: 4 additions & 2 deletions apps/server/src/modules/server/server.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ export interface ServerConfig
MIGRATION_WIZARD_DOCUMENTATION_LINK?: string;
FEATURE_OTHER_GROUPUSERS_PROVISIONING_ENABLED: boolean;
FEATURE_TLDRAW_ENABLED: boolean;
TLDRAW__WEBSOCKET_URL: string;
TLDRAW__ASSETS_ENABLED: boolean;
TLDRAW__ASSETS_MAX_SIZE: number;
TLDRAW__ASSETS_MAX_SIZE_BYTES: number;
TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST: string[];
I18N__AVAILABLE_LANGUAGES: LanguageType[];
I18N__DEFAULT_LANGUAGE: LanguageType;
Expand Down Expand Up @@ -227,8 +228,9 @@ const config: ServerConfig = {
BLOCKLIST_OF_EMAIL_DOMAINS: (Configuration.get('BLOCKLIST_OF_EMAIL_DOMAINS') as string)
.split(',')
.map((domain) => domain.trim()),
TLDRAW__WEBSOCKET_URL: Configuration.get('TLDRAW__WEBSOCKET_URL') as string,
TLDRAW__ASSETS_ENABLED: Configuration.get('TLDRAW__ASSETS_ENABLED') as boolean,
TLDRAW__ASSETS_MAX_SIZE: Configuration.get('TLDRAW__ASSETS_MAX_SIZE') as number,
TLDRAW__ASSETS_MAX_SIZE_BYTES: Configuration.get('TLDRAW__ASSETS_MAX_SIZE_BYTES') as number,
TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST: (Configuration.get('TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST') as string).split(
','
),
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/modules/tldraw/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface TldrawConfig {
REDIS_URI: string;
TLDRAW_ASSETS_ENABLED: boolean;
TLDRAW_ASSETS_SYNC_ENABLED: boolean;
TLDRAW_ASSETS_MAX_SIZE: number;
TLDRAW_ASSETS_MAX_SIZE_BYTES: number;
ASSETS_ALLOWED_MIME_TYPES_LIST: string;
API_HOST: number;
TLDRAW_MAX_DOCUMENT_SIZE: number;
Expand Down Expand Up @@ -50,7 +50,7 @@ const tldrawConfig = {
REDIS_URI: Configuration.has('REDIS_URI') ? (Configuration.get('REDIS_URI') as string) : null,
TLDRAW_ASSETS_ENABLED: Configuration.get('TLDRAW__ASSETS_ENABLED') as boolean,
TLDRAW_ASSETS_SYNC_ENABLED: Configuration.get('TLDRAW__ASSETS_SYNC_ENABLED') as boolean,
TLDRAW_ASSETS_MAX_SIZE: Configuration.get('TLDRAW__ASSETS_MAX_SIZE') as number,
TLDRAW_ASSETS_MAX_SIZE_BYTES: Configuration.get('TLDRAW__ASSETS_MAX_SIZE_BYTES') as number,
ASSETS_ALLOWED_MIME_TYPES_LIST: Configuration.get('TLDRAW__ASSETS_ALLOWED_MIME_TYPES_LIST') as string,
API_HOST: Configuration.get('API_HOST') as string,
TLDRAW_MAX_DOCUMENT_SIZE: Configuration.get('TLDRAW__MAX_DOCUMENT_SIZE') as number,
Expand Down
12 changes: 9 additions & 3 deletions config/default.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1522,6 +1522,7 @@
"type": "object",
"description": "Configuration of tldraw related settings",
"required": [
"WEBSOCKET_URL",
"PING_TIMEOUT",
"FINALIZE_DELAY",
"SOCKET_PORT",
Expand All @@ -1530,10 +1531,14 @@
"MAX_DOCUMENT_SIZE",
"ASSETS_ENABLED",
"ASSETS_SYNC_ENABLED",
"ASSETS_MAX_SIZE",
"ASSETS_MAX_SIZE_BYTES",
"ASSETS_ALLOWED_MIME_TYPES_LIST"
],
"properties": {
"WEBSOCKET_URL": {
"type": "string",
"description": "Web socket url for tldraw"
},
"SOCKET_PORT": {
"type": "number",
"description": "Web socket port for tldraw"
Expand Down Expand Up @@ -1566,7 +1571,7 @@
"type": "boolean",
"description": "Enables synchronization of tldraw board assets with file storage"
},
"ASSETS_MAX_SIZE": {
"ASSETS_MAX_SIZE_BYTES": {
"type": "integer",
"description": "Maximum asset size in bytes"
},
Expand All @@ -1588,6 +1593,7 @@
}
},
"default": {
"WEBSOCKET_URL": "ws://localhost:3345",
bergatco marked this conversation as resolved.
Show resolved Hide resolved
"SOCKET_PORT": 3345,
"PING_TIMEOUT": 30000,
"FINALIZE_DELAY": 5000,
Expand All @@ -1596,7 +1602,7 @@
"MAX_DOCUMENT_SIZE": 15000000,
"ASSETS_ENABLED": true,
"ASSETS_SYNC_ENABLED": false,
"ASSETS_MAX_SIZE": 10485760,
"ASSETS_MAX_SIZE_BYTES": 10485760,
"ASSETS_ALLOWED_MIME_TYPES_LIST": "image/png,image/jpeg,image/gif,image/svg+xml"
}
},
Expand Down
3 changes: 2 additions & 1 deletion config/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"VIDEOCONFERENCE_HOST": "https://bigbluebutton.schul-cloud.org/bigbluebutton",
"VIDEOCONFERENCE_SALT": "ThisIsNOTaRealSaltThisIsNOTaRealSaltThisIsNOTaRealSalt1234567890",
"TLDRAW": {
"WEBSOCKET_URL": "ws://localhost:3345",
bergatco marked this conversation as resolved.
Show resolved Hide resolved
"SOCKET_PORT": 3346,
"PING_TIMEOUT": 1,
"FINALIZE_DELAY": 1,
Expand All @@ -77,7 +78,7 @@
"MAX_DOCUMENT_SIZE": 15000000,
"ASSETS_ENABLED": true,
"ASSETS_SYNC_ENABLED": true,
"ASSETS_MAX_SIZE": 25000000,
"ASSETS_MAX_SIZE_BYTES": 25000000,
"ASSETS_ALLOWED_MIME_TYPES_LIST": ""
},
"SCHULCONNEX_CLIENT": {
Expand Down
Loading