1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-07-19 21:29:41 +02:00

S3 uploads support (#273)

* finish s3 uploads implementation

* remove unnecessary file

* fix docs

* update DEVELOPMENT.md

* update doc

* update default uploads path
This commit is contained in:
Nikita Melnikov 2022-10-08 14:26:11 +04:00 committed by GitHub
parent 55b4b3ee61
commit 8c794304b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 1373 additions and 248 deletions

View file

@ -12,6 +12,34 @@ const HawkConfig = z.object({
frontendToken: z.string().optional(), // Hawk frontend token
});
/**
* Config for local uploads driver
*/
const LocalUploadsConfig = z.object({
driver: z.literal('local'),
local: z.object({
path: z.string(), // path to the database directory
}),
});
/**
* Config for S3 uploads driver
*/
const S3UploadsConfig = z.object({
driver: z.literal('s3'),
s3: z.object({
bucket: z.string(),
region: z.string(),
baseUrl: z.string(),
keyPrefix: z.string(),
accessKeyId: z.string(),
secretAccessKey: z.string(),
}),
});
export type LocalUploadsConfig = z.infer<typeof LocalUploadsConfig>;
export type S3UploadsConfig = z.infer<typeof S3UploadsConfig>;
/**
* Config for local database driver
*/
@ -63,7 +91,7 @@ const AppConfig = z.object({
port: z.number(), // Port to listen on
host: z.string(), // Host to listen on
favicon: z.string().optional(), // Path or URL to favicon
uploads: z.string(), // Path to uploads folder
uploads: z.union([LocalUploadsConfig, S3UploadsConfig]), // Uploads configuration
hawk: HawkConfig.optional().nullable(), // Hawk configuration
password: z.string(), // Password for admin panel
frontend: FrontendConfig, // Frontend configuration