Stabilize key/value output by sorting hashes on key.

Basically a rebase of #38. This forces the iteration of key/value pairs to happen in a certain order (sorted by key) to prevent frequent restarts of nginx.