Skip to content
This repository
Newer
Older
100644 137 lines (118 sloc) 3.994 kb
21abc5ba »
2002-02-11 Initial revision
1 %%%----------------------------------------------------------------------
2 %%% File : yaws_sup.erl
3 %%% Author : Claes Wikstrom <klacke@bluetail.com>
4 %%% Purpose :
5 %%% Created : 16 Jan 2002 by Claes Wikstrom <klacke@bluetail.com>
6 %%%----------------------------------------------------------------------
7
8 -module(yaws_sup).
9 -author('klacke@bluetail.com').
31fdaae8 »
2006-02-14 pam cleanup, add env record, yaws_ls enhancements by doccarcass@gmail…
10 -include("../include/yaws.hrl").
21abc5ba »
2002-02-11 Initial revision
11
12 -behaviour(supervisor).
13
14 %% External exports
15 -export([start_link/0]).
16
17 %% supervisor callbacks
18 -export([init/1]).
96243974 »
2004-06-04 patch from Fredrik Linder to make it easier to integrate yaws into ap…
19 -export([get_app_args/0]).
20
21 -import(lists, [member/2]).
21abc5ba »
2002-02-11 Initial revision
22
23 %%%----------------------------------------------------------------------
24 %%% API
25 %%%----------------------------------------------------------------------
26 start_link() ->
27 supervisor:start_link({local, ?MODULE}, ?MODULE, []).
28
29 %%%----------------------------------------------------------------------
30 %%% Callback functions from supervisor
31 %%%----------------------------------------------------------------------
32
33 %%----------------------------------------------------------------------
34 %%----------------------------------------------------------------------
35 init([]) ->
80771c86 »
2002-09-17 cache_refresh to 0 if debug, added a cookie_session-server for persis…
36
37 Sess = {yaws_session_server, {yaws_session_server, start_link, []},
38 permanent, 5000, worker, [yaws_session_server]},
39
21abc5ba »
2002-02-11 Initial revision
40 YawsLog = {yaws_log, {yaws_log, start_link, []},
41 permanent, 5000, worker, [yaws_log]},
42
96243974 »
2004-06-04 patch from Fredrik Linder to make it easier to integrate yaws into ap…
43 YawsServArgs = [get_app_args()],
44 YawsServ = {yaws_server, {yaws_server, start_link, YawsServArgs},
21abc5ba »
2002-02-11 Initial revision
45 permanent, 5000, worker, [yaws_server]},
46
fbf6580a »
2004-12-20 Yaws is now RSS capable, see doc/README.rss
47 YawsRSS = {yaws_rss, {yaws_rss, start_link, []},
48 permanent, 5000, worker, [yaws_rss]},
49
eb763b9a »
2006-02-14 *** empty log message ***
50 {ok,{{one_for_all,0,300}, [YawsLog, YawsRSS, YawsServ, Sess]}}.
96243974 »
2004-06-04 patch from Fredrik Linder to make it easier to integrate yaws into ap…
51
52 %%----------------------------------------------------------------------
53 %%----------------------------------------------------------------------
54 get_app_args() ->
55 AS=init:get_arguments(),
56 Debug = case application:get_env(yaws, debug) of
57 undefined ->
58 member({yaws, ["debug"]}, AS);
59 {ok, Val} ->
60 Val
61 end,
62 Trace = case application:get_env(yaws, trace) of
63 undefined ->
64 case {member({yaws, ["trace", "http"]}, AS),
65 member({yaws, ["trace", "traffic"]}, AS)} of
66 {true, _} ->
67 {true, http};
68 {_, true} ->
69 {true, traffic};
70 _ ->
71 false
72 end;
73 {ok, http} ->
74 {true, http};
75 {ok, traffic} ->
76 {true, traffic};
77 _ ->
78 false
79 end,
80 TraceOutput = case application:get_env(yaws, traceoutput) of
81 undefined ->
bb9f1fff »
2005-04-12 better looking debug printouts + dont overwrite trace_to_tty (-x comm…
82 member({yaws, ["traceoutput"]}, AS);
96243974 »
2004-06-04 patch from Fredrik Linder to make it easier to integrate yaws into ap…
83 {ok, Val3} ->
84 Val3
85 end,
86 Conf = case application:get_env(yaws, conf) of
87 undefined ->
88 find_c(AS);
89 {ok, File} ->
90 {file, File}
91 end,
92 RunMod = case application:get_env(yaws, runmod) of
93 undefined ->
94 find_runmod(AS);
95 {ok,Mod} ->
96 {ok,Mod}
97 end,
98 Embedded = case application:get_env(yaws, embedded) of
99 undefined ->
100 false;
101 {ok, Emb} ->
102 Emb
103 end,
92bafb48 »
2006-03-09 removed the ability change userid, also stopped writing to /tmp/yaws …
104 Id = case application:get_env(yaws, id) of
105 undefined ->
106 undefined;
107 {ok, Id0} ->
108 Id0
109 end,
110
31fdaae8 »
2006-02-14 pam cleanup, add env record, yaws_ls enhancements by doccarcass@gmail…
111 #env{debug = Debug, trace = Trace,
112 traceoutput = TraceOutput, conf = Conf,
92bafb48 »
2006-03-09 removed the ability change userid, also stopped writing to /tmp/yaws …
113 runmod = RunMod, embedded = Embedded, id = Id}.
96243974 »
2004-06-04 patch from Fredrik Linder to make it easier to integrate yaws into ap…
114
115 %%----------------------------------------------------------------------
116 %%----------------------------------------------------------------------
117 find_c([{conf, [File]} |_]) ->
118 {file, File};
119 find_c([_|T]) ->
120 find_c(T);
121 find_c([]) ->
122 false.
123
124 %%----------------------------------------------------------------------
125 %%----------------------------------------------------------------------
126 find_runmod([{runmod, [Mod]} |_]) ->
127 {ok,l2a(Mod)};
128 find_runmod([_|T]) ->
129 find_runmod(T);
130 find_runmod([]) ->
131 false.
132
133 %%----------------------------------------------------------------------
134 %%----------------------------------------------------------------------
135 l2a(L) when list(L) -> list_to_atom(L);
136 l2a(A) when atom(A) -> A.
Something went wrong with that request. Please try again.