Fix environment variables in template & add ability to specify username & password