m2ee-tools icon indicating copy to clipboard operation
m2ee-tools copied to clipboard

Clean up configuration handling code

Open knorrie opened this issue 8 years ago • 1 comments
trafficstars

This is about src/m2ee/config.py, which didn't get it fair share of spring cleaning yet in the last years. The problem is not that there are many bugs. The problem is that the code is a mess and hard to work with and change, which is not nice for the developer, and makes it easier to introduce new bugs.

When removing Mendix 2.5 compatibility most of the hacks already got removed, now it the time to clean up the rest.

So:

  • Have a proper in-memory model of settings, not just a yolo style dictionary.
  • Add input validation so invalid settings are detected early without causing unexpected program behavior.
  • Make a clear distinction between just reading the config file and assembling derived config. Currently a lot of things are already done immediately, like setup_classpath (which should be done during start instead).
  • Move config handling that happens outside config.py into it (e.g. conversion of format of params in send_runtime_config in core.py)
  • Transform the get_blah functions into properties. Put the old functions into a corner as deprecated functions (warn when using them, remove in v8).

knorrie avatar Oct 14 '17 21:10 knorrie

  • Oh, and please don't sys.exit(1) in a library! It happens in multiple places in the checking code.

knorrie avatar Jan 30 '18 17:01 knorrie