From a6dabe8bf308b660f7a26e5d2dc702c69b9b5210 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Wed, 27 Jul 2022 13:50:23 -0600 Subject: Make conn values and services path configurable at runtime Connection values (such as redis server port and the port to run farside on) as well as the services json file to use can now be set via environment variables: FARSIDE_PORT sets the port for Farside to run on FARSIDE_REDIS_PORT sets the redis server port for Farside to use FARSIDE_SERVICES_JSON sets the services json file for Farside to use This partially addresses the move towards de-listing Cloudflare instances by default by allowing different services json files to be used with different redis servers. See #43 --- config/config.exs | 3 --- config/runtime.exs | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 config/runtime.exs (limited to 'config') diff --git a/config/config.exs b/config/config.exs index d1ec18d..11f61d9 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,13 +1,10 @@ import Config config :farside, - port: 4001, - redis_conn: "redis://localhost:6379", update_file: ".update-results", service_prefix: "service-", fallback_suffix: "-fallback", previous_suffix: "-previous", - services_json: "services.json", index: "index.eex", route: "route.eex", headers: [ diff --git a/config/runtime.exs b/config/runtime.exs new file mode 100644 index 0000000..e4491ff --- /dev/null +++ b/config/runtime.exs @@ -0,0 +1,6 @@ +import Config + +config :farside, + port: System.get_env("FARSIDE_PORT", "4001"), + redis_conn: "redis://localhost:#{System.get_env("FARSIDE_REDIS_PORT", "6379")}", + services_json: System.get_env("FARSIDE_SERVICES_JSON", "services.json") -- cgit v1.2.3