Created
June 7, 2019 17:17
-
-
Save disusered/0b10b77b3b03f7c7338688b2f03ef1b1 to your computer and use it in GitHub Desktop.
Update ConfigLoader
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
defmodule Sphingi.ConfigLoader do | |
defp parse(value) when is_atom(value), do: value |> to_string | |
defp parse(value), do: value | |
def get(namespace, value, key \\ nil) do | |
if key do | |
parse(Application.get_env(namespace, value)[key]) | |
else | |
parse(Application.get_env(namespace, value)) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment