Load environment configs at application bootstrap
Unanswered
Austrian Black and Tan Hound posted this in #help-forum
Austrian Black and Tan HoundOP
I want to load environment specific information once at the server start - something like https://github.com/node-config/node-config at the time of next server start up (not on initial request)
What is the best approach to do this ?
What is the best approach to do this ?
5 Replies
@Austrian Black and Tan Hound I want to load environment specific information once at the server start - something like https://github.com/node-config/node-config at the time of next server start up (not on initial request)
What is the best approach to do this ?
you can probably use env variables, they're loaded when server starts
Austrian Black and Tan HoundOP
@@ts-ignore Env variable has limitation that number of environments are limitted. My use case has configurations for lets say - different regions/countries, dev vs stage vs prod vs test, etc. That is where package like https://github.com/node-config/node-config becomes helpful. However I do not see a way to hook in to server start up logic and load configurations (using package like config above)
FYI https://github.com/node-config/node-config/wiki/Configuration-Files#file-load-order
FYI https://github.com/node-config/node-config/wiki/Configuration-Files#file-load-order
Austrian Black and Tan HoundOP
cool. let me check this out! thank you, Much apreciate that