Do type assertions better.
Add Dir and Env to Service config. Make Metadata a free-form mapping.