View Source Geocoder.Config (geocoder v2.0.1)
Centralization of configurations and defaults values.
The following options are available for configuration.
:pool_name
- The name for the pool.:pool_config
- The configuration for the pool. It uses Poolboy behind the scene, so the following configuration key exists.:store_module
- The store module to use. Defaults toGeocoder.Store
:store_config
- The store configuration:worker_config
- The worker configuration. Things like the provider, key, or even custom JSON codec or HTTP clients
Here is full example of a configuration (with all the defaults)
[
pool_name: :geocoder_workers,
pool_config: [
worker_module: Geocoder.Worker,
size: 4,
max_overflow: 2,
strategy: :lifo,
name: {:local, :geocoder_workers}
],
store_module: Geocoder.Store,
store_config: [name: :geocoder_store, precision: 6],
worker_config: [
provider: Geocoder.Providers.OpenStreetMaps,
key: nil,
http_client: Geocoder.HttpClient.Httpoison,
http_client_opts: [recv_timeout: 30000],
json_codec: Jason,
data: nil
]
]
Summary
Types
@type geocoder_config() :: [geocoder_option()]
@type geocoder_option() :: {:pool_name, atom()} | {:pool_config, pool_config()} | {:store_module, module()} | {:store_config, store_config()} | {:worker_config, worker_config()}
@type pool_config() :: [pool_option()]
@type pool_option() :: {:worker_module, module()} | {:size, pos_integer()} | {:max_overflow, pos_integer()} | {:strategy, :fifo | :lifo} | {:name, atom() | {atom(), atom()}}
@type store_config() :: [store_option()]
@type store_option() :: {:name, atom()} | {:precision, pos_integer()}
@type worker_config() :: [worker_option()]
Functions
@spec all(geocoder_config()) :: geocoder_config()
@spec default_pool_name() :: :geocoder_workers
@spec default_store_name() :: :geocoder_store
@spec pool_config(geocoder_config()) :: pool_config()
@spec pool_name(geocoder_config()) :: atom()
@spec store_module(geocoder_config()) :: atom()
@spec worker_config(geocoder_config()) :: worker_config()
@spec worker_config(geocoder_config()) :: store_config()