<commit_before>%%%-------------------------------------------------------------------
%% @doc ztalk public API
%% @end
%%%-------------------------------------------------------------------

-module('ztalk_app').

-behaviour(application).

%% Application callbacks
-export([start/2, stop/1]).

%%====================================================================
%% API
%%====================================================================

start(_StartType, _StartArgs) ->
  start_cowboy(),
  ztalk_sup:start_link().

%%--------------------------------------------------------------------
stop(_State) ->
  ok.

%%====================================================================
%% Internal functions
%%====================================================================

start_cowboy() ->
  Dispatch = cowboy_router:compile([
      {'_', [
          {"/static/[...]", cowboy_static, {priv_dir, ztalk, "static", [{mimetypes, cow_mimetypes, web}]}},
          {"/", cowboy_static, {priv_file, ztalk, "static/index.html"}},
          {"/ws", ztalk_ws_handler, []}
        ]}
    ]),
  ListenPort = case os:getenv("PORT") of
    false ->
      8080;
    P ->
      erlang:list_to_integer(P)
  end,
  cowboy:start_http(ztalk_cowboy, 100, [{port, ListenPort}], [{env, [{dispatch, Dispatch}]}]).<commit_msg>disable websocket<commit_after>%%%-------------------------------------------------------------------
%% @doc ztalk public API
%% @end
%%%-------------------------------------------------------------------

-module('ztalk_app').

-behaviour(application).

%% Application callbacks
-export([start/2, stop/1]).

%%====================================================================
%% API
%%====================================================================

start(_StartType, _StartArgs) ->
  start_cowboy(),
  ztalk_sup:start_link().

%%--------------------------------------------------------------------
stop(_State) ->
  ok.

%%====================================================================
%% Internal functions
%%====================================================================

start_cowboy() ->
  Dispatch = cowboy_router:compile([
      {'_', [
          {"/static/[...]", cowboy_static, {priv_dir, ztalk, "static", [{mimetypes, cow_mimetypes, web}]}},
          {"/", cowboy_static, {priv_file, ztalk, "static/index.html"}}
%%          {"/ws", ztalk_ws_handler, []}
        ]}
    ]),
  ListenPort = case os:getenv("PORT") of
    false ->
      8080;
    P ->
      erlang:list_to_integer(P)
  end,
  cowboy:start_http(ztalk_cowboy, 100, [{port, ListenPort}], [{env, [{dispatch, Dispatch}]}]).
{'fraction_non_alphanumeric': 0.4940952380952381, 'fraction_numerical': 0.006857142857142857, 'mean_word_length': 2.3240506329113924, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5350349', 'n_tokens_mistral': 692, 'n_tokens_neox': 651, 'n_words': 108}