jaysylvester / citizen

Node.js MVC web application framework. Includes routing, serving, caching, session management, and other helpful tools.
MIT License
100 stars 7 forks source link

Configuration validation on startup #109

Open jaysylvester opened 3 years ago

jaysylvester commented 3 years ago

With all the changes I've made to the config recently, I've been caught a few times by weird issues that were the result of not having updated the config on some projects. Example...

Old config:

sessions       : true,
sessionTimeout : 20

New config:

sessions: {
  enabled  : true,
  lifespan : 20
}

So I spent 10 minutes debugging an issue with sessions expiring that turned out to be a config issue.

There should be validation of the configuration on startup (both the config file and the config passed into app.server.start()) that checks for appropriate values. If something is wrong, provide direction and exit the process.

Checks to perform: