KirinDave / fuzed

A new revision of Fuzed, the Erlang-based frontend for web apps. Check out the mailing list at http://groups.google.com/group/fuzed

This URL has Read+Write access

fuzed / elibs / frontend_yaws.erl
22c98aab » KirinDave 2008-05-04 More work on getting the fr... 1 -module(frontend_yaws).
2 -compile(export_all).
3 -include("../include/yaws/yaws.hrl").
4
5
6 test() ->
7 ModuleFilePath = code:which(?MODULE),
8 DirPath = filename:dirname(ModuleFilePath),
9 yaws_begin_server(yaws_global_configs(9001, DirPath ++ "/../web")).
10
11 setup(Port, DocRoot) ->
12 yaws_begin_server(yaws_global_configs(Port, DocRoot)).
13
14 yaws_global_configs(Port, DocRoot) ->
15 Y = yaws_config:yaws_dir(),
16 GC = #gconf{yaws_dir = Y,
17 ebin_dir = [],
18 include_dir = [],
19 trace = false,
20 logdir = "./log",
21 cache_refresh_secs = 30,
22 flags = ?GC_AUTH_LOG bor
23 ?GC_COPY_ERRLOG bor
24 ?GC_FAIL_ON_BIND_ERR bor
25 ?GC_PICK_FIRST_VIRTHOST_ON_NOMATCH,
26 tmpdir = yaws_config:default_tmp_dir(),
27 yaws = "Yaws " ++ yaws_generated:version(),
28 id = genericID
29 },
30 SC = #sconf{port = Port,
31 servername = "xle_responder",
32 listen = {0,0,0,0},
33 docroot = DocRoot,
34 errormod_404 = frontend_responder,
35 appmods = []},
36 {GC,SC}.
37
38 yaws_begin_server({GC,SC}) ->
39 application:set_env(yaws, embedded, true),
40 application:start(yaws),
41 yaws_api:setconf(GC, [[SC]]).