Skip to content

Commit

Permalink
Format Plausible.Geo doctags
Browse files Browse the repository at this point in the history
  • Loading branch information
vinibrsl committed Jan 11, 2023
1 parent 0a4d8a8 commit 18a904c
Showing 1 changed file with 38 additions and 18 deletions.
56 changes: 38 additions & 18 deletions lib/plausible/geo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,34 @@ defmodule Plausible.Geo do
@db :geolocation

@doc """
Starts the geodatabase loading process. Two options are supported, local file and maxmind key.
Starts the geodatabase loading process. Two modes are supported: local file
and MaxMind license key.
Loading a local file:
## Options
iex> load_db(path: "/etc/plausible/dbip-city.mmdb")
:ok
* `:path` - the path to the .mmdb database local file. When present,
`:license_key` and `:edition` are not required.
Loading a maxmind db:
* `:license_key` - the [license key](https://support.maxmind.com/hc/en-us/articles/4407111582235-Generate-a-License-Key)
from MaxMind to authenticate requests to MaxMind.
# this license key is no longer active
iex> load_db(license_key: "LNpsJCCKPis6XvBP", edition: "GeoLite2-City", async: true)
:ok
* `:edition` - the name of the MaxMind database to be downloaded from MaxMind
servers. Defaults to `GeoLite2-City`.
* `:async` - when used, configures the database loading to run
asynchronously.
## Examples
Loading from a local file:
iex> load_db(path: "/etc/plausible/dbip-city.mmdb")
:ok
Downloading a MaxMind DB (this license key is no longer active):
iex> load_db(license_key: "LNpsJCCKPis6XvBP", edition: "GeoLite2-City", async: true)
:ok
"""
def load_db(opts) do
Expand All @@ -43,17 +59,21 @@ defmodule Plausible.Geo do
end

@doc """
Returns geodatabase type. Used for deciding whether to show the DBIP disclaimer.
Returns geodatabase type.
Used for deciding whether to show the DB-IP disclaimer or not.
## Examples
In the case of a DB-IP database:
Example:
iex> database_type()
"DBIP-City-Lite"
# in the case of a dbip db
iex> database_type()
"DBIP-City-Lite"
In the case of a MaxMind database:
# in the case of a maxmind db
iex> database_type()
"GeoLite2-City"
iex> database_type()
"GeoLite2-City"
"""
def database_type do
Expand All @@ -64,9 +84,9 @@ defmodule Plausible.Geo do
end

@doc """
Looks up geo info about an ip address.
Looks up geo info about an IP address.
Example:
## Examples
iex> lookup("8.7.6.5")
%{
Expand Down

0 comments on commit 18a904c

Please sign in to comment.