diff options
-rw-r--r-- | Emakefile | 3 | ||||
-rw-r--r-- | README | 13 | ||||
-rw-r--r-- | ebin/plop.app | 9 | ||||
-rw-r--r-- | include/plop.hrl (renamed from src/plop.hrl) | 0 | ||||
-rw-r--r-- | src/db.erl | 1 | ||||
-rw-r--r-- | src/plop.erl | 4 | ||||
-rw-r--r-- | src/plop_app.erl | 9 | ||||
-rw-r--r-- | src/plop_sup.erl | 28 |
8 files changed, 65 insertions, 2 deletions
diff --git a/Emakefile b/Emakefile new file mode 100644 index 0000000..8869cf4 --- /dev/null +++ b/Emakefile @@ -0,0 +1,3 @@ +%% erl -make (-*- erlang -*-) +{"src/*", [debug_info, {i, "include/"}, {outdir, "ebin/"}]}. +{"test/*", [debug_info, {i, "include/"}, {outdir, "ebin/"}]}. @@ -3,3 +3,16 @@ implementing Certificate Transparency (RFC 6962). The first implementation is in Erlang. The only interface supported initially is Erlang messages. + + +Compile the application + + $ erl -make + +Start the application locally + + $ erl -boot start_sasl -pa ebin -eval "application:start(plop)." -plop Keyfile "src/test/rsakey.pem" -plop Passphrase "sikrit" + +Test the application + + [FIXME] diff --git a/ebin/plop.app b/ebin/plop.app new file mode 100644 index 0000000..f8d5d2c --- /dev/null +++ b/ebin/plop.app @@ -0,0 +1,9 @@ +%%% Application resource file for plop (in -*- erlang -*- mode). +{application, plop, + [{description, "The plop store"}, + {vsn, "0.0.1"}, + {modules, [plop_app, plop_sup, plop, db, ht, hex]}, + {applications, [kernel, stdlib]}, % crypto, public_key, mnesia + {registered, [plop, db]}, + {mod, {plop_app, []}} % <-- key file and pass phrase + ]}. diff --git a/src/plop.hrl b/include/plop.hrl index 5492024..5492024 100644 --- a/src/plop.hrl +++ b/include/plop.hrl @@ -64,6 +64,7 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}. terminate(_Reason, _State) -> + io:format("~p terminating~n", [?MODULE]), ok. %%%%%%%%%%%%%%%%%%%% diff --git a/src/plop.erl b/src/plop.erl index bee9cb4..6ffc856 100644 --- a/src/plop.erl +++ b/src/plop.erl @@ -31,8 +31,7 @@ hashtree :: ht:head()}). start_link() -> - db:start_link(), - start_link("test/rsakey.pem", "sikrit"). + start_link("src/test/rsakey.pem", "sikrit"). % FIXME: Remove. start_link(Keyfile, Passphrase) -> gen_server:start_link({local, ?MODULE}, ?MODULE, [Keyfile, Passphrase], []). @@ -59,6 +58,7 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}. terminate(_Reason, _State) -> + io:format("~p terminating~n", [?MODULE]), ok. %%%%%%%%%%%%%%%%%%%% diff --git a/src/plop_app.erl b/src/plop_app.erl new file mode 100644 index 0000000..d2e99ac --- /dev/null +++ b/src/plop_app.erl @@ -0,0 +1,9 @@ +-module(plop_app). +-behaviour(application). +-export([start/2, stop/1]). + +start(_Type, Args) -> + plop_sup:start_link(Args). + +stop(_State) -> + ok. diff --git a/src/plop_sup.erl b/src/plop_sup.erl new file mode 100644 index 0000000..18ed926 --- /dev/null +++ b/src/plop_sup.erl @@ -0,0 +1,28 @@ +-module(plop_sup). +-behaviour(supervisor). + +-export([start_link/1, init/1]). +-export([start_in_shell/0]). + +start_link(Args) -> + supervisor:start_link({local, ?MODULE}, ?MODULE, Args). + +%% For testing. +start_in_shell() -> + {ok, Pid} = start_link([]), + unlink(Pid). + +%% Supervisor callback +init(_Args) -> + {ok, {{one_for_one, 3, 10}, + [{the_plop, + {plop, start_link, []}, % Here's where key file name and pass phrase go. + permanent, + 10000, % Shut down in 10s. + worker, [plop]}, + {the_db, + {db, start_link, []}, + permanent, + 10000, + worker, [db]} + ]}}. |