-module(starfruit). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src\\starfruit.gleam"). -export([start/4]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. -file("src\\starfruit.gleam", 10). ?DOC(" This is all you need!\n"). -spec start(integer(), binary(), binary(), boolean()) -> nil. start(Port, Cert, Key, Local) -> gleam_stdlib:print( erlang:list_to_binary( [<<"⋆✴︎˚。⋆ Starfruit is running on port "/utf8>>, erlang:integer_to_binary(Port), <<"!! ⋆。˚✴︎⋆"/utf8>>] ) ), case begin _pipe@3 = glisten:new( fun(_) -> {nil, none} end, fun(_, Msg, Conn) -> Msg@2 = case Msg of {packet, Msg@1} -> Msg@1; _assert_fail -> erlang:error(#{gleam_error => let_assert, message => <<"Pattern match failed, no pattern matched the value."/utf8>>, file => <>, module => <<"starfruit"/utf8>>, function => <<"start"/utf8>>, line => 25, value => _assert_fail, start => 567, 'end' => 595, pattern_start => 578, pattern_end => 589}) end, _ = begin _pipe = starfruit@internal:parse_url(Msg@2), _pipe@1 = starfruit@internal:router(_pipe), _pipe@2 = starfruit@internal:response(_pipe@1), starfruit@internal:senddata(_pipe@2, Conn) end, glisten:stop() end ), _pipe@4 = glisten:with_tls(_pipe@3, Cert, Key), _pipe@5 = starfruit@internal:bind(_pipe@4, Local), glisten:start(_pipe@5, Port) end of {ok, _} -> nil; _assert_fail@1 -> erlang:error(#{gleam_error => let_assert, message => <<"Pattern match failed, no pattern matched the value."/utf8>>, file => <>, module => <<"starfruit"/utf8>>, function => <<"start"/utf8>>, line => 23, value => _assert_fail@1, start => 472, 'end' => 887, pattern_start => 483, pattern_end => 488}) end, gleam_erlang_ffi:sleep_forever().