Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There doesn't appear to be a way to specify an empty string in the .conf file #153

Open
rlipscombe opened this issue May 14, 2014 · 3 comments

Comments

@rlipscombe
Copy link

I have a mapping:

{mapping, "db.password", "foo.bar.primary.db.password", []}.

In my foo.conf file, if I want to use a blank password, I try the following:

db.password = 

I get the following error:

escript: exception error: no function clause matching 
                 lists:unzip({[{["nodename"],"foo"},
                               {["distributed_cookie"],"foo"},
                               {["audit","root"],"/tmp"},
                               {["db","hostname"],
                                "localhost"},
                               {["db","database"],
                                "foo"},
                               {["db","username"],
                                "meh"}],
                              <<"db.password =\n">>,
                              {{line,12},{column,1}}},
                             [],[]) (lists.erl, line 387)
  in function  cuttlefish_conf:file/1 (src/cuttlefish_conf.erl, line 71)
  in call from cuttlefish_conf:'-files/1-fun-1-'/2 (src/cuttlefish_conf.erl, line 45)
  in call from lists:foldl/3 (lists.erl, line 1248)
  in call from cuttlefish_conf:files/1 (src/cuttlefish_conf.erl, line 43)
  in call from cuttlefish_escript:load_conf/1 (src/cuttlefish_escript.erl, line 307)
  in call from cuttlefish_escript:engage_cuttlefish/1 (src/cuttlefish_escript.erl, line 360)
  in call from cuttlefish_escript:generate/1 (src/cuttlefish_escript.erl, line 259)
@seancribbs seancribbs added this to the 2.1 milestone May 14, 2014
@seancribbs
Copy link
Contributor

That happens because the result of the parse is not checked strictly. conf_parse:file/1 returns list() on success and {list(), binary(), {{line,pos_integer()},{column,pos_integer()}}} on incomplete parse.

Assigning to 2.1 milestone, if necessary we can move it up.

@seancribbs
Copy link
Contributor

Sorry, more to the point - I doubt the "empty string" will be a valid RHS in this format, ever. It would be better to define an atom value, or other setting that disables the password. Also, if you don't have a default for the setting, it will remain unset.

In your schema example, this is the case. The user need only omit the setting from the conf file for the password to be empty/unset.

@seancribbs
Copy link
Contributor

Another possibility would be to interpret the empty 'string' "" in a translation, but that also feels like a hack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants