You could use IF alot of times but IF should only be used as an exit method (if x=y return 503), a better way would be via Lua;
rewrite_by_lua '
if not ngx.var.remote_ip then ngx.var.remote_ip = 'value'; end;
if ................. etc.
';
rewrite_by_lua '
if not ngx.var.remote_ip then ngx.var.remote_ip = 'value'; end;
if ................. etc.
';