I have a better idea (just occurred to me), what about
~~~
hostname: <%= ENV['SERVER_NAME'] || 'localhost' %>
port: <%= ENV['SERVER_PORT'] || '3000' %>
~~~
?

I would like to move all endpoint-related configuration into A2 VHs. It's much easier to explain, would keep everything in one place and the SetEnv directive is well-known ... We just have to come up with a suitable naming schema.