-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from platogo/feature/fix-database-config
Fix: Database config for downloading geolix data
- Loading branch information
Showing
3 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ Wrapper around Geolix that supports periodic refresh of the GeoIP database. | |
|
||
```elixir | ||
def deps do | ||
[{:geo, git: "[email protected]:platogo/geoip-elixir.git"}, tag: "1.4.7"] | ||
[{:geo, git: "[email protected]:platogo/geoip-elixir.git"}, tag: "1.4.8"] | ||
end | ||
``` | ||
|
||
|
@@ -32,3 +32,43 @@ You can manually disable database refresh completely (useful for tests which don | |
```elixir | ||
config :geo, :disable_refresh, true | ||
``` | ||
|
||
In order to use a fake database, add something similar to the following configuration to your configuration: | ||
|
||
```elixir | ||
config :geolix, | ||
databases: [ | ||
%{ | ||
id: :city, | ||
adapter: Geolix.Adapter.Fake, | ||
data: %{ | ||
{1, 1, 1, 1} => %{country: %{iso_code: "AT"}, location: %{time_zone: "Europe/Vienna"}}, | ||
{2, 2, 2, 2} => %{country: %{iso_code: "HU"}, location: %{time_zone: "Europe/Budapest"}}, | ||
} | ||
} | ||
] | ||
``` | ||
|
||
In order to use a downloaded database, use the following: | ||
|
||
```elixir | ||
geolix_database_path = "/absolute/path/to/ip_database.tar.gz" | ||
|
||
config :geo, | ||
disable_refresh: false, | ||
database_path: geolix_database_path | ||
|
||
config :geolix, | ||
databases: [ | ||
%{ | ||
id: :city, | ||
adapter: Geolix.Adapter.MMDB2, | ||
source: geolix_database_path | ||
} | ||
] | ||
``` | ||
|
||
## TODO | ||
|
||
This should be changed so we no longer use `Application.get_env/2` for configuration, supervision is handled in the including | ||
application, and `Task` is preferred over `GenServer`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters