Interface ProviderOptions<PortConfig>

Provider configuration options

interface ProviderOptions<PortConfig> {
    logger?: LoggerInstance;
    name: string;
    type: string;
    useEnvironment?: string | boolean;
    validation: PortConfigValidationStruct<PortConfig>;
}

Type Parameters

  • PortConfig

    Port configuration object, could be an extended version of the client config

Properties

Port and provider logger, to be used internally

name: string

Provider name, used for human-readable logs and identification

type: string

Provider type, kind of component form the points of view of the health check standard https://datatracker.ietf.org/doc/html/draft-inadarei-api-health-check-06

useEnvironment?: string | boolean

String is used as prefix for the environment configuration variables, represented in SCREAMING_SNAKE_CASE, that will parsed to camelCase and merged with the rest of the configuration.

// Environment variables
process.env.PORT_NAME_TYPE = 'http';
process.env.PORT_NAME_HOST = 'localhost';
process.env.PORT_NAME_PORT = '8080';
process.env.PORT_NAME_OTHER_CONFIG__MY_CONFIG = 'true';
// Provider configuration
{
name: 'port-name',
type: 'http',
validation: {...},
envPrefix: 'PORT_NAME_',
}
// Resulting configuration
{
type: 'http',
host: 'localhost',
port: 8080,
otherConfig: {
myConfig: true,
},
}

Port validation options