refactor(backend): migrate config.ts to @bytelyst/backend-config base schema
- Extends baseBackendConfigSchema with product-specific overrides - DB_PROVIDER now declared in all repos (was missing in 3)
This commit is contained in:
parent
942d00cc25
commit
b04189df3f
16
backend/package-lock.json
generated
16
backend/package-lock.json
generated
@ -10,6 +10,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/cosmos": "^4.2.0",
|
"@azure/cosmos": "^4.2.0",
|
||||||
"@bytelyst/auth": "file:../../learning_ai_common_plat/packages/auth",
|
"@bytelyst/auth": "file:../../learning_ai_common_plat/packages/auth",
|
||||||
|
"@bytelyst/backend-config": "file:../../learning_ai_common_plat/packages/backend-config",
|
||||||
"@bytelyst/config": "file:../../learning_ai_common_plat/packages/config",
|
"@bytelyst/config": "file:../../learning_ai_common_plat/packages/config",
|
||||||
"@bytelyst/cosmos": "file:../../learning_ai_common_plat/packages/cosmos",
|
"@bytelyst/cosmos": "file:../../learning_ai_common_plat/packages/cosmos",
|
||||||
"@bytelyst/datastore": "file:../../learning_ai_common_plat/packages/datastore",
|
"@bytelyst/datastore": "file:../../learning_ai_common_plat/packages/datastore",
|
||||||
@ -40,6 +41,17 @@
|
|||||||
"jose": ">=5.0.0"
|
"jose": ">=5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"../../learning_ai_common_plat/packages/backend-config": {
|
||||||
|
"name": "@bytelyst/backend-config",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"dependencies": {
|
||||||
|
"zod": "^3.24.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.7.3",
|
||||||
|
"vitest": "^3.0.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
"../../learning_ai_common_plat/packages/config": {
|
"../../learning_ai_common_plat/packages/config": {
|
||||||
"name": "@bytelyst/config",
|
"name": "@bytelyst/config",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
@ -383,6 +395,10 @@
|
|||||||
"resolved": "../../learning_ai_common_plat/packages/auth",
|
"resolved": "../../learning_ai_common_plat/packages/auth",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@bytelyst/backend-config": {
|
||||||
|
"resolved": "../../learning_ai_common_plat/packages/backend-config",
|
||||||
|
"link": true
|
||||||
|
},
|
||||||
"node_modules/@bytelyst/config": {
|
"node_modules/@bytelyst/config": {
|
||||||
"resolved": "../../learning_ai_common_plat/packages/config",
|
"resolved": "../../learning_ai_common_plat/packages/config",
|
||||||
"link": true
|
"link": true
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
"@bytelyst/config": "file:../../learning_ai_common_plat/packages/config",
|
"@bytelyst/config": "file:../../learning_ai_common_plat/packages/config",
|
||||||
"@bytelyst/cosmos": "file:../../learning_ai_common_plat/packages/cosmos",
|
"@bytelyst/cosmos": "file:../../learning_ai_common_plat/packages/cosmos",
|
||||||
"@bytelyst/datastore": "file:../../learning_ai_common_plat/packages/datastore",
|
"@bytelyst/datastore": "file:../../learning_ai_common_plat/packages/datastore",
|
||||||
|
"@bytelyst/backend-config": "file:../../learning_ai_common_plat/packages/backend-config",
|
||||||
"@bytelyst/errors": "file:../../learning_ai_common_plat/packages/errors",
|
"@bytelyst/errors": "file:../../learning_ai_common_plat/packages/errors",
|
||||||
"@bytelyst/fastify-auth": "file:../../learning_ai_common_plat/packages/fastify-auth",
|
"@bytelyst/fastify-auth": "file:../../learning_ai_common_plat/packages/fastify-auth",
|
||||||
"@bytelyst/fastify-core": "file:../../learning_ai_common_plat/packages/fastify-core",
|
"@bytelyst/fastify-core": "file:../../learning_ai_common_plat/packages/fastify-core",
|
||||||
|
|||||||
@ -1,18 +1,11 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
import { baseBackendConfigSchema } from '@bytelyst/backend-config';
|
||||||
import { PRODUCT_ID } from './product-config.js';
|
import { PRODUCT_ID } from './product-config.js';
|
||||||
|
|
||||||
const envSchema = z.object({
|
const envSchema = baseBackendConfigSchema.extend({
|
||||||
PORT: z.coerce.number().default(4016),
|
PORT: baseBackendConfigSchema.shape.PORT.default(4016),
|
||||||
HOST: z.string().default('0.0.0.0'),
|
SERVICE_NAME: baseBackendConfigSchema.shape.SERVICE_NAME.default('notelett-backend'),
|
||||||
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
|
COSMOS_DATABASE: baseBackendConfigSchema.shape.COSMOS_DATABASE.default('bytelyst'),
|
||||||
CORS_ORIGIN: z.string().optional(),
|
|
||||||
SERVICE_NAME: z.string().default('notelett-backend'),
|
|
||||||
COSMOS_ENDPOINT: z.string().min(1, 'COSMOS_ENDPOINT is required').optional(),
|
|
||||||
COSMOS_KEY: z.string().min(1, 'COSMOS_KEY is required').optional(),
|
|
||||||
COSMOS_DATABASE: z.string().default('bytelyst'),
|
|
||||||
JWT_SECRET: z.string().min(1, 'JWT_SECRET is required'),
|
|
||||||
PLATFORM_JWKS_URL: z.string().url().optional(),
|
|
||||||
DB_PROVIDER: z.enum(['cosmos', 'memory']).default('cosmos'),
|
|
||||||
PRODUCT_ID: z.string().default(PRODUCT_ID),
|
PRODUCT_ID: z.string().default(PRODUCT_ID),
|
||||||
PLATFORM_SERVICE_URL: z.string().default('http://localhost:4003'),
|
PLATFORM_SERVICE_URL: z.string().default('http://localhost:4003'),
|
||||||
EXTRACTION_SERVICE_URL: z.string().default('http://localhost:4005'),
|
EXTRACTION_SERVICE_URL: z.string().default('http://localhost:4005'),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user