I don't think the pattern you have will exclude non-prod environments. I'd like to see some unit tests built to validate this out. Let me know if you'd like any help with it.