location icon indicating copy to clipboard operation
location copied to clipboard

Location testing has no effect

Open dutypro opened this issue 1 month ago • 1 comments

Bug

I'm trying to make use of the LOCATION_TESTING boolean in my env file to set an IP address manually whilst on localhost but it doesn't have any effect.

.env:

LOCATION_TESTING=true

location.php config (I swapped around the enabled and ip keys to test with no joy):

'testing' => [
        'enabled' => env('LOCATION_TESTING', true),
        'ip' => '66.102.0.0',
    ],

I get this error message in the logs:

local.ERROR: The address 127.0.0.1 is not in the database. {"userId":1,"exception":"[object] (GeoIp2\\Exception\\AddressNotFoundException(code: 0): The address 127.0.0.1 is not in the database.

What I've Tried

  • Clearing the config cache,
  • Setting it to false and then back to true again,
  • Running it via php artisan serve (I use valet, mysite.test)
  • Changing IP addresses,
  • Changing the order of the testing array of keys in the config file.

Any help is appreciated!

dutypro avatar Apr 30 '24 19:04 dutypro

Hi @dutypro!

Can you remove the env() method all-together to ensure your .env file is not taken into account for debugging? Ex:

'testing' => [
-   'enabled' => env('LOCATION_TESTING', true),
+   'enabled' => true,
    'ip' => '66.102.0.0',
],

Update to the above, then try retrieving the location again to see if the issue is resolved and let me know 👍

stevebauman avatar May 02 '24 22:05 stevebauman