I imagine the best way would be to inject this at source 🙂 rather than look it up later which may always be out of date to some degree.
Otherwise maybe just a LUA processor to do it, depends how you're "looking it up" really - from a local file, from a web service, from DNS, from something else? LUA can cover all those though.