anchor.diff:  -define(DEFAULT_WEB_SERVER, cowboy).
   
   -record(state, {
  -        applications = [],
  +        applications	= [],
           service_sup_pid,
           http_pid,
           smtp_pid,
  -        is_master_node = false
  +        is_master_node	= false
       }).
   
   -include("boss_web.hrl").
   
   start_link() ->
  -    start_link([]).
  +    init_master_node().
  +
  +init_master_node() -> start_link([]).
   
   start_link(Config) ->
       gen_server:start_link({local, boss_web}, ?MODULE, Config, []).
  
positive.code:             error_logger:info_msg("Pinging master node ~p from ~p~n", [MasterNode, ThisNode]),
              pong = net_adm:ping(MasterNode)
      end,
  
      MailDriver = boss_env:get_env(mail_driver, boss_mail_driver_smtp),
      boss_mail:start([{driver, MailDriver}]),
  
      {ServerMod, RequestMod, ResponseMod} = case boss_env:get_env(server, ?DEFAULT_WEB_SERVER) of
          mochiweb -> {mochiweb_http, mochiweb_request_bridge, mochiweb_response_bridge};
          cowboy -> {cowboy, mochiweb_request_bridge, mochiweb_response_bridge}
      end,
      SSLEnable = boss_env:get_env(ssl_enable, false),
      SSLOptions = boss_env:get_env(ssl_options, []),
      error_logger:info_msg("SSL:~p~n", [SSLOptions]),
  
      {ok, ServicesSupPid}  = case MasterNode of
  				ThisNode ->
  				    boss_service_sup:start_link();
  				_AnyNode ->
  				    {ok, undefined}
  			    end,
  
      ServerConfig = [{loop, fun(Req) ->
                      ?MODULE:handle_request(Req, RequestMod, ResponseMod)
              end} | Config],
      Pid = case ServerMod of
          mochiweb_http ->
              application:start(mochiweb),
              mochiweb_http:start([{ssl, SSLEnable}, {ssl_opts, SSLOptions} | ServerConfig]);
          cowboy ->
  		  %Dispatch = [{'_', [{'_', boss_mochicow_handler, [{loop, {boss_mochicow_handler, loop}}]}]}],
  		  error_logger:info_msg("Starting cowboy... on ~p~n", [MasterNode]),
  		  application:start(ranch),
  		  application:start(cowboy),
  		  HttpPort = boss_env:get_env(port, 8001),
            AcceptorCount = boss_env:get_env(acceptor_processes, 100),
            case SSLEnable of
                false ->
                    error_logger:info_msg("Starting http listener... on ~p ~n", [HttpPort]),
                    cowboy:start_http(boss_http_listener, AcceptorCount, [{port, HttpPort}], [{env, []}]);
                true ->
                    error_logger:info_msg("Starting https listener... on ~p ~n", [HttpPort]),
                    SSLConfig = [{port, HttpPort}]++SSLOptions,
                    cowboy:start_https(boss_https_listener, AcceptorCount, SSLConfig, [{env, []}])
  		  end,
  		  if
                MasterNode =:= ThisNode ->
                    boss_service_sup:start_services(ServicesSupPid, boss_websocket_router);
                true ->
                    ok
  		  end
  
  	  end,
      {ok, #state{ service_sup_pid = ServicesSupPid, http_pid = Pid, is_master_node = (ThisNode =:= MasterNode) }, 0}.
  
  handle_info(timeout, State) ->
      Applications = boss_env:get_env(applications, []),
      ServicesSupPid = State#state.service_sup_pid,
      AppInfoList = lists:map(fun
              (AppName) ->
                  application:start(AppName),
                  BaseURL = boss_env:get_env(AppName, base_url, "/"),
                  StaticPrefix = boss_env:get_env(AppName, static_prefix, "/static"),
                  DocPrefix = boss_env:get_env(AppName, doc_prefix, "/doc"),
                  DomainList = boss_env:get_env(AppName, domains, all),
                  ModelList = boss_files:model_list(AppName),
                  ViewList = boss_files:view_module_list(AppName),
                  IsMasterNode = boss_env:is_master_node(),
                  ControllerList = boss_files:web_controller_list(AppName),
                  {ok, RouterSupPid} = boss_router:start([{application, AppName},
                          {Controllers, ControllerList}]),
                  {ok, TranslatorSupPid} = boss_translator:start([{application, AppName}]),
                  case boss_env:is_developing_app(AppName) of
  
negative.code:             CacheOptions =
                  case CacheAdapter of
                      ets ->
                          MaxSize		= boss_env:get_env(ets_maxsize, 32 * 1024 * 1024),
                          Threshold	= boss_env:get_env(ets_threshold, 0.85),
                          Weight		= boss_env:get_env(ets_weight, 30),
                          [{adapter, ets}, {ets_maxsize, MaxSize},
                           {ets_threshold, Threshold}, {ets_weight, Weight}];
                      _ ->
  