|
Guest
|
Hi all, a few weeks ago I pushed some Yaws changes to allow for better
embedded mode startup. The existing approach, the
yaws:start_embedded/1,2,3,4 functions, are still there and still work
the same as before, except that they're now implemented in terms of
the new approach.
The new functions are yaws_api:embedded_start_conf/1,2,3,4. Each
variant takes the same arguments as the yaws:start_embedded/1,2,3,4
functions, but rather than actually starting Yaws, these functions
return:
{ok, SCList, GC, ChildSpecs}
where SCList is a list of #sconf records suitable for passing as the
second argument to yaws_api:setconf/2, GC is a #gconf record suitable
for passing as the first argument to yaws_api:setconf/2, and
ChildSpecs are suitable for starting Yaws under the supervisor of your
choice. The example in the revised documentation is as follows:
Id = "my_server",
GconfList = [{logdir, "/var/log/my_server"},
{ebin_dir, ["/example1/ebin", "/example2/ebin"]},
{id, Id}],
Docroot = "/var/yaws/www",
SconfList = [{docroot, Docroot},
{port, 8080},
{listen, {127,0,0,1}},
{appmods, [{"/", my_appmod}]}],
{ok, SCList, GC, ChildSpecs} =
yaws_api:embedded_start_conf(Docroot, SconfList, GconfList, Id),
%% assume our supervisor is registered as my_sup
[supervisor:start_child(my_sup, Ch) || Ch <- ChildSpecs],
%% now configure Yaws
yaws_api:setconf(GC, SCList),
Note that this approach works well for embedded mode because it allows
you to supervise Yaws as you wish, and it also takes into account
special configurations such as running the SOAP server -- the returned
ChildSpecs will indicate all the parts of Yaws that need to be started
based on the configuration you specify.
If you want to try it out, just grab the latest sources from
github.com and give it a try. All feedback welcomed.
--steve
------------------------------------------------------------------------------
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist |
|
|