From 2970a9240f7a2451c9cd5f038a6637597ea2416c Mon Sep 17 00:00:00 2001 From: Bernard Duggan Date: Mon, 26 Oct 2020 14:07:37 +1100 Subject: [PATCH] Loosen type for adapter key (#52) --- lib/confex.ex | 16 ++++++++-------- lib/confex/adapter.ex | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/confex.ex b/lib/confex.ex index 0ec1e4a..7c887a9 100644 --- a/lib/confex.ex +++ b/lib/confex.ex @@ -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. @@ -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. diff --git a/lib/confex/adapter.ex b/lib/confex/adapter.ex index c460f1b..b2cb608 100644 --- a/lib/confex/adapter.ex +++ b/lib/confex/adapter.ex @@ -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.