stevebauman / location

Detect a users location by their IP Address.
MIT License
1.09k stars 177 forks source link

Location testing has no effect #166

Open dutypro opened 5 months ago

dutypro commented 5 months ago

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

Any help is appreciated!

stevebauman commented 5 months ago

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 👍