Fix setting custom environment URL
Add test to check custom environment URL