UNPKG

@npio/internals

Version:

A free visual website editor, powered with your own SolidJS components.

37 lines (32 loc) 879 B
import type { LocalOptions, S3Options } from "@npio/filesystem"; import { Config as AuthConfig } from "../../auth/server"; import { createGlobal } from "./util"; export type ServerConfig = { auth: AuthConfig & { salt: string }; filesystem: { defaultDriver: "local" | "s3"; drivers: { local?: LocalOptions; s3?: S3Options; }; }; image: { aspectRatios: string[]; sizes: number[]; placeholder: { name: string; }; maxAge: number; quality: number; }; }; export type ServerConfigOptions = { auth?: Partial<AuthConfig>; filesystem?: Partial<ServerConfig["filesystem"]>; image?: Partial<ServerConfig["image"]>; }; export const [useServerConfig, setServerConfig] = createGlobal<ServerConfig>("npServerConfig"); export const defineServerConfig = function (config: () => ServerConfigOptions) { return config; };