diff --git a/.envrc b/.envrc index 7aab338..624af5a 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,2 @@ export FARSIDE_PORT="4001" +export FARSIDE_TIMEOUT="10000" \ No newline at end of file diff --git a/app.json b/app.json index 5f30a15..0212471 100644 --- a/app.json +++ b/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 diff --git a/lib/farside.ex b/lib/farside.ex index b337580..4b30fff 100644 --- a/lib/farside.ex +++ b/lib/farside.ex @@ -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