0.8.0 • Published 2 years ago
@scholten.dev/api-base v0.8.0
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