It's not always obtained from custom middleware.  For example mojito loads a "static config" at app start time, based on a fixed context that represents the runtime environment (staging, production, etc), before any requests are handled.