Closed fatihusta closed 8 months ago
To achieve this, you could do something like assigning both of those values to separate variables and then making the decision to use
$geoip2_data_country country names en
$geoip2_data_registered_country registered_country names en
Then use something like map
to choose the right one (not sure if this is correct, but you can lookup map
here: https://nginx.org/en/docs/http/ngx_http_map_module.html)
map "$geoip2_data_country" $country {
default $geoip2_data_registered_country;
~. $geoip2_data_country;
}
You would now have $country
available which would be $geoip2_data_country
if it wasn't empty, otherwise $geoip2_data_registered_country
would be used.
@leev Thank you for the answer. It worked.
First of all thank you for this project.
I found an issue that some times country information not available under the country key. Country information also stores under the registered_country.
Is it possible to lookup registered_country if not available under the country. details
By the way I'm not sure registered_country always available in database. That's why I'm asking this question.
Queries