diff --git a/.erlang b/.erlang new file mode 100644 index 0000000..8bf8ec0 --- /dev/null +++ b/.erlang @@ -0,0 +1,11 @@ + application:start(compiler). + application:start(syntax_tools). + application:start(goldrush). + application:start(lager). + +%% application:start(crypto). +%% ssl:start(). + +application:start(kolab_guam). + + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ecfa497 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +REBAR = $(shell which rebar || echo ./rebar) +ENABLE_STATIC = no + +all: deps-up guam + +deps: + rebar get-deps + +deps-up: deps + rebar update-deps + +guam: + ENABLE_STATIC=no rebar compile + +run: + erl -pa apps/*/ebin deps/*/ebin -config app -s kolab_guam diff --git a/app.config b/app.config index 2718752..f6199dc 100644 --- a/app.config +++ b/app.config @@ -1,31 +1,31 @@ %% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*- [ -{ guam, +{ kolab_guam, [ { imap_server, [ { default, [ { host, "192.168.56.101" }, { port, 993 }, { tls, true } ] - }, + } ] }, { listeners, [ ] } ] }, { lager, [ { handlers, [ { lager_console_backend, info }, { lager_file_backend, [ { file, "log/error.log"}, { level, error } ] }, { lager_file_backend, [ { file, "log/console.log"}, { level, info } ] } ] } ] } ]. diff --git a/apps/kolab_guam/src/kolab_guam.app.src b/apps/kolab_guam/src/kolab_guam.app.src new file mode 100644 index 0000000..3184297 --- /dev/null +++ b/apps/kolab_guam/src/kolab_guam.app.src @@ -0,0 +1,20 @@ +%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*- +{application, kolab_guam, + [ + {description, "IMAP session proxy"}, + {vsn, "0.1"}, + {registered, []}, + {applications, [ + kernel, + stdlib, + crypto, + ssl, + compiler, + syntax_tools, + goldrush, + lager + ]}, + {mod, { kolab_guam, []}}, + {env, [ + ]} + ]}. diff --git a/apps/kolab_guam/src/kolab_guam.erl b/apps/kolab_guam/src/kolab_guam.erl new file mode 100644 index 0000000..75dac0b --- /dev/null +++ b/apps/kolab_guam/src/kolab_guam.erl @@ -0,0 +1,37 @@ +%% Copyright 2014 Kolab Systems AG (http://www.kolabsys.com) +%% +%% Aaron Seigo (Kolab Systems) +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see . + +-module(kolab_guam). + +-behaviour(application). + +%% Application callbacks +-export([start/0, start/2, stop/1]). + +start() -> application:start(kolab_guam). + +%% =================================================================== +%% Application callbacks +%% =================================================================== + +start(_StartType, _StartArgs) -> + lager:info("Starting Kolab Guam IMAP session proxy ..."), + lager:info(" Starting the main supervisor ..."), + kolab_guam_sup:start_link(). + +stop(_State) -> + ok. diff --git a/apps/kolab_guam/src/kolab_guam_sup.erl b/apps/kolab_guam/src/kolab_guam_sup.erl new file mode 100644 index 0000000..a09c264 --- /dev/null +++ b/apps/kolab_guam/src/kolab_guam_sup.erl @@ -0,0 +1,48 @@ +%% Copyright 2014 Kolab Systems AG (http://www.kolabsys.com) +%% +%% Aaron Seigo (Kolab Systems) +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see . + +-module(kolab_guam_sup). + +-behaviour(supervisor). + +%% API +-export([start_link/0]). + +%% Supervisor callbacks +-export([init/1]). + +%% Helper macro for declaring children of supervisor +-define(CHILD(Module, Type), { Module, { Module, start_link, []}, permanent, 5000, Type, [Module] }). + +%% =================================================================== +%% API functions +%% =================================================================== + +start_link() -> + supervisor:start_link({local, ?MODULE}, ?MODULE, []). + +%% =================================================================== +%% Supervisor callbacks +%% =================================================================== + +init([]) -> + lager:info(" Creating listeners ..."), + Children = [ + %% ?CHILD(kolab_guam_listener, worker), + ], + { ok, { { one_for_one, 5, 10}, Children } }. + diff --git a/rebar.config b/rebar.config new file mode 100644 index 0000000..9f4f9bd --- /dev/null +++ b/rebar.config @@ -0,0 +1,22 @@ +%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% ex: ft=erlang ts=4 sw=4 et + +{deps_dir, "deps"}. +{deps, [ + { lager, ".*", { git, "https://github.com/basho/lager.git", { tag, "2.1.0" } } } + %% pull in the proper version of meck before jobs 0.3 gets around to pulling in the wrong version + ]}. + +{erl_opts, [ %%no_debug_info, + {parse_transform, lager_transform}, + {platform_define, "(linux|solaris|freebsd|darwin)", 'HAVE_SENDFILE'} + ]}. +{sub_dirs, [ + "apps/kolab_guam", + "rel" + ]}. +{erl_opts, [debug_info, fail_on_warning]}. + +%%{require_otp_vsn, "17"}. +{pre_hooks, [{clean, "rm -fr ebin priv erl_crash.dump"}]}. +