anchor.diff:      lager:debug("Init: config = ~p", [?ALLCONFIG]),
       ok.
   
  +%% @doc enforces WaTTS to run in a secure setting.
  +%% This includes running as non root user and having SSL configured.
  +%% If SSL is not configured it will be forced to localhost.
  +%% @see maybe_change_hostname/3
  +%% @see error_if_running_as_root/0
  +-spec enforce_security() -> ok.
   enforce_security() ->
       SSL = ?CONFIG(ssl),
       Hostname0 = ?CONFIG(hostname),
  
positive.code:     ok = error_if_running_as_root(),
      ok.
  
  maybe_change_hostname(false, false, _) ->
      H = "localhost",
      lager:warning("Init: Neither SSL nor Tor is configured; "
  
negative.code: maybe_change_hostname(_, _, Hostname) ->
      Hostname.
  
  %% @doc ensure WaTTS is not running as root.
  %% if it is running as root the VM gets stopped.
  %% @see maybe_root_halt/2
  -spec error_if_running_as_root() -> ok.
  error_if_running_as_root() ->
      Uid = list_to_integer(remove_newline(os:cmd("id -u"))),
      User = remove_newline(os:cmd("id -un")),
      ok = maybe_root_halt(User, Uid).
  
  %% @doc halt the VM if uid is 0 or user is 'root'.
  -spec maybe_root_halt(User :: list(), Uid :: number()) -> ok.
  maybe_root_halt(User, Uid) when User == "root"; Uid == 0 ->
      lager:critical("Init: do not run WaTTS as root, stopping"),
      erlang:halt(1);
  maybe_root_halt(User, Uid) ->
      lager:info("Init: running as user ~p [~p]", [User, Uid]),
      ok.
  
  %% @doc start the databases needed to run WaTTS.
  %% The in ram database is started using watts_data and the
  %% configured persistent database is started with watts_persistent.
  %% @see watts_data:init/0
  %% @see watts_persistent:init/0
  -spec start_database() -> ok.
  start_database() ->
      lager:info("Init: starting ets database"),
      ok = watts_data:init(),
  