Skip to content

Commit

Permalink
Loosen type for adapter key (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardd committed Oct 26, 2020
1 parent 525ad31 commit 2970a92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions lib/confex.ex
Expand Up @@ -8,10 +8,10 @@ defmodule Confex do
by Confex configuration type. Common structure:
```elixir
@type fetch_statement :: {adapter :: atom() | module(), value_type :: value_type, key :: String.t, default :: any()}
| {value_type :: value_type, key :: String.t}
| {key :: String.t, default :: any()}
| {key :: String.t}
@type fetch_statement :: {adapter :: atom() | module(), value_type :: value_type, key :: any(), default :: any()}
| {value_type :: value_type, key :: any()}
| {key :: any(), default :: any()}
| {key :: any()}
```
If `value_type` is set, Confex will automatically cast its value. Otherwise, default type of `:string` is used.
Expand Down Expand Up @@ -63,10 +63,10 @@ defmodule Confex do
@typep value :: Application.value()

@type configuration_tuple ::
{value_type :: Confex.Type.t(), key :: String.t(), default :: any()}
| {value_type :: Confex.Type.t(), key :: String.t()}
| {key :: String.t(), default :: any()}
| {key :: String.t()}
{value_type :: Confex.Type.t(), key :: any(), default :: any()}
| {value_type :: Confex.Type.t(), key :: any()}
| {key :: any(), default :: any()}
| {key :: any()}

@doc """
Returns the value for key in app’s environment in a tuple.
Expand Down
4 changes: 2 additions & 2 deletions lib/confex/adapter.ex
Expand Up @@ -9,13 +9,13 @@ defmodule Confex.Adapter do
* `:system_file` - read file path from system environment and \
read configuration from this file (`Confex.Adapters.FileFromSystemEnvironment`).
To simplify configuration syntax, Confex allows to have an alias for adapter names.
To simplify configuration syntax, Confex allows an alias for adapter names.
"""

@doc """
Fetch raw configuration value.
"""
@callback fetch_value(key :: String.t()) :: {:ok, String.t()} | :error
@callback fetch_value(key :: any()) :: {:ok, String.t()} | :error

@doc false
# Resolve adapter with shorthand for built-in's.
Expand Down

0 comments on commit 2970a92

Please sign in to comment.