Configuration Loading Before Validation

This comparison sits one step upstream of the startup validation feature.

The existing startup triad assumes we already have a RawStartupConfig. This triad shows how we load that raw shape from stringly key/value settings before validation starts.

What It Shows

  • required-setting detection
  • alias support such as DB_URL and APP_PORT
  • trimming and normalization during loading
  • fail-fast loading vs accumulated missing-setting errors

Modules

  • /Users/scottpeterson/Dev/PurelyFunctional/HaskellDemo/src/Shared/ConfigurationLoadingStartup.hs
  • /Users/scottpeterson/Dev/PurelyFunctional/HaskellDemo/src/Baseline/ConfigurationLoadingStartup.hs
  • /Users/scottpeterson/Dev/PurelyFunctional/HaskellDemo/src/HaskellStyle/ConfigurationLoadingStartup.hs

Baseline Shape

Baseline.ConfigurationLoadingStartup.loadRawStartupConfigInline stops on the first missing required setting.

That keeps the control flow obvious, but readers only learn about one loading problem at a time.

Haskell-Style Shape

HaskellStyle.ConfigurationLoadingStartup.loadRawStartupConfig collects all missing required settings in one pass before returning a normalized RawStartupConfig.

That makes it a better upstream fit for the startup validation triad that follows.