feat: add file storage service and update configurations
refactor: migrate to tsup for builds and update tsconfigs fix: update error handling and validation in payment service chore: update package scripts and dependencies docs: update README and env examples
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { parseEnv } from 'znv';
|
||||
import { z } from 'zod';
|
||||
import type { ConfigSchema, ConfigOptions, InferConfig } from './types';
|
||||
import { parseEnv } from "znv";
|
||||
import { z } from "zod";
|
||||
import type { ConfigSchema, ConfigOptions, InferConfig } from "./types";
|
||||
|
||||
export const createConfig = <T extends ConfigSchema>(
|
||||
options: ConfigOptions<T>,
|
||||
): InferConfig<T> => {
|
||||
const { schema, env = process.env, prefix = '' } = options;
|
||||
const { schema, env = process.env, prefix = "" } = options;
|
||||
|
||||
// Add prefix to schema keys if provided
|
||||
const prefixedSchema = prefix
|
||||
@@ -14,7 +14,7 @@ export const createConfig = <T extends ConfigSchema>(
|
||||
acc[`${prefix}${key}`] = zodSchema;
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, z.ZodTypeAny>
|
||||
{} as Record<string, z.ZodTypeAny>,
|
||||
)
|
||||
: schema;
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from './create-config';
|
||||
export * from './types';
|
||||
export * from "./create-config";
|
||||
export * from "./types";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import { z } from "zod";
|
||||
|
||||
export type ConfigSchema = Record<string, z.ZodTypeAny>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user