mirror of
https://github.com/benbusby/farside.git
synced 2025-04-19 23:05:56 -04:00
show fallback if there are no instances avail
This commit is contained in:
parent
9b7c544466
commit
e2ca414f79
2
app.json
2
app.json
@ -6,7 +6,7 @@
|
||||
"keywords": ["elixir", "farside" ],
|
||||
"env": {
|
||||
"MIX_ENV": "prod",
|
||||
"FARSIDE_SERVICES_JSON": {
|
||||
"FARSIDE_SERVICES_JSON_DATA": {
|
||||
"description": "The base64(json) of services available (https://www.base64encode.org)",
|
||||
"value": "",
|
||||
"required": false
|
||||
|
@ -39,6 +39,15 @@ defmodule Farside do
|
||||
|> Enum.reduce(%{}, fn service, acc ->
|
||||
{_, data} = :ets.lookup(String.to_atom(service), :data) |> List.first()
|
||||
|
||||
instances =
|
||||
case Enum.count(data.instances) == 0 do
|
||||
true ->
|
||||
[data.fallback]
|
||||
|
||||
false ->
|
||||
data.instances
|
||||
end
|
||||
|
||||
Map.put(
|
||||
acc,
|
||||
String.replace_prefix(
|
||||
@ -46,7 +55,7 @@ defmodule Farside do
|
||||
@service_prefix,
|
||||
""
|
||||
),
|
||||
data.instances
|
||||
instances
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user