On Apache, we had a setup where we could have http auth for all of our dev branches unless the hostname matched our whitelist or if the visitor's IP matched our whitelist.
This is what we had:
SetEnvIf Host master.oursite.co GrantAccess
SetEnvIf Host 1429-new-checkout.oursite.co GrantAccess
allow from 213.141.134.200
allow from 46.159.236.22
How could I accomplish this on NginX in a way that requires minimal configuration each time I want to add/remove access.