Current section

54 Versions

Jump to

Compare versions

5 files changed
+54 additions
-39 deletions
  @@ -36,7 +36,7 @@
36 36 {<<"jhn_stdlib">>,
37 37 [{<<"app">>,<<"jhn_stdlib">>},
38 38 {<<"optional">>,false},
39 - {<<"requirement">>,<<"5.1.0">>}]},
39 + {<<"requirement">>,<<"5.3.2">>}]},
40 40 {<<"pmod_transform">>,
41 41 [{<<"app">>,<<"pmod_transform">>},
42 42 {<<"optional">>,false},
  @@ -48,9 +48,5 @@
48 48 {<<"thoas">>,
49 49 [{<<"app">>,<<"thoas">>},
50 50 {<<"optional">>,false},
51 - {<<"requirement">>,<<"1.2.0">>}]},
52 - {<<"uuid_erl">>,
53 - [{<<"app">>,<<"uuid">>},
54 - {<<"optional">>,false},
55 - {<<"requirement">>,<<"~>2.0.7">>}]}]}.
56 - {<<"version">>,<<"0.10.2">>}.
51 + {<<"requirement">>,<<"1.2.0">>}]}]}.
52 + {<<"version">>,<<"0.10.3">>}.
  @@ -13,7 +13,7 @@
13 13 {deps, [
14 14 {cowboy, "2.12.0"},
15 15 {erlydtl, "0.14.0"},
16 - {jhn_stdlib, "5.1.0"},
16 + {jhn_stdlib, "5.3.2"},
17 17 {pmod_transform, "1.1.0"},
18 18 {routing_tree, "1.0.9"},
19 19 {thoas, "1.2.0"}
  @@ -2,34 +2,28 @@
2 2 [{<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.12.0">>},0},
3 3 {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.13.0">>},1},
4 4 {<<"erlydtl">>,{pkg,<<"erlydtl">>,<<"0.14.0">>},0},
5 - {<<"jhn_stdlib">>,{pkg,<<"jhn_stdlib">>,<<"5.1.0">>},0},
5 + {<<"jhn_stdlib">>,{pkg,<<"jhn_stdlib">>,<<"5.3.2">>},0},
6 6 {<<"pmod_transform">>,{pkg,<<"pmod_transform">>,<<"1.1.0">>},0},
7 - {<<"quickrand">>,{pkg,<<"quickrand">>,<<"2.0.7">>},1},
8 7 {<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},1},
9 8 {<<"routing_tree">>,{pkg,<<"routing_tree">>,<<"1.0.9">>},0},
10 - {<<"thoas">>,{pkg,<<"thoas">>,<<"1.2.0">>},0},
11 - {<<"uuid">>,{pkg,<<"uuid_erl">>,<<"2.0.7">>},0}]}.
9 + {<<"thoas">>,{pkg,<<"thoas">>,<<"1.2.0">>},0}]}.
12 10 [
13 11 {pkg_hash,[
14 12 {<<"cowboy">>, <<"F276D521A1FF88B2B9B4C54D0E753DA6C66DD7BE6C9FCA3D9418B561828A3731">>},
15 13 {<<"cowlib">>, <<"DB8F7505D8332D98EF50A3EF34B34C1AFDDEC7506E4EE4DD4A3A266285D282CA">>},
16 14 {<<"erlydtl">>, <<"964B2DC84F8C17ACFAA69C59BA129EF26AC45D2BA898C3C6AD9B5BDC8BA13CED">>},
17 - {<<"jhn_stdlib">>, <<"55338ABE96EEB12222EF50C8506F3204EE5BD287BFF3961886189847FB4E092C">>},
15 + {<<"jhn_stdlib">>, <<"97125AE9128384436264BC3601ECC48AF4844A6CB71A4E217747A185E5CEAD5F">>},
18 16 {<<"pmod_transform">>, <<"A3A4FA607B947C90410BC459DCA27F6B60D25D1588D568280F7276AC8767E106">>},
19 - {<<"quickrand">>, <<"D2BD76676A446E6A058D678444B7FDA1387B813710D1AF6D6E29BB92186C8820">>},
20 17 {<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>},
21 18 {<<"routing_tree">>, <<"F7B95CF21CAEF1F184948C547780BAB4EC2B2CB0CD75B8CB2BE49F86F0DFD523">>},
22 - {<<"thoas">>, <<"73B0546BAFF5008E6ED209558FD7B0606B035D96F9F3DE24EF42879100E094D4">>},
23 - {<<"uuid">>, <<"B2078D2CC814F53AFA52D36C91E08962C7E7373585C623F4C0EA6DFB04B2AF94">>}]},
19 + {<<"thoas">>, <<"73B0546BAFF5008E6ED209558FD7B0606B035D96F9F3DE24EF42879100E094D4">>}]},
24 20 {pkg_hash_ext,[
25 21 {<<"cowboy">>, <<"8A7ABE6D183372CEB21CAA2709BEC928AB2B72E18A3911AA1771639BEF82651E">>},
26 22 {<<"cowlib">>, <<"E1E1284DC3FC030A64B1AD0D8382AE7E99DA46C3246B815318A4B848873800A4">>},
27 23 {<<"erlydtl">>, <<"D80EC044CD8F58809C19D29AC5605BE09E955040911B644505E31E9DD8143431">>},
28 - {<<"jhn_stdlib">>, <<"760B45C0310FF6E379BC08B0A9E5C2F8C4076223D7E1BDC253D69C7D7055E687">>},
24 + {<<"jhn_stdlib">>, <<"EFB7208D2F3BC9B92180006AB51B349CD1B6BB85C0F4A3A4951A3B701F8F7B5D">>},
29 25 {<<"pmod_transform">>, <<"68C7FF7354C0D837681990D093D367FCC617C32570A1009B8E7ACFF6445499AA">>},
30 - {<<"quickrand">>, <<"B8ACBF89A224BC217C3070CA8BEBC6EB236DBE7F9767993B274084EA044D35F0">>},
31 26 {<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>},
32 27 {<<"routing_tree">>, <<"FB9A05EA0F3A8B77CC39CED3952B98391C617BA448AF63DDD5908F8557D8C029">>},
33 - {<<"thoas">>, <<"540C8CB7D9257F2AD0A14145DC23560F91ACDCA995F0CCBA779EB33AF5D859D1">>},
34 - {<<"uuid">>, <<"4E4C5CA3461DC47C5E157ED42AA3981A053B7A186792AF972A27B14A9489324E">>}]}
28 + {<<"thoas">>, <<"540C8CB7D9257F2AD0A14145DC23560F91ACDCA995F0CCBA779EB33AF5D859D1">>}]}
35 29 ].
  @@ -1,6 +1,6 @@
1 1 {application,nova,
2 2 [{description,"Nova is a web application framework"},
3 - {vsn,"0.10.2"},
3 + {vsn,"0.10.3"},
4 4 {registered,[]},
5 5 {mod,{nova_app,[]}},
6 6 {included_applications,[]},
  @@ -15,6 +15,7 @@
15 15
16 16 -include_lib("kernel/include/logger.hrl").
17 17 -include("nova.hrl").
18 + -include("../include/nova.hrl").
18 19
19 20 -define(SERVER, ?MODULE).
20 21
  @@ -119,14 +120,19 @@ start_cowboy(Configuration) ->
119 120 nova_handler, %% Controller
120 121 nova_plugin_handler %% Handle post-request plugins
121 122 ],
122 - StreamHandlers = maps:get(stream_handlers, Configuration, [nova_stream_h, cowboy_compress_h, cowboy_stream_h]),
123 + StreamH = [nova_stream_h,
124 + cowboy_compress_h,
125 + cowboy_stream_h],
126 + StreamHandlers = maps:get(stream_handlers, Configuration, StreamH),
127 + MiddlewareHandlers = maps:get(middleware_handlers, Configuration, Middlewares),
123 128 Options = maps:get(options, Configuration, #{compress => true}),
124 129
125 130 %% Build the options map
126 - CowboyOptions1 = Options#{middlewares => Middlewares,
131 + CowboyOptions1 = Options#{middlewares => MiddlewareHandlers,
127 132 stream_handlers => StreamHandlers},
128 133
129 134 BootstrapApp = application:get_env(nova, bootstrap_application, undefined),
135 +
130 136 %% Compile the routes
131 137 Dispatch =
132 138 case BootstrapApp of
  @@ -162,26 +168,45 @@ start_cowboy(Configuration) ->
162 168 Error
163 169 end;
164 170 _ ->
165 - CACert = maps:get(ca_cert, Configuration),
166 - Cert = maps:get(cert, Configuration),
167 - Port = maps:get(ssl_port, Configuration, ?NOVA_STD_SSL_PORT),
168 - ?LOG_NOTICE(#{msg => <<"Nova starting SSL">>, port => Port}),
169 - case cowboy:start_tls(
170 - ?NOVA_LISTENER, [
171 - {port, Port},
172 - {ip, Host},
173 - {certfile, Cert},
174 - {cacertfile, CACert}
175 - ],
176 - CowboyOptions2) of
177 - {ok, _Pid} ->
178 - {ok, BootstrapApp, Host, Port};
179 - Error ->
180 - Error
171 + case maps:get(ca_cert, Configuration, undefined) of
172 + undefined ->
173 + Port = maps:get(ssl_port, Configuration, ?NOVA_STD_SSL_PORT),
174 + SSLOptions = maps:get(ssl_options, Configuration, #{}),
175 + TransportOpts = maps:put(port, Port, SSLOptions),
176 + TransportOpts1 = maps:put(ip, Host, TransportOpts),
177 +
178 + case cowboy:start_tls(
179 + ?NOVA_LISTENER, maps:to_list(TransportOpts1), CowboyOptions2) of
180 + {ok, _Pid} ->
181 + ?LOG_NOTICE(#{msg => <<"Nova starting SSL">>, port => Port}),
182 + {ok, BootstrapApp, Host, Port};
183 + Error ->
184 + ?LOG_ERROR(#{msg => <<"Could not start cowboy with SSL">>, reason => Error}),
185 + Error
186 + end;
187 + CACert ->
188 + Cert = maps:get(cert, Configuration),
189 + Port = maps:get(ssl_port, Configuration, ?NOVA_STD_SSL_PORT),
190 + ?LOG_DEPRECATED(<<"0.10.3">>, <<"Use of use_ssl is deprecated, use ssl instead">>),
191 + case cowboy:start_tls(
192 + ?NOVA_LISTENER, [
193 + {port, Port},
194 + {ip, Host},
195 + {certfile, Cert},
196 + {cacertfile, CACert}
197 + ],
198 + CowboyOptions2) of
199 + {ok, _Pid} ->
200 + ?LOG_NOTICE(#{msg => <<"Nova starting SSL">>, port => Port}),
201 + {ok, BootstrapApp, Host, Port};
202 + Error ->
203 + Error
204 + end
181 205 end
182 206 end.
183 207
184 208
209 +
185 210 get_version(Application) ->
186 211 case lists:keyfind(Application, 1, application:loaded_applications()) of
187 212 {_, _, Version} ->