What is the syntax for the configuration file when you start an httpd server like this:
inets:start(httpd,
[{proplist_file, "./server_config.txt"}]
).
The httpd docs say:
{proplist_file, path()}
If this property is defined, Inets expects to find all other properties defined in this file.
And:
the properties are to be fetched from a configuration file that can consist of a regular Erlang property list
But with this file:
server_config.txt:
[
{port, 0},
{server_name, "httpd_test"},
{server_root, "/Users/7stud/erlang_programs/inets_proj"},
{document_root, "/Users/7stud/erlang_programs/inets_proj/htdocs"},
{ipfamily, inet6},
{ bind_address, {0,0,0,0,0,0,0,1} }
]
I get the error:
$ erl
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V8.2 (abort with ^G)
1> inets:start().
ok
2> inets:start(httpd, [{proplist_file, "/Users/7stud/erlang_programs/inets_proj/server_config.txt"}]).
** exception error: no try clause matching {error,{8,erl_parse,["syntax error before: ",[]]}}
in function httpd_sup:httpd_config/1 (httpd_sup.erl, line 144)
in call from httpd_sup:start_child/1 (httpd_sup.erl, line 52)
in call from inets:call_service/3 (inets.erl, line 461)
Next, I tried the Apache syntax, and that didn't work either:
server_config.txt:
Port 0
ServerName "httpd_test"
ServerRoot "/Users/7stud/erlang_programs/inets_proj"
DocumentRoot "./htdocs"
Ipfamily inet6
BindAddress {0,0,0,0,0,0,0,1}
3> inets:start(httpd, [{file, "./server_config.txt"}]).
{error,"httpd_conf: \"/Users/7stud/erlang_programs/inets_proj\" is an invalid ServerRoot"}
4>
Okay, I made some progress on the Apache style syntax by getting rid of the quotes:
Port 0
ServerName httpd_test
ServerRoot /Users/7stud/erlang_programs/inets_proj
DocumentRoot ./htdocs
Ipfamily inet6
BindAddress 0:0:0:0:0:0:0:1
Now, I get the error:
8> inets:start(httpd, [{file, "./server_config.txt"}]).
{error,"httpd_conf: 0:0:0:0:0:0:0:1 is an invalid address"}