mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-18 02:21:51 +08:00
fix(server): config defaults (#11879)
This commit is contained in:
@@ -57,6 +57,10 @@ function typeFromShape(shape: z.ZodType<any>): ConfigType {
|
||||
return 'array';
|
||||
case z.ZodObject:
|
||||
return 'object';
|
||||
case z.ZodOptional:
|
||||
case z.ZodNullable:
|
||||
// @ts-expect-error checked
|
||||
return typeFromShape(shape.unwrap());
|
||||
default:
|
||||
return 'any';
|
||||
}
|
||||
@@ -251,6 +255,14 @@ export function override(config: AppConfig, update: DeepPartial<AppConfig>) {
|
||||
return right;
|
||||
}
|
||||
|
||||
// EDGE CASE:
|
||||
// the right value is primitive and we're still not finding the key in descriptors,
|
||||
// which means the overrides has keys not defined
|
||||
// that's where we should return
|
||||
if (typeof right !== 'object') {
|
||||
return left;
|
||||
}
|
||||
|
||||
// go deeper
|
||||
return mergeWith(left, right, (left, right, key) => {
|
||||
return merge(left, right, path === '' ? key : `${path}.${key}`);
|
||||
|
||||
Reference in New Issue
Block a user