Wednesday, September 06, 2006

Starting Yaws in embedded mode

I have comitted some new functions to make it really
easy to start Yaws in embedded mode from your own
system. This way, it is not necessary to specify any
-yaws switch to the Erlang start script or to include
the yaws.hrl file to access the sconf/gconf records of Yaws.


The minimal information you need to specify is the 'DocRoot',
i.e the location where your .html and .yaws files lives.
All other configuration parameters will get the same default
values as defined in yaws.hrl.


It is also possible to override any of the parameter in the
sconf/gconf records if you so wish. See examples of the three
ways of invoking the new functions yaws:start_embedded/1,2,3 below:


DocRoot = "/home/tobbe/docroot",
GL=[{trace,false},{tmpdir,local_path(["priv", "tmp"]),
{flags,[{auth_log,false},{copy_errlog,false}]}],
SL=[{port,Port},{appmods,AppMods},
{flags,[{access_log,false}]}],

yaws:start_embedded(DocRoot). % alternative 1.

yaws:start_embedded{DocRoot, SL). % alternative 2.

yaws:start_embedded{DocRoot, SL, GL). % alternative 3.

0 Comments:

Post a Comment

<< Home