• Transform environment variables into a nested object. Expects '_' to delimit nested keys and '' to delimit camelCase keys. Expects 'True' and 'False' to be transformed into booleans. Expects comma-separated values to be transformed into arrays.

    Parameters

    • envVars: {
          [key: string]: string | undefined;
      }

      input environment variables.

      • [key: string]: string | undefined

    Returns TransformedEnv

    Example

    const envVars = {
    CCU__DJANGO__ALLOWED_HOSTS: '*',
    CCU__DJANGO__CSRF_COOKIE_SECURE: 'False',
    SENTRY__TRACE_EXCLUDE_URLS: 'one,two,three'
    }
    const result = transformEnvVars(envVars)
    console.log(result)
    // {
    // ccu: {
    // django: {
    // allowedHosts: '*',
    // csrfCookieSecure: false,
    // },
    // },
    // sentry: {
    // traceExcludeUrls: ['one', 'two', 'three'],
    // },
    // }

Generated using TypeDoc