.forRoot(): environment variable key/value pairs are parsed and resolved. registers the ConfigService
provider.
ConfigService: several options for accessing. first need to inject ConfigService
process.env
can be slow, to increase the performance of ConfigService#get
method when it comes to variables stored in process.env
Custom configuration files
registerAs()
functionValidation: It is standard practice to throw an exception during application startup if required environment variables haven't been provided or if they don't meet certain validation rules.
validate()
functionExpandable variables: supports environment variable expansion
Using in the main.ts: it can still be used in the main.ts
file