Permalink
Browse files

patch from Jimmy Olgeni to handle embedded mode better, no ctl proces…

…s is started for an embedded node

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@690 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent fd79830 commit f0929a29a789df59a01ce9a7be8e81fef272cb75 @klacke committed May 25, 2004
Showing with 30 additions and 12 deletions.
  1. +7 −1 scripts/yaws.conf.template
  2. +23 −11 src/yaws_server.erl
@@ -41,6 +41,12 @@ trace = false
# runmod = mymodule
+# By default yaws will copy the erlang error_log and
+# end write it to a wrap log called report.log (in the logdir)
+# this feature can be turned off. This would typically
+# be the case when yaws runs within another larger app
+
+copy_error_log = true
# If yaws is started as root, it can, once it has opened
@@ -60,7 +66,7 @@ auth_log = true
# host, we need to give each yaws system an individual
# name. Yaws will write a number of runtime files under
# /tmp/yaws/${id}
-#
+# The default value is "default"
# id = myname
View
@@ -116,13 +116,15 @@ get_app_args() ->
{ok,Mod} ->
{ok,Mod}
end,
- Embed = case application:get_env(yaws, embedded) of
- undefined ->
- false;
- {ok, Val0} ->
- Val0
- end,
- {Debug, Trace, TraceOutput, Conf, RunMod, Embed}.
+ {Debug, Trace, TraceOutput, Conf, RunMod}.
+
+get_app_args_embedded() ->
+ case application:get_env(yaws, embedded) of
+ undefined ->
+ false;
+ {ok, Val0} ->
+ Val0
+ end.
find_c([{conf, [File]} |_]) ->
{file, File};
@@ -154,8 +156,8 @@ l2a(A) when atom(A) -> A.
init([]) ->
process_flag(trap_exit, true),
put(start_time, calendar:local_time()), %% for uptime
- {Debug, Trace, TraceOut, Conf, RunMod, Embed} = get_app_args(),
- case Embed of
+ {Debug, Trace, TraceOut, Conf, RunMod} = get_app_args(),
+ case get_app_args_embedded() of
false ->
Config = yaws_config:load(Conf, Trace, TraceOut, Debug),
?Debug("Config= ~p~n", [Config]),
@@ -187,7 +189,9 @@ init([]) ->
end
end;
true ->
- init2(yaws_config:make_default_gconf(Debug), [], undef, true)
+ {ok, #state{gc = undefined,
+ pairs = [],
+ mnum = 0}}
end.
@@ -202,8 +206,16 @@ init2(GC, Sconfs, RunMod, FirstTime) ->
"Running with debug checks turned on (slower server) ~n"
"Logging to directory ~p~n",
[GC#gconf.id, GC#gconf.logdir]),
+
setup_dirs(GC),
- yaws_ctl:start(GC, FirstTime),
+
+ case get_app_args_embedded() of
+ false ->
+ yaws_ctl:start(GC, FirstTime);
+ true ->
+ ok
+ end,
+
runmod(RunMod, GC),
%% start the individual gserv server processes

0 comments on commit f0929a2

Please sign in to comment.