Permalink
Browse files

added mnesia_dir support to the gconf record as per patch BY Richard …

…Bucker

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@1248 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent 3c75160 commit d508b5231382389d09671f8a054d90921001fc29 @klacke committed May 19, 2008
Showing with 25 additions and 0 deletions.
  1. +1 −0 include/yaws.hrl
  2. +2 −0 src/yaws.erl
  3. +11 −0 src/yaws_config.erl
  4. +9 −0 src/yaws_server.erl
  5. +1 −0 www/embed.yaws
  6. +1 −0 www/internals.yaws
View
1 include/yaws.hrl
@@ -83,6 +83,7 @@
max_num_cached_bytes = 1000000, %% 1 MEG
max_size_cached_file = 8000,
large_file_chunk_size = 10240,
+ mnesia_dir = [],
log_wrap_size = 10000000, % wrap logs after 10M
cache_refresh_secs = 30, % seconds (auto zero when debug)
include_dir = [], %% list of inc dirs for .yaws files
View
2 src/yaws.erl
@@ -195,6 +195,8 @@ setup_gconf(GL, GC) ->
GC#gconf.log_wrap_size),
cache_refresh_secs = lkup(cache_refresh_secs, GL,
GC#gconf.cache_refresh_secs),
+ mnesia_dir = lkup(mnesia_dir, GL,
+ GC#gconf.mnesia_dir),
include_dir = lkup(include_dir, GL,
GC#gconf.include_dir),
phpexe = lkup(phpexe, GL,
View
11 src/yaws_config.erl
@@ -479,6 +479,17 @@ fload(FD, globals, GC, C, Cs, Lno, Chars) ->
{error, ?F("Expect directory at line ~w", [Lno])}
end;
+ ["mnesia_dir", '=', Mnesiadir] ->
+ Dir = filename:absname(Mnesiadir),
+ case is_dir(Dir) of
+ true ->
+ put(mnesiadir, Dir),
+ fload(FD, globals, GC#gconf{mnesia_dir = Dir},
+ C, Cs, Lno+1, Next);
+ false ->
+ {error, ?F("Expect directory at line ~w", [Lno])}
+ end;
+
["tmpdir", '=', _TmpDir] ->
%% ignore
error_logger:format(
View
9 src/yaws_server.erl
@@ -161,6 +161,15 @@ init(Env) -> %% #env{Trace, TraceOut, Conf, RunMod, Embedded, Id}) ->
init2(GC, Sconfs, RunMod, Embedded, FirstTime) ->
put(gc, GC),
+ case GC#gconf.mnesia_dir of
+ MD when length(MD) > 0 ->
+ yaws_debug:format("loading mnesia ~p~n", [MD]),
+ application:set_env(mnesia,dir,MD),
+ mnesia:start();
+ _ ->
+ yaws_debug:format("mnesia not in yaws.conf ~n", []),
+ ok
+ end,
foreach(
fun(D) ->
yaws_debug:format("Add path ~p~n", [D]),
View
1 www/embed.yaws
@@ -64,6 +64,7 @@ out(A) ->
default_type = "text/html",
timeout = 30000,
include_dir = [],
+ mnesia_dir = [],
yaws, %% server string
username, %% maybe run as a different user than root
uid %% unix uid of user that started yaws
View
1 www/internals.yaws
@@ -163,6 +163,7 @@ out(A) ->
max_num_cached_bytes = 1000000, %% 1 MEG
max_size_cached_file = 8000,
large_file_chunk_size = 10240,
+ mnesia_dir = [],
log_wrap_size = 1000000, % wrap logs after 1M
cache_refresh_secs = 30, % seconds (auto zero when debug)
include_dir = [], %% list of inc dirs for .yaws files

0 comments on commit d508b52

Please sign in to comment.