Skip to content

Commit 284d049

Browse files
committed
Fix the defaults of mod_http_upload
1 parent ef5a962 commit 284d049

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

src/http_upload/mod_http_upload.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
-define(DEFAULT_TOKEN_BYTES, 32).
2929
-define(DEFAULT_MAX_FILE_SIZE, 10 * 1024 * 1024). % 10 MB
30-
-define(DEFAULT_SUBHOST, <<"upload.@HOST@">>).
30+
-define(DEFAULT_SUBHOST, mongoose_subdomain_utils:make_subdomain_pattern(~"upload.@HOST@")).
3131

3232
%% gen_mod callbacks
3333
-export([start/2,
@@ -103,10 +103,10 @@ config_spec() ->
103103
<<"s3">> => s3_spec()
104104
},
105105
defaults = #{<<"iqdisc">> => one_queue,
106-
<<"host">> => <<"upload.@HOST@">>,
106+
<<"host">> => ?DEFAULT_SUBHOST,
107107
<<"backend">> => s3,
108108
<<"expiration_time">> => 60,
109-
<<"token_bytes">> => 32,
109+
<<"token_bytes">> => ?DEFAULT_TOKEN_BYTES,
110110
<<"max_file_size">> => ?DEFAULT_MAX_FILE_SIZE
111111
},
112112
required = [<<"s3">>]

test/config_parser_SUITE.erl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,11 +2003,7 @@ mod_http_upload(_Config) ->
20032003
P = [modules, mod_http_upload],
20042004
RequiredOpts = #{<<"s3">> => http_upload_s3_required_opts()},
20052005
S3Cfg = http_upload_s3_expected_cfg(),
2006-
?cfgh(P, mod_config(mod_http_upload,
2007-
#{host => <<"upload.@HOST@">>,
2008-
s3 => config_parser_helper:config([modules, mod_http_upload, s3], S3Cfg)
2009-
}),
2010-
T(RequiredOpts)),
2006+
?cfgh(P, config(P, #{s3 => http_upload_s3_expected_cfg()}), T(RequiredOpts)),
20112007
?cfgh(P ++ [s3], S3Cfg#{add_acl => false}, T(RequiredOpts)),
20122008
?cfgh(P ++ [host], {prefix, <<"upload.">>},
20132009
T(RequiredOpts#{<<"host">> => <<"upload.@HOST@">>})),

0 commit comments

Comments
 (0)