More Pow love with configuration
I'm really digging Pow right now. But, as many others, I had a very different setup for my application hostnames. Where Pow uses .dev, I actually used .lh.impaled.org and another project has hardcoded .local in it, because ..Rails people use OSX.
One glance at the Pow manual and you find "Configuring Pow", pointing you to create a ~/.powconfig that is sourced when Pow boots up. And the whole thing is very well documented too!
So I added this to my ~/.powconfig
export POW_DOMAINS=dev,local,lh.impaled.org
You'll have to restart Pow to pick it up, which as of right, has to be done manually, like so:
varar:.pow mr$ sudo ps ax | grep command.js | grep -v grep | awk '{print $1}' | xargs kill -HUP
And behold! It works.
Adding more domains
My impaled.org nameservers resolve *.lh.impaled.org to 127.0.0.1, because when I switched to the Mac, I never bothered setting up a nameserver on it and didn't have my local nameserver if I left the house obviously.
I also never bothered doing what 37signals did, which in hindsight, I regret, because their nameserver code is pretty neat. It uses ndns and clocks in at 45 lines.
However - it resolves any query to 127.0.0.1, so you can actually use this for your own TLD of choice as well.
To get OSX to recognize your domain, all you need is a file in /etc/resolver. Say you want *.local to resolve to 127.0.0.1, you can just symlink their /etc/resolver/dev.
varar:~ mr$ sudo ln -sf /etc/resolver/dev /etc/resolver/local
To verify that OSX has picked it up, ping a host (don't use host, it doesn't care about your OSX configuration.)
varar:~ mr$ ping test.test.local PING test.test.local (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.055 ms
You'll eventually notice that you can't use the second-level of .local -- this is because OSX routes that to it's own mdns resolver, which you can see when running scutil --dns.
varar:~ mr$ scutil --dns DNS configuration resolver #1 domain : impaled.org nameserver[0] : 192.168.1.1 order : 200000 resolver #2 domain : local options : mdns timeout : 2 order : 300000 [...] resolver #9 domain : local nameserver[0] : 127.0.0.1 port : 20560
It's not interested in the third-level however, so your queries for those are passed on to the ndns resolver. To get the second-level to resolve for you, just throw it into your /etc/hosts.
Or, of course, don't use .local, because it's actually stupid to do so. I just figured I'd use it as the example because, as I said, one of my projects has hardcoded .local hostnames in it that aren't worth the hassle to change.