Deployment tools?

Hal Snyder hal@REDACTED
Tue Oct 26 23:36:07 CEST 2004

"Martin J. Logan" <mlogan@REDACTED> writes:

> <snip>
>> 	2) Dynamic reconfiguration.
> This one is not as simple as it seems. First of all your code must be
> written in such a manner as to allow a altered config to make its way
> into process state. 
> cant have
> init() -> 
>     Blah = application:get_env(blah, blah),
>     {ok, #state{blah = blah}}.
> but instead you must use get_env everywhere blah is referenced or have a
> clean way of HUPing the processes to re-read config and update state.
> Whatever way you choose it sill necessitate some stylistic changes.
> The solution that a few colleagues and I came up with was to wrap
> configuration with another api and include that api as part of a generic
> services application included in every release.
> <wrapper>:get_env(Application,  Key, DefaultValue)

You could also base things on e.g. the approach Joe offers for a
universal Client - Server with hot code swapping at, page 20.

server(Fun, Data) ->
    {new_fun, Fun1} ->
      server(Fun1, Data);
    {rpc, From, ReplyAs, Q} ->
      {Reply, Data1} = Fun(Q, Data),
      From ! {ReplyAs, Reply},
      server(Fun, Data1) end.

rpc(A, B) ->
  Tag = new_ref(),
  A ! {rpc, self(), Tag, B},
    {Tag, Val} -> Val

More information about the erlang-questions mailing list