mirror of
https://github.com/docmost/docmost.git
synced 2025-11-12 17:42:36 +10:00
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:
@ -19,15 +19,13 @@ export function getBackendUrl(): string {
|
||||
}
|
||||
|
||||
export function getCollaborationUrl(): string {
|
||||
const COLLAB_PATH = "/collab";
|
||||
const baseUrl =
|
||||
getConfigValue("COLLAB_URL") ||
|
||||
(import.meta.env.DEV ? process.env.APP_URL : getAppUrl());
|
||||
|
||||
let url = getAppUrl();
|
||||
if (import.meta.env.DEV) {
|
||||
url = process.env.APP_URL;
|
||||
}
|
||||
|
||||
const wsProtocol = url.startsWith("https") ? "wss" : "ws";
|
||||
return `${wsProtocol}://${url.split("://")[1]}${COLLAB_PATH}`;
|
||||
const collabUrl = new URL("/collab", baseUrl);
|
||||
collabUrl.protocol = collabUrl.protocol === "https:" ? "wss:" : "ws:";
|
||||
return collabUrl.toString();
|
||||
}
|
||||
|
||||
export function getAvatarUrl(avatarUrl: string) {
|
||||
|
||||
@ -5,16 +5,21 @@ import * as path from "path";
|
||||
export const envPath = path.resolve(process.cwd(), "..", "..");
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const { APP_URL, FILE_UPLOAD_SIZE_LIMIT, DRAWIO_URL } = loadEnv(mode, envPath, "");
|
||||
const { APP_URL, FILE_UPLOAD_SIZE_LIMIT, DRAWIO_URL, COLLAB_URL } = loadEnv(
|
||||
mode,
|
||||
envPath,
|
||||
"",
|
||||
);
|
||||
|
||||
return {
|
||||
define: {
|
||||
"process.env": {
|
||||
APP_URL,
|
||||
FILE_UPLOAD_SIZE_LIMIT,
|
||||
DRAWIO_URL
|
||||
DRAWIO_URL,
|
||||
COLLAB_URL,
|
||||
},
|
||||
'APP_VERSION': JSON.stringify(process.env.npm_package_version),
|
||||
APP_VERSION: JSON.stringify(process.env.npm_package_version),
|
||||
},
|
||||
plugins: [react()],
|
||||
resolve: {
|
||||
|
||||
Reference in New Issue
Block a user