From 313eacd26062ce24452c569a68925fa4a317c9b4 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Mon, 28 Jul 2008 12:41:06 -0400 Subject: Don't pass in DB connection params on CLI, but do it after process has spawned. This is done when the port initializes, so it will work automagically when the binary dies and can be restarted by the port supervisor. --- src/mysqlerl_port_sup.erl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/mysqlerl_port_sup.erl') diff --git a/src/mysqlerl_port_sup.erl b/src/mysqlerl_port_sup.erl index 820f929..3053cdc 100644 --- a/src/mysqlerl_port_sup.erl +++ b/src/mysqlerl_port_sup.erl @@ -3,14 +3,16 @@ -behavior(supervisor). --export([start_link/1]). +-export([start_link/7]). -export([init/1]). -start_link(Cmd) -> - supervisor:start_link(?MODULE, [Cmd]). +start_link(Cmd, Host, Port, Database, User, Password, Options) -> + supervisor:start_link(?MODULE, [Cmd, Host, Port, Database, + User, Password, Options]). -init([Cmd]) -> - Port = {mysqlerl_port, {mysqlerl_port, start_link, [Cmd]}, +init([Cmd, Host, Port, Database, User, Password, Options]) -> + Ref = {mysqlerl_port, {mysqlerl_port, start_link, + [Cmd, Host, Port, Database, + User, Password, Options]}, transient, 5, worker, [mysqlerl_port]}, - {ok, {{one_for_one, 10, 5}, - [Port]}}. + {ok, {{one_for_one, 10, 5}, [Ref]}}. -- cgit v1.2.3