zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

commit e385476a187c751b1ddef20c7608a29055977b8a
parent 0c4ca0f1abd9260f96792b3feaf8edb408a1a301
Author: srfsh <dev@srf.sh>
Date:   Fri, 10 Jun 2022 17:09:07 +0300

conf: split ROOM_ENDPOINT into ROOM_HOST and ROOM_PORT

It is easier to parse, makes more sense, and is more consistent with
the DB_* variables.

Diffstat:
Mconf/.env.templ | 3++-
Mconf/runtime.exs | 14++------------
2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/conf/.env.templ b/conf/.env.templ @@ -10,5 +10,6 @@ #export DB_PORT=5432 ## restroom -#export ROOM_ENDPOINT= +#export ROOM_HOST= +#export ROOM_PORT= export ROOM_SALT=$ROOM_SALT diff --git a/conf/runtime.exs b/conf/runtime.exs @@ -51,21 +51,11 @@ config :zenflows, Zenflows.DB.Repo, db_conf # # restroom # -room_endpoint = - case String.split(fetch_env!("ROOM_ENDPOINT"), ":", parts: 2, trim: true) do - [] -> - raise "ROOM_ENDPOINT must be of the form hostname:port, such as localhost:1234" - [host, port] -> - port = String.to_integer(port) - if port not in 0..65535, - do: raise "ROOM_ENDPOINT must have a port number between 0 and 65535" - "#{host}:#{port}" - end - room_salt = fetch_env!("ROOM_SALT") if Base.decode16!(room_salt, case: :lower) |> byte_size() != 64, do: raise "ROOM_SALT must be a 64-octect long, lowercase-base16-encoded string" config :zenflows, Zenflows.Restroom, - room_endpoint: room_endpoint, + room_host: fetch_env!("ROOM_HOST"), + room_port: fetch_env!("ROOM_PORT"), room_salt: room_salt