@avanio/variable-util
    Preparing search index...

    Class SemicolonConfigParser<Out>

    Config parser to parse semicolon separated string key=value pairs as object

    const objectSchema = z.object({
    foo: z.string(),
    baz: z.string(),
    secret: z.string(),
    });
    // parses 'foo=bar;baz=qux;secret=secret' string to {foo: "bar", baz: "qux", secret: "secret"}
    const fooBarJsonParser = new SemicolonConfigParser({
    validate: (value) => objectSchema.parse(value),
    protectedKeys: ['secret'],
    showProtectedKeys: 'prefix-suffix', // shows secret value with few characters from start and end on logging
    });

    v1.0.0

    Type Parameters

    • Out extends Record<string, unknown> = Record<string, unknown>

      the type of the output object

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    name: string = 'semicolonConfigParser'

    name of the parser

    Methods

    • Config parser function

      Parameters

      Returns Promise<Record<string, string>>

      Error if parsing fails

    • Optional value validation after parsing

      Parameters

      Returns Promise<undefined | Out>

      Error if validation fails

    • Optional build readable string from value for log (can hide sensitive part from logs) else toString is used

      Parameters

      • config: Out

        value to log

      Returns string