Skip to content

Commit

Permalink
Merge pull request #80 from peter-gribanov/configuration_path
Browse files Browse the repository at this point in the history
Update configuration docs
  • Loading branch information
peter-gribanov authored Jul 12, 2021
2 parents b11fdd3 + 0070290 commit a5eb193
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ URL in the configuration.

```yml
gpslab_geoip:
license: 'XXXXXXXXXXXXXXXX'
edition: 'GeoLite2-City'
url: 'https://example.com/GeoLite2-City.tar.gz'
```

Expand All @@ -73,6 +75,8 @@ environment may not be optimal. You can choose a common directory for all enviro

```yml
gpslab_geoip:
license: 'XXXXXXXXXXXXXXXX'
edition: 'GeoLite2-City'
path: '%kernel.project_dir%/var/GeoLite2-City.mmdb'
```

Expand All @@ -83,6 +87,8 @@ locales for fallback.

```yml
gpslab_geoip:
license: 'XXXXXXXXXXXXXXXX'
edition: 'GeoLite2-City'
locales: [ 'ru', 'en' ]
```

Expand Down Expand Up @@ -192,6 +198,8 @@ gpslab_geoip:
locales: [ 'fr' ] # customize locales
city:
edition: 'GeoLite2-City'
url: 'https://example.com/GeoLite2-City.tar.gz' # customize url
path: '%kernel.project_dir%/var/GeoLite2-City.mmdb' # customize path
country:
edition: 'GeoLite2-Country'
license: 'YYYYYYYYYYYYYYYY' # customize license
Expand Down
46 changes: 44 additions & 2 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,46 @@ public function getConfigs(): iterable
]];
}

yield [$cache_dir, [
'gpslab_geoip' => [
'license' => 'LICENSE',
'edition' => 'GeoLite2-City',
'url' => 'https://example.com/GeoLite2-City.tar.gz',
],
], [
'default_database' => 'default',
'databases' => [
'default' => [
'license' => 'LICENSE',
'edition' => 'GeoLite2-City',
'url' => 'https://example.com/GeoLite2-City.tar.gz',
'path' => sprintf(self::PATH, $real_cache_dir, 'GeoLite2-City'),
'locales' => ['en'],
],
],
'locales' => ['en'],
]];

yield [$cache_dir, [
'gpslab_geoip' => [
'license' => 'LICENSE',
'edition' => 'GeoLite2-City',
'path' => '%kernel.project_dir%/var/GeoLite2-City.mmdb',
],
], [
'default_database' => 'default',
'databases' => [
'default' => [
'license' => 'LICENSE',
'edition' => 'GeoLite2-City',
'path' => '%kernel.project_dir%/var/GeoLite2-City.mmdb',
'url' => sprintf(self::URL, 'GeoLite2-City', 'LICENSE'),
'locales' => ['en'],
],
],
'locales' => ['en'],
]];

yield [$cache_dir, [
'gpslab_geoip' => [
'default_database' => 'foo',
Expand All @@ -284,6 +324,8 @@ public function getConfigs(): iterable
'license' => 'LICENSE_2',
'edition' => 'GeoLite2-City',
'locales' => ['ru'],
'url' => 'https://example.com/GeoLite2-City.tar.gz',
'path' => '%kernel.project_dir%/var/GeoLite2-City.mmdb',
],
'baz' => [
'license' => 'LICENSE_3',
Expand All @@ -306,8 +348,8 @@ public function getConfigs(): iterable
'license' => 'LICENSE_2',
'edition' => 'GeoLite2-City',
'locales' => ['ru'],
'url' => sprintf(self::URL, 'GeoLite2-City', 'LICENSE_2'),
'path' => sprintf(self::PATH, $real_cache_dir, 'GeoLite2-City'),
'url' => 'https://example.com/GeoLite2-City.tar.gz',
'path' => '%kernel.project_dir%/var/GeoLite2-City.mmdb',
],
'baz' => [
'license' => 'LICENSE_3',
Expand Down

0 comments on commit a5eb193

Please sign in to comment.