Be a bit more defensive with the Env interface.

Not sure how this middleware will be used in the future.
Better check that the Env variable are populated.