mirror of
https://github.com/colanode/colanode.git
synced 2025-12-16 03:37:51 +01:00
Add workspace configs (#145)
This commit is contained in:
@@ -30,6 +30,13 @@ ACCOUNT_OTP_TIMEOUT=600 # seconds
|
||||
# ACCOUNT_GOOGLE_CLIENT_ID=
|
||||
# ACCOUNT_GOOGLE_CLIENT_SECRET=
|
||||
|
||||
# ───────────────────────────────────────────────────────────────
|
||||
# Workspace Configuration
|
||||
# ───────────────────────────────────────────────────────────────
|
||||
# Optional, leave empty for no limits
|
||||
# WORKSPACE_STORAGE_LIMIT=10737418240 # 10 GB
|
||||
# WORKSPACE_MAX_FILE_SIZE=104857600 # 100 MB
|
||||
|
||||
# ───────────────────────────────────────────────────────────────
|
||||
# User Configuration
|
||||
# ───────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -10,6 +10,10 @@ import { readServerConfigVariables, serverConfigSchema } from './server';
|
||||
import { readSmtpConfigVariables, smtpConfigSchema } from './smtp';
|
||||
import { readStorageConfigVariables, storageConfigSchema } from './storage';
|
||||
import { readUserConfigVariables, userConfigSchema } from './user';
|
||||
import {
|
||||
readWorkspaceConfigVariables,
|
||||
workspaceConfigSchema,
|
||||
} from './workspace';
|
||||
|
||||
const configSchema = z.object({
|
||||
server: serverConfigSchema,
|
||||
@@ -22,6 +26,7 @@ const configSchema = z.object({
|
||||
ai: aiConfigSchema,
|
||||
jobs: jobsConfigSchema,
|
||||
logging: loggingConfigSchema,
|
||||
workspace: workspaceConfigSchema,
|
||||
});
|
||||
|
||||
export type Configuration = z.infer<typeof configSchema>;
|
||||
@@ -39,6 +44,7 @@ const readConfigVariables = (): Configuration => {
|
||||
ai: readAiConfigVariables(),
|
||||
jobs: readJobsConfigVariables(),
|
||||
logging: readLoggingConfigVariables(),
|
||||
workspace: readWorkspaceConfigVariables(),
|
||||
};
|
||||
|
||||
return configSchema.parse(input);
|
||||
|
||||
15
apps/server/src/lib/config/workspace.ts
Normal file
15
apps/server/src/lib/config/workspace.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
export const workspaceConfigSchema = z.object({
|
||||
storageLimit: z.string().optional().nullable(),
|
||||
maxFileSize: z.string().optional().nullable(),
|
||||
});
|
||||
|
||||
export type WorkspaceConfig = z.infer<typeof workspaceConfigSchema>;
|
||||
|
||||
export const readWorkspaceConfigVariables = () => {
|
||||
return {
|
||||
storageLimit: process.env.WORKSPACE_STORAGE_LIMIT,
|
||||
maxFileSize: process.env.WORKSPACE_MAX_FILE_SIZE,
|
||||
};
|
||||
};
|
||||
@@ -36,6 +36,8 @@ export const createWorkspace = async (
|
||||
created_at: date,
|
||||
created_by: account.id,
|
||||
status: WorkspaceStatus.Active,
|
||||
storage_limit: config.workspace.storageLimit,
|
||||
max_file_size: config.workspace.maxFileSize,
|
||||
})
|
||||
.returningAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
@@ -120,6 +120,13 @@ services:
|
||||
# ACCOUNT_GOOGLE_CLIENT_ID: 'your_google_client_id'
|
||||
# ACCOUNT_GOOGLE_CLIENT_SECRET: 'your_google_client_secret'
|
||||
|
||||
# ───────────────────────────────────────────────────────────────
|
||||
# Workspace Configuration
|
||||
# ───────────────────────────────────────────────────────────────
|
||||
# Optional, leave empty for no limits
|
||||
# WORKSPACE_STORAGE_LIMIT: '10737418240' # 10 GB
|
||||
# WORKSPACE_MAX_FILE_SIZE: '104857600' # 100 MB
|
||||
|
||||
# ───────────────────────────────────────────────────────────────
|
||||
# User Configuration
|
||||
# ───────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user