Support env file

Replaces #481 and #479 addressing the issues raised in those tickets.
Done :)