Skip to content

Commit

Permalink
https://github.com/bonfire-networks/bonfire-app/issues/900
Browse files Browse the repository at this point in the history
  • Loading branch information
mayel committed Dec 31, 2024
1 parent d695892 commit 5e5f2e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions lib/config_settings/env_config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ defmodule Bonfire.Common.EnvConfig do
...> prefix: "TESTB_DB",
...> transform_keys: &String.to_existing_atom/1,
...> )
...> |> Map.new() # just to make the test assertion easier
%{host: "localhost", port: "5432"}
...> |> Enum.sort() # just to make the test assertion easier
[host: "localhost", port: "5432"]
### With type casting for specific keys
Expand All @@ -72,8 +72,8 @@ defmodule Bonfire.Common.EnvConfig do
...> ssl: :boolean
...> }
...> )
...> |> Map.new() # just to make the test assertion easier
%{ssl: true, max_connections: 100, port: 5432}
...> |> Enum.sort() # just to make the test assertion easier
[max_connections: 100, port: 5432, ssl: true]
### With type casting for only some keys, including unknown keys as well (returns a map with mixed keys)
Expand Down
8 changes: 2 additions & 6 deletions lib/types.ex
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ defmodule Bonfire.Common.Types do
do: Enum.map(types, &table_type/1) |> Enums.filter_empty([]) |> Enum.dedup()

def table_types(type),
do: table_types(List.wrap(type))
do: table_types([type])

@doc """
Given an object or module name, returns its respective table table ID (i.e. Pointable ULID).
Expand All @@ -947,11 +947,7 @@ defmodule Bonfire.Common.Types do
def table_type(type) when is_map(type), do: object_type(type) |> table_id()

def table_type(type) when is_binary(type) do
if is_uid?(type) do
type
else
String.capitalize(type)
end
type
|> object_type()
|> table_id()
end
Expand Down

0 comments on commit 5e5f2e3

Please sign in to comment.