Fix logic to get user.name and user.email

Add corresponding environment variable support.