63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import { z } from 'zod';
|
|
import { environmentSchema } from './base.schema';
|
|
import {
|
|
dragonflyConfigSchema,
|
|
mongodbConfigSchema,
|
|
postgresConfigSchema,
|
|
questdbConfigSchema,
|
|
} from './database.schema';
|
|
import {
|
|
browserConfigSchema,
|
|
httpConfigSchema,
|
|
loggingConfigSchema,
|
|
proxyConfigSchema,
|
|
queueConfigSchema,
|
|
serviceConfigSchema,
|
|
webshareConfigSchema,
|
|
} from './service.schema';
|
|
|
|
/**
|
|
* Generic base application schema that can be extended by specific apps
|
|
*/
|
|
export const baseAppSchema = z.object({
|
|
// Basic app info
|
|
name: z.string(),
|
|
version: z.string(),
|
|
environment: environmentSchema.default('development'),
|
|
|
|
// Service configuration
|
|
service: serviceConfigSchema,
|
|
|
|
// Logging configuration
|
|
log: loggingConfigSchema,
|
|
|
|
// Database configuration - apps can choose which databases they need
|
|
database: z
|
|
.object({
|
|
postgres: postgresConfigSchema.optional(),
|
|
mongodb: mongodbConfigSchema.optional(),
|
|
questdb: questdbConfigSchema.optional(),
|
|
dragonfly: dragonflyConfigSchema.optional(),
|
|
})
|
|
.optional(),
|
|
|
|
// Redis configuration (used for cache and queue)
|
|
redis: dragonflyConfigSchema.optional(),
|
|
|
|
// Queue configuration
|
|
queue: queueConfigSchema.optional(),
|
|
|
|
// HTTP client configuration
|
|
http: httpConfigSchema.optional(),
|
|
|
|
// WebShare proxy configuration
|
|
webshare: webshareConfigSchema.optional(),
|
|
|
|
// Browser configuration
|
|
browser: browserConfigSchema.optional(),
|
|
|
|
// Proxy manager configuration
|
|
proxy: proxyConfigSchema.optional(),
|
|
});
|
|
|
|
export type BaseAppConfig = z.infer<typeof baseAppSchema>;
|