mirror of
https://github.com/docmost/docmost.git
synced 2025-11-16 08:31:14 +10:00
add env variable (#513)
This commit is contained in:
@ -3,7 +3,7 @@ import { ActionIcon, Card, Image, Modal, Text, useComputedColorScheme } from '@m
|
||||
import { useRef, useState } from 'react';
|
||||
import { uploadFile } from '@/features/page/services/page-service.ts';
|
||||
import { useDisclosure } from '@mantine/hooks';
|
||||
import { getFileUrl } from '@/lib/config.ts';
|
||||
import { getDrawioUrl, getFileUrl } from '@/lib/config.ts';
|
||||
import {
|
||||
DrawIoEmbed,
|
||||
DrawIoEmbedRef,
|
||||
@ -87,6 +87,7 @@ export default function DrawioView(props: NodeViewProps) {
|
||||
<DrawIoEmbed
|
||||
ref={drawioRef}
|
||||
xml={initialXML}
|
||||
baseUrl={getDrawioUrl()}
|
||||
urlParameters={{
|
||||
ui: computedColorScheme === 'light' ? 'kennedy' : 'dark',
|
||||
spin: true,
|
||||
|
||||
@ -57,6 +57,14 @@ export function getFileUrl(src: string) {
|
||||
}
|
||||
|
||||
export function getFileUploadSizeLimit() {
|
||||
const limit = window.CONFIG?.FILE_UPLOAD_SIZE_LIMIT || process?.env.FILE_UPLOAD_SIZE_LIMIT || '50mb';
|
||||
const limit =getConfigValue("FILE_UPLOAD_SIZE_LIMIT", "50mb");
|
||||
return bytes(limit);
|
||||
}
|
||||
|
||||
export function getDrawioUrl() {
|
||||
return getConfigValue("DRAWIO_URL", "https://embed.diagrams.net");
|
||||
}
|
||||
|
||||
function getConfigValue(key: string, defaultValue: string = undefined) {
|
||||
return window.CONFIG?.[key] || process?.env?.[key] || defaultValue;
|
||||
}
|
||||
@ -74,4 +74,4 @@ export function decodeBase64ToSvgString(base64Data: string): string {
|
||||
|
||||
export function capitalizeFirstChar(string: string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user