Skip to content

Commit

Permalink
Config for blob upload limit (#2213)
Browse files Browse the repository at this point in the history
config var for blob upload limit
  • Loading branch information
dholms authored Feb 22, 2024
1 parent 87d59ff commit 6d38eea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/pds/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
privacyPolicyUrl: env.privacyPolicyUrl,
termsOfServiceUrl: env.termsOfServiceUrl,
acceptingImports: env.acceptingImports ?? true,
blobUploadLimit: env.blobUploadLimit ?? 5 * 1024 * 1024, // 5mb
}

const dbLoc = (name: string) => {
Expand Down Expand Up @@ -275,9 +276,10 @@ export type ServiceConfig = {
publicUrl: string
did: string
version?: string
acceptingImports: boolean
privacyPolicyUrl?: string
termsOfServiceUrl?: string
acceptingImports: boolean
blobUploadLimit: number
}

export type DatabaseConfig = {
Expand Down
2 changes: 2 additions & 0 deletions packages/pds/src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const readEnv = (): ServerEnvironment => {
privacyPolicyUrl: envStr('PDS_PRIVACY_POLICY_URL'),
termsOfServiceUrl: envStr('PDS_TERMS_OF_SERVICE_URL'),
acceptingImports: envBool('PDS_ACCEPTING_REPO_IMPORTS'),
blobUploadLimit: envInt('PDS_BLOB_UPLOAD_LIMIT'),

// database
dataDirectory: envStr('PDS_DATA_DIRECTORY'),
Expand Down Expand Up @@ -116,6 +117,7 @@ export type ServerEnvironment = {
privacyPolicyUrl?: string
termsOfServiceUrl?: string
acceptingImports?: boolean
blobUploadLimit?: number

// database
dataDirectory?: string
Expand Down
2 changes: 1 addition & 1 deletion packages/pds/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class PDS {
payload: {
jsonLimit: 100 * 1024, // 100kb
textLimit: 100 * 1024, // 100kb
blobLimit: 5 * 1024 * 1024, // 5mb
blobLimit: cfg.service.blobUploadLimit,
},
}
if (cfg.rateLimits.enabled) {
Expand Down

0 comments on commit 6d38eea

Please sign in to comment.