Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Configuration<Shape, Schema, Config>

Configuration manager

Type parameters

  • Shape: z.ZodRawShape

  • Schema: z.ZodObject<Shape>

  • Config: z.infer<Schema>

Hierarchy

  • Configuration

Index

Constructors

constructor

  • new Configuration<Shape, Schema, Config>(schema: Schema): Configuration<Shape, Schema, Config>
  • Creates a new configuration manager

    Type parameters

    • Shape: ZodRawShape

    • Schema: ZodObject<Shape, "strip", ZodTypeAny, {[ k in string | number | symbol]: addQuestionMarks<{[ k in string | number | symbol]: Shape[k]["_output"] }>[k] }, {[ k in string | number | symbol]: addQuestionMarks<{[ k in string | number | symbol]: Shape[k]["_input"] }>[k] }, Schema>

    • Config: {[ k in string | number | symbol]: addQuestionMarks<{[ k in string | number | symbol]: Shape[k]["_output"] }>[k] }

    Parameters

    • schema: Schema

      Zod schema

    Returns Configuration<Shape, Schema, Config>

Properties

Private #configs

#configs: (Config | DeepPartial<Config>)[] = ...

Private #dirty

#dirty: boolean = false

Private #envConfig

#envConfig: DeepPartial<Config> = ...

Private #parsedConfig

#parsedConfig: Config = ...

Private #schema

#schema: Schema

Methods

env

  • Hook up environment variables to your configuration

    Parameters

    • config: EnvConfig<Config>

      ENV Declaration configuration

    Returns Configuration<Shape, Schema, Config>

    Configuration manager

get

  • get<P>(path: P): PathValue<Config, P>
  • Get a cetain property from the configuration

    Type parameters

    • P: string & `${string}.${string}` & string

    Parameters

    • path: P

      Path to property

    Returns PathValue<Config, P>

    Value of the property

set

  • set(config: DeepPartial<Config>): Configuration<Shape, Schema, Config>
  • Manually add new configuration

    Parameters

    • config: DeepPartial<Config>

      Deeply partial configuration

    Returns Configuration<Shape, Schema, Config>

    Configuration manager

validate

  • Validates your current configuration

    Returns Configuration<Shape, Schema, Config>

    Configuration manager

Generated using TypeDoc