GeocoderLaravel icon indicating copy to clipboard operation
GeocoderLaravel copied to clipboard

Default package configuration overrides published configuration

Open elceka opened this issue 6 years ago • 4 comments

General Information

GeocoderLaravel Version: 4.1.1 Laravel Version: 5.7 PHP Version: 7.2.14 Operating System and Version: Docker under OSX

Issue Description

Customized providers inside customized published config file /config/geocoder.php has been overrided by package default configuration.

Steps to Replicate

Run command inside project directory: composer require geocoder-php/nominatim-provider php artisan vendor:publish --provider="Geocoder\Laravel\Providers\GeocoderService" --tag="config"

Change value of 'providers' key in the configuration file /config/geocoder.php:

'providers' => [
    Nominatim::class => [
        'https://nominatim.openstreetmap.org',
        'my-user-agent',
    ],
],

Test code:

$providers = \Geocoder\Laravel\Facades\Geocoder::getProviders();
dd($providers);

Result:

Collection {#375 ▼
  #items: array:1 [▼
    "chain" => Chain {#377 ▼
      -providers: array:2 [▼
        "Geocoder\Provider\GoogleMaps\GoogleMaps" => GoogleMaps {#383 ▶}
        "Geocoder\Provider\GeoPlugin\GeoPlugin" => GeoPlugin {#388 ▶}
      ]
      #logger: null
    }
  ]
}

As we can see, we have two providers from package default configuration without our configured Nominatim provider.

Stack Trace

Without any exception.

elceka avatar Mar 25 '19 21:03 elceka

Thanks @elceka I'll look into this.

mikebronner avatar Apr 06 '19 19:04 mikebronner

As you are changing config values, is it possible you are still using cached values?

Would you mind trying php artisan config:cache ?

BR

pxpm avatar Jun 25 '19 13:06 pxpm

@elceka Also try config:clear.

mikebronner avatar Jun 25 '19 14:06 mikebronner

@mikebronner config:cache will do both clear and re-caching :)

pxpm avatar Jun 25 '19 15:06 pxpm