Extract function for registering handlers
Tests should fail early
Get configuration from environment

Remove parameter parsing.