feat: add user level blob quota (#4114)

This commit is contained in:
DarkSky
2023-09-01 20:56:27 +08:00
committed by GitHub
parent e76cdf4d71
commit 7d3b1ad2b9
8 changed files with 99 additions and 20 deletions

View File

@@ -186,6 +186,11 @@ export interface AFFiNEConfig {
fs: {
path: string;
};
/**
* Free user storage quota
* @default 10 * 1024 * 1024 (10GB)
*/
quota: number;
};
/**

View File

@@ -55,6 +55,7 @@ export const getDefaultAFFiNEConfig: () => AFFiNEConfig = () => {
AFFINE_SERVER_HOST: 'host',
AFFINE_SERVER_SUB_PATH: 'path',
AFFINE_ENV: 'affineEnv',
AFFINE_FREE_USER_QUOTA: 'objectStorage.quota',
DATABASE_URL: 'db.url',
ENABLE_R2_OBJECT_STORAGE: ['objectStorage.r2.enabled', 'boolean'],
R2_OBJECT_STORAGE_ACCOUNT_ID: 'objectStorage.r2.accountId',
@@ -170,6 +171,7 @@ export const getDefaultAFFiNEConfig: () => AFFiNEConfig = () => {
fs: {
path: join(homedir(), '.affine-storage'),
},
quota: 10 * 1024 * 1024,
},
rateLimiter: {
ttl: 60,