Why not using INTEGRITY_ENV and determining host based on that?
(localhost when INTEGRITY_ENV == 'development') ?

However this would require fixing of deploy / god script, because we tried that and this didn't work.