Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update configuration docs #80

Merged
merged 2 commits into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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