diff options
author | Josef Gustafsson <josef.gson@gmail.com> | 2015-09-04 12:18:19 +0200 |
---|---|---|
committer | Josef Gustafsson <josef.gson@gmail.com> | 2015-09-04 12:18:19 +0200 |
commit | d1a2f978fb626c904fb1278c792d992ec4563acf (patch) | |
tree | e0ae1a38f9d4fc4c14b433222bff70e64bb1ac83 /src/catlfish_sup.erl | |
parent | 4596485adffb636c014362bc982ee0b952c77f26 (diff) |
stripping away everything except what is necessary for nagiosnagios
Diffstat (limited to 'src/catlfish_sup.erl')
-rw-r--r-- | src/catlfish_sup.erl | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/catlfish_sup.erl b/src/catlfish_sup.erl deleted file mode 100644 index 353b691..0000000 --- a/src/catlfish_sup.erl +++ /dev/null @@ -1,53 +0,0 @@ -%%% Copyright (c) 2014-2015, NORDUnet A/S. -%%% See LICENSE for licensing information. - --module(catlfish_sup). --behaviour(supervisor). - --export([start_link/1, init/1]). - -start_link(_Args) -> - supervisor:start_link({local, ?MODULE}, ?MODULE, []). - -permanent_worker(Name, {Module, Function, Args}) -> - permanent_worker(Name, {Module, Function, Args}, [Module]). - -permanent_worker(Name, StartFunc, Modules) -> - {Name, - StartFunc, - permanent, - 10000, - worker, Modules}. - -gen_http_config(Config, SSLOptions, SSLFlag) -> - {ChildName, IpAddress, Port, Module} = Config, - {ok, IPv4Address} = - inet:parse_ipv4strict_address(IpAddress), - WebConfig = [{ip, IPv4Address}, - {port, Port}, - {ssl, SSLFlag}, - {acceptor_pool_size, application:get_env(catlfish, http_server_pool_size, 16)}, - {ssl_opts, SSLOptions} - ], - {ChildName, - {catlfish_web, start, [WebConfig, Module, ChildName]}, - permanent, 5000, - worker, dynamic}. - -init([]) -> - SSLOptions = - [{certfile, application:get_env(catlfish, https_certfile, none)}, - {keyfile, application:get_env(catlfish, https_keyfile, none)}, - {cacertfile, application:get_env(catlfish, https_cacertfile, none)}], - Servers = - lists:map(fun (Config) -> - gen_http_config(Config, SSLOptions, true) - end, application:get_env(catlfish, https_servers, [])) ++ - lists:map(fun (Config) -> - gen_http_config(Config, SSLOptions, false) - end, application:get_env(catlfish, http_servers, [])), - lager:debug("Starting servers ~p", [Servers]), - RateLimit = permanent_worker(ratelimit, {ratelimit, start_link, []}), - {ok, - {{one_for_one, 3, 10}, - [RateLimit | Servers]}}. |