@scholten.dev/api-base

0.8.0 • Public • Published

Api base

services/configuration

Configuration service will try to map environment variables to an existing configuration class.

If the environment variable doesn't exist, the already existing value in the baseConfig will be used.

If the type is not matching, an error will be thrown.

Note: environment variables must be prefixed with CONFIG_. Example: CONFIG_credentials_password=myPassword

import {Configuration} from @scholten.dev/api-base

interface IConfig {
    devMode: boolean;
    credentials: {
        username: string;
        password: string;
    }
}

const baseConfig: IConfig = {
    devMode: true,
    credentials: {
        username: "user"
        password: "pass"
    }
}

const config = Configuration<IConfig>(baseConfig);

Health check

get /api/healthz

Readme

Keywords

none

Package Sidebar

Install

npm i @scholten.dev/api-base

Weekly Downloads

2

Version

0.8.0

License

none

Unpacked Size

17.3 kB

Total Files

24

Last publish

Collaborators

  • scholten