import { Logger } from 'common-stuff'; import { z } from 'zod'; export declare enum Environment { Production = "production", Development = "development" } declare const configSchema: z.ZodObject<{ /** * Server host. * * Default: `0.0.0.0` */ host: z.ZodString; /** * Server port. * * Default: `env.PORT` or 3000 */ port: z.ZodNumber; /** * Project environment. * * Default: `production` */ environment: z.ZodNativeEnum; /** * Logging configuration. * * Default: `console` */ logging: z.ZodObject<{ transports: z.ZodArray; }, "strip", z.ZodTypeAny, { type: "console"; }, { type: "console"; }>, z.ZodObject<{ type: z.ZodLiteral<"loggly">; subdomain: z.ZodString; token: z.ZodString; tags: z.ZodOptional>; }, "strip", z.ZodTypeAny, { tags?: string[] | undefined; type: "loggly"; subdomain: string; token: string; }, { tags?: string[] | undefined; type: "loggly"; subdomain: string; token: string; }>]>, "many">; /** * Logging level. * * Default: `info` */ level: z.ZodEnum<["debug", "info", "warn", "error"]>; }, "strip", z.ZodTypeAny, { transports: ({ type: "console"; } | { tags?: string[] | undefined; type: "loggly"; subdomain: string; token: string; })[]; level: "error" | "debug" | "info" | "warn"; }, { transports: ({ type: "console"; } | { tags?: string[] | undefined; type: "loggly"; subdomain: string; token: string; })[]; level: "error" | "debug" | "info" | "warn"; }>; /** * Torrent client settings */ torrents: z.ZodObject<{ path: z.ZodString; /** * Delete torrent data if it is inactive for X seconds. * * Default: `3600` */ ttl: z.ZodNumber; /** * Load default trackers list & use it for each torrents. * * Default: `true` */ useDefaultTrackers: z.ZodBoolean; /** * Additional trackers (`tr` parameter) which will be appended to each torrent. * * Default: `[]` */ announce: z.ZodArray; /** * Web Seed (`ws` parameter) which will be appended to each torrent. * * Default: `[]` */ urlList: z.ZodArray; /** * Peer addresses (`x.pe` parameter). * * Default: `[]` */ peerAddresses: z.ZodArray; /** * Max download speed (bytes/sec) over all torrents * * Default: `5242880` */ downloadLimit: z.ZodNumber; /** * Max upload speed (bytes/sec) over all torrents * * Default: `0` */ uploadLimit: z.ZodNumber; }, "strip", z.ZodTypeAny, { path: string; downloadLimit: number; uploadLimit: number; announce: string[]; peerAddresses: string[]; urlList: string[]; ttl: number; useDefaultTrackers: boolean; }, { path: string; downloadLimit: number; uploadLimit: number; announce: string[]; peerAddresses: string[]; urlList: string[]; ttl: number; useDefaultTrackers: boolean; }>; /** * Security settings */ security: z.ZodObject<{ /** * Stream API (`/stream/:torrent`) settings */ streamApi: z.ZodObject<{ /** * Protect stream API with [JSON Web Token](https://jwt.io/). * * If `apiKey` is not set, it can also be used as API key (`authorization`: `bearer ${apiKey}`). * * Default: `undefined` */ key: z.ZodOptional; /** * The maximum allowed age for tokens to still be valid. * It is expressed in seconds or a string describing a time span [zeit/ms](https://github.com/vercel/ms) * * Default: `6h` */ maxAge: z.ZodString; }, "strip", z.ZodTypeAny, { key?: string | undefined; maxAge: string; }, { key?: string | undefined; maxAge: string; }>; /** * Serve frontend static files * * Default: environment === 'production' */ frontendEnabled: z.ZodBoolean; /** * Enable API * * Default: true */ apiEnabled: z.ZodBoolean; /** * Protect API with key. It should be passed to headers to access the API (`authorization`: `bearer ${apiKey}`). * * If `streamApi` doesn't have a separate key, `apiKey` can be used as JSON Web Token. * * Default: undefined */ apiKey: z.ZodOptional; /** * Limit requests per minute for single IP * * Default: 100 */ rpm: z.ZodNumber; }, "strip", z.ZodTypeAny, { apiKey?: string | undefined; streamApi: { key?: string | undefined; maxAge: string; }; frontendEnabled: boolean; apiEnabled: boolean; rpm: number; }, { apiKey?: string | undefined; streamApi: { key?: string | undefined; maxAge: string; }; frontendEnabled: boolean; apiEnabled: boolean; rpm: number; }>; /** * Get ip from `X-Forwarded-*` header. * * Default: true if inside App Engine or Heroku else false */ trustProxy: z.ZodBoolean; }, "strip", z.ZodTypeAny, { port: number; host: string; environment: Environment; logging: { transports: ({ type: "console"; } | { tags?: string[] | undefined; type: "loggly"; subdomain: string; token: string; })[]; level: "error" | "debug" | "info" | "warn"; }; torrents: { path: string; downloadLimit: number; uploadLimit: number; announce: string[]; peerAddresses: string[]; urlList: string[]; ttl: number; useDefaultTrackers: boolean; }; security: { apiKey?: string | undefined; streamApi: { key?: string | undefined; maxAge: string; }; frontendEnabled: boolean; apiEnabled: boolean; rpm: number; }; trustProxy: boolean; }, { port: number; host: string; environment: Environment; logging: { transports: ({ type: "console"; } | { tags?: string[] | undefined; type: "loggly"; subdomain: string; token: string; })[]; level: "error" | "debug" | "info" | "warn"; }; torrents: { path: string; downloadLimit: number; uploadLimit: number; announce: string[]; peerAddresses: string[]; urlList: string[]; ttl: number; useDefaultTrackers: boolean; }; security: { apiKey?: string | undefined; streamApi: { key?: string | undefined; maxAge: string; }; frontendEnabled: boolean; apiEnabled: boolean; rpm: number; }; trustProxy: boolean; }>; export declare type Config = z.infer; export declare const isInGoogleAppEngine: boolean; export declare const isInHeroku: boolean; export declare function readConfig(path?: string, overwrites?: Partial): Config; /** * Frontend package path to build directory */ export declare const frontendBuildPath: string; export interface Globals { config: Config; logger: Logger; } export {};