Skip to content

Commit

Permalink
store conf in ets
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Jun 29, 2008
1 parent a7b0318 commit c150ade
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions elibs/conf.erl
Expand Up @@ -2,7 +2,7 @@
-export([read_conf/1, eval_erlang_expr/1, eval_erlang_expr/2, concat/2, namespace3/1]).

read_conf(Conf) ->
DB = ets:new(db, [set]),
DB = ets:new(db, [set, named_table]),
{ok, DataBinary} = file:read_file(Conf),
DataString = binary_to_list(DataBinary),
Lines = string:tokens(DataString, "\n"),
Expand All @@ -12,7 +12,8 @@ read_conf(Conf) ->

parse_conf_line(Line, DB) ->
[Host, Regex, Transform] = string:tokens(Line, "\t"),
ets:insert(DB, {Host, {Regex, Transform}}).
ets:insert(DB, {Host, {Regex, Transform}}),
io:format("~p~n", [ets:lookup(db, Host)]).

eval_erlang_expr(Expr) ->
eval_erlang_expr(Expr, []).
Expand Down

0 comments on commit c150ade

Please sign in to comment.