diff --git a/.env.default b/.env.default index 91fa736..22ad55b 100644 --- a/.env.default +++ b/.env.default @@ -14,4 +14,6 @@ S3_SSL=false FEATURE_TLDRAW_ENABLED=true TLDRAW_WEBSOCKET_URL=ws://localhost:3345 -X_API_ALLOWED_KEYS=randomString \ No newline at end of file +X_API_ALLOWED_KEYS=randomString + +NOT_AUTHENTICATED_REDIRECT_URL=http://localhost:4000/login \ No newline at end of file diff --git a/.env.test b/.env.test index f802035..56eee10 100644 --- a/.env.test +++ b/.env.test @@ -13,4 +13,6 @@ FEATURE_TLDRAW_ENABLED=true TLDRAW_WEBSOCKET_URL=ws://localhost:3399 TLDRAW_WEBSOCKET_PORT=3399 -X_API_ALLOWED_KEYS=randomString \ No newline at end of file +X_API_ALLOWED_KEYS=randomString + +NOT_AUTHENTICATED_REDIRECT_URL=http://localhost:4000/login \ No newline at end of file diff --git a/ansible/roles/tldraw-server/defaults/main.yaml b/ansible/roles/tldraw-server/defaults/main.yaml index dc3d6f5..833e8bb 100644 --- a/ansible/roles/tldraw-server/defaults/main.yaml +++ b/ansible/roles/tldraw-server/defaults/main.yaml @@ -2,4 +2,5 @@ TLDRAW_ASSETS_ALLOWED_MIME_TYPES_LIST : "image/png,image/jpeg,image/gif,image/sv TLDRAW_LOG_LEVEL: "error" TLDRAW_METRICS_COLLECT_DEFAULT: "true" TLDRAW_ASSETS_ENABLED: "true" -TLDRAW_WEBSOCKET_PATH: "/tldraw-server" \ No newline at end of file +TLDRAW_WEBSOCKET_PATH: "/tldraw-server" +NOT_AUTHENTICATED_REDIRECT_URL: "https://{{ DOMAIN }}/login" \ No newline at end of file diff --git a/ansible/roles/tldraw-server/templates/configmap.yml.j2 b/ansible/roles/tldraw-server/templates/configmap.yml.j2 index f438ae0..c858fda 100644 --- a/ansible/roles/tldraw-server/templates/configmap.yml.j2 +++ b/ansible/roles/tldraw-server/templates/configmap.yml.j2 @@ -16,3 +16,4 @@ data: FEATURE_TLDRAW_ENABLED: "{{ FEATURE_TLDRAW_ENABLED }}" TLDRAW_WEBSOCKET_PATH: "{{ TLDRAW_WEBSOCKET_PATH }}" TLDRAW_WEBSOCKET_URL: "wss://{{ DOMAIN }}{{ TLDRAW_WEBSOCKET_PATH }}" + NOT_AUTHENTICATED_REDIRECT_URL: "{{ NOT_AUTHENTICATED_REDIRECT_URL }}" diff --git a/src/modules/server/api/dto/tldraw-config.response.ts b/src/modules/server/api/dto/tldraw-config.response.ts index d1ec6dd..d639c81 100644 --- a/src/modules/server/api/dto/tldraw-config.response.ts +++ b/src/modules/server/api/dto/tldraw-config.response.ts @@ -8,6 +8,7 @@ export class TldrawPublicConfigResponse { 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_TLDRAW_ENABLED = config.FEATURE_TLDRAW_ENABLED; + this.NOT_AUTHENTICATED_REDIRECT_URL = config.NOT_AUTHENTICATED_REDIRECT_URL; } @ApiProperty() @@ -24,4 +25,7 @@ export class TldrawPublicConfigResponse { @ApiProperty() public FEATURE_TLDRAW_ENABLED!: boolean; + + @ApiProperty() + public NOT_AUTHENTICATED_REDIRECT_URL: string; } diff --git a/src/modules/server/api/test/tldraw-config.api.spec.ts b/src/modules/server/api/test/tldraw-config.api.spec.ts index 848f684..e8bfa6a 100644 --- a/src/modules/server/api/test/tldraw-config.api.spec.ts +++ b/src/modules/server/api/test/tldraw-config.api.spec.ts @@ -32,6 +32,7 @@ describe('Tldraw-Config Api Test', () => { TLDRAW_ASSETS_ENABLED: true, TLDRAW_ASSETS_MAX_SIZE_BYTES: 10485760, TLDRAW_WEBSOCKET_URL: 'ws://localhost:3399', + NOT_AUTHENTICATED_REDIRECT_URL: 'http://localhost:4000/login', }); }); }); diff --git a/src/modules/server/tldraw-server.config.ts b/src/modules/server/tldraw-server.config.ts index b21a7e0..56fc54b 100644 --- a/src/modules/server/tldraw-server.config.ts +++ b/src/modules/server/tldraw-server.config.ts @@ -27,4 +27,7 @@ export class TldrawServerConfig { @Transform(({ value }) => value === 'true') @IsBoolean() public FEATURE_TLDRAW_ENABLED!: boolean; + + @IsUrl({ protocols: ['https', 'http'], require_tld: false }) + public NOT_AUTHENTICATED_REDIRECT_URL!: string; }