Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  more stuff for embedded startup

tobbe
Posted: Thu Dec 14, 2006 10:58 pm Reply with quote
User Joined: 19 Jan 2005 Posts: 274 Location: Stockholm, Sweden
I've added a function yaws:add_server(DocRoot, SconfKeyValueList) which
makes it possible to add new server's on the fly. So it can be used as
in the example below:
---------------------------------------------------
start_yaws(SrvName, Port, Listen) ->
PrivDir = priv_dir(),
DocRoot = filename:join([PrivDir, "docroot"]),
GL = [{trace, {true, http}}, % false | {true, http} | {true, traffic}
{tmpdir,"/tmp"},
{logdir,"/tmp"},
{enable_soap, true},
{flags,[{auth_log,true},
{tty_trace, true},
{debug, true},
{copy_errlog, true}]}],
SL = [{port, Port},
{servername, SrvName},
{listen, Listen},
{dir_listings, true},
{flags,[{access_log,false}]}],
yaws:start_embedded(DocRoot, SL, GL),
Keyfile = filename:join([PrivDir, "cert", "privkey.pem"]),
Certfile = filename:join([PrivDir, "cert", "cert.pem"]),
Ssl = yaws:ssl_certfile(yaws:ssl_keyfile(yaws:new_ssl(), Keyfile), Certfile),
SL2 = [{port, ?YAWS_SSL_PORT},
{servername, SrvName},
{listen, Listen},
{ssl, Ssl},
{dir_listings, true},
{flags,[{access_log,false}]}],
yaws:add_server(DocRoot, SL2).
-----------------------------------------------------

Also, note the new access functions for manipulating the #ssl{} record.
There is yaws:new_ssl/0 which returns a #ssl{} record and then two
functions for each field in the record: one to get the value, and one
for setting the value. For example:

yaws:ssl_keyfile(S) % returns S#ssl.keyfile
yaws:ssl_keyfile(S, Keyfile) % returns S#ssl{keyfile = Keyfile}

It is all in CVS.

Cheers, Tobbe


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message Send e-mail Visit poster's website

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum