开发者

Starting inets/httpd with custom application

I've got a module that I'm attempting to turn into a proper OTP application. Currently, the module has start/0 which starts a genserver which supplies configuration data read from a config file. It then calls inets:start(httpd,config:lookup(httpd_conf)). I gather that I need to move the starting of these out into the .a开发者_如何学Gopp file's (application list) but I'm not sure how to get my config data into the inets:start function (or pass in httpd)?

Thanks, --tim


Here's what I've figured out...

First, I needed to create the inets config file:

inets.config:
      [{inets, [{services, [{httpd, [{proplist_file,
             "8080.conf"}]},
     ].

Then, create the httpd conf file:

8080.conf
[
{modules, [
 mod_alias, 
 mod_auth, 
 mod_esi, 
 mod_actions, 
 mod_cgi, 
 mod_dir, 
 mod_get, 
 mod_head, 
 mod_log, 
 mod_disk_log
]},
{port,8080},
{server_name,"hello_world"},
{server_root,"log"},
{document_root,"www"},
{erl_script_alias, {"/erl", [hello_world]}},
{error_log, "error.log"},
{security_log, "security.log"},
{transfer_log, "transfer.log"},
{mime_types,[
{"html","text/html"},
 {"css","text/css"},
{"js","application/x-javascript"}
]}
]

Now, when booting my app, I just reference the inets.conf file with:

$ erl -boot start_sasl -pa ebin -config inets.config

This seems to work not sure if it's the "right" way or not...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜