diff --git a/src/autocluster_consul.erl b/src/autocluster_consul.erl index 3ecbb5b..3eea08e 100644 --- a/src/autocluster_consul.erl +++ b/src/autocluster_consul.erl @@ -187,7 +187,12 @@ host_sname(Value) -> Parts = string:tokens(binary_to_list(Value), "."), case length(Parts) of 1 -> binary_to_list(Value); - _ -> binary_to_list(lists:nth(1, Parts)) + _ -> + SName = lists:nth(1, Parts), + case is_list(SName) of + true -> SName; + false -> binary_to_list(SName) + end end.