Schema Reference
The schema is a Record<string, SchemaRule> where SchemaRule includes the following fields:
type— one ofstring,number,boolean,date,object,array,email,url,ip,json,portrequired— booleandefault— anymin,max,minLength,maxLengthvalidate—(value) => booleancustom validatortransform—(value) => anyvalue transformsensitive— boolean; when true this value is masked in errors and excluded from.env.exampleencrypted— boolean; when true the value must be stored as anencrypted:v1:…token (see Encryption)docs— string documentationenum— array of allowed valuesregex/regexErroritems—SchemaRulefor array itemsproperties—Record<string, SchemaRule>forobjecttypesenvPrefix— optional string used to map grouped envs intoobjectproperties (defaults to<KEY>_whenpropertiesexists)
Example:
{
DATABASE: {
type: 'object',
properties: {
HOST: { type: 'string' },
PORT: { type: 'port', default: 5432 }
}
}
}