basho / cuttlefish

never lose your childlike sense of wonder baby cuttlefish, promise me?
Apache License 2.0
205 stars 124 forks source link

Example for translating a list of configs is not working correctly #113

Closed DBarney closed 10 years ago

DBarney commented 10 years ago

So I'm trying to follow the instructions on https://github.com/basho/cuttlefish/wiki/Cuttlefish-for-Erlang-Developers#wiki-lists-and-proplists-and-names-oh-my, the only problem is that they don't work.

I'm using cuttlefish at version 0.1.0, and I have also tried using the head of the master branch and I get the same results from both.

so this:

%% HTTP Listeners
%% @doc listener.http.<name> is an IP address and TCP port that the Riak
%% HTTP interface will bind.
{mapping, "listener.http.$name", "riak_api.http", [
  {default, {"127.0.0.1", 8098}},
  {datatype, ip},
  {include_default, "internal"}
]}.

{translation,
 "riak_api.http",
  fun(Conf) ->
      HTTP = cuttlefish_variable:filter_by_prefix("listener.http", Conf),
      [ IP || {_, IP} <- HTTP]
  end
}.

and this:

listener.http.internal = 127.0.0.1:8098
listener.http.external = 10.0.0.1:80

generate this:

{riak_api,[{http,ok}]},

which is not quite what I was hoping that the translation and mapping would do.

Is this a feature that has been removed? or just implemented differently?

DBarney commented 10 years ago

Ok so it looks like the wiki is wrong, I looked at some of tests and they are implemented differently

I have updated to wiki to reflect the most recent changes, at least in the area I was following.