Packages

An erlang/elixir SDK for Statsig feature gates and experiments

Current section

Files

Jump to
statsig src statsig_sup.erl
Raw

src/statsig_sup.erl

-module(statsig_sup).
-behaviour(supervisor).
-export([start_link/0]).
-export([init/1, shutdown/0]).
start_link() -> supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
case application:get_env(statsig, statsig_api_key) of
{ok, ApiKey} ->
RestartStrategy = {one_for_one, 10, 60},
Server =
{
stasig_serv,
{statsig_server, start_link, [ApiKey]},
permanent,
infinity,
worker,
[statsig_server]
},
Children = [Server],
{ok, {RestartStrategy, Children}};
Other -> {error, Other}
end.
shutdown() -> exit(whereis(?MODULE), shutdown).