fix: use charlists for etcd endpoints

The :eetcd Erlang library expects charlists, not binary strings.
This was causing a FunctionClauseError in :lists.reverse/1 because
it was receiving a binary string instead of a charlist.

Error:
  (FunctionClauseError) no function clause matching in :lists.reverse/1
  (stdlib 7.2) lists.erl:291: :lists.reverse("etcd-0.etcd...")

Solution:
  Use ~c sigil to convert endpoint strings to charlists for the
  Erlang library to consume correctly.
This commit is contained in:
Graham McIntire 2026-01-24 14:39:53 -06:00
parent a11ff789e3
commit 51736eeec3
No known key found for this signature in database

View file

@ -109,10 +109,11 @@ defmodule Towerops.Monitoring.EtcdCoordinator do
defp connect_etcd do
# Connect to etcd StatefulSet in Kubernetes
# eetcd is an Erlang library and expects charlists, not binary strings
endpoints = [
"etcd-0.etcd.towerops.svc.cluster.local:2379",
"etcd-1.etcd.towerops.svc.cluster.local:2379",
"etcd-2.etcd.towerops.svc.cluster.local:2379"
~c"etcd-0.etcd.towerops.svc.cluster.local:2379",
~c"etcd-1.etcd.towerops.svc.cluster.local:2379",
~c"etcd-2.etcd.towerops.svc.cluster.local:2379"
]
:eetcd.open(:towerops_etcd, endpoints)