Skip to content

Commit

Permalink
Merge branch 'release/2024.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed May 31, 2024
2 parents 0f7a028 + fc641e3 commit 9793777
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
container:
image: shiguredo/shiguredo-erlang:otp-26.1.2-openssl-3.1.3-ubuntu-22.04-x86_64
image: shiguredo/erlang:otp-27.0-openssl-3.3.0-ubuntu-24.04-x86_64
steps:
- uses: actions/checkout@v4
- run: make compile dialyzer test
Expand Down
11 changes: 10 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@

## develop

- [ADD] `,` 区切りの文字列リストを読み込める `#kvc_list_string{}` を追加
- @voluntas
- [UPDATE] rebar3 を 3.23.0 に上げる
- @voluntas
- [UPDATE] GitHub Actions の docker の OTP を 27.0 に上げる
- @voluntas
- [CHANGE] rebar3 の minimum_otp_vsn を 27.0 にする
- @voluntas

## 2023.3.0

- [ADD] `#kvc_interval` に利用可能な時間の単位を `available_time_units` で設定できるようにする
Expand Down Expand Up @@ -136,7 +145,7 @@

- [CHANGE] `#kvc_interval{}` の単位を指定する場合は間にスペースをいれる `10 s`
- `数値と単位を分割するために空白(space)を用いる`
- https://ja.wikipedia.org/wiki/%E5%9B%BD%E9%9A%9B%E5%8D%98%E4%BD%8D%E7%B3%BB
- <https://ja.wikipedia.org/wiki/%E5%9B%BD%E9%9A%9B%E5%8D%98%E4%BD%8D%E7%B3%BB>
- @voluntas

## 2020.9.1
Expand Down
2 changes: 2 additions & 0 deletions include/kvconf.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

-record(kvc_string, {}).

-record(kvc_list_string, {}).

-record(kvc_integer, {
min :: integer(),
max :: integer() | infinity
Expand Down
3 changes: 1 addition & 2 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{minimum_otp_vsn, "26.1"}.
{minimum_otp_vsn, "27.0"}.

{erl_opts, [{i, "src"},
{feature, maybe_expr, enable},
warnings_as_errors,
warn_export_all,
warn_unused_import]}.
Expand Down
Binary file modified rebar3
Binary file not shown.
2 changes: 1 addition & 1 deletion src/kvconf.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, kvconf,
[{description, "kvconf"},
{vsn, "2023.3.0"},
{vsn, "2024.1.0"},
{registered, []},
{applications, [kernel, stdlib]},
{env, []},
Expand Down
1 change: 1 addition & 0 deletions src/kvconf.erl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
-type type() :: #kvc_atom{} |
#kvc_list_atom{} |
#kvc_string{} |
#kvc_list_string{} |
#kvc_integer{} |
#kvc_float{} |
#kvc_boolean{} |
Expand Down
2 changes: 1 addition & 1 deletion src/kvconf_pkix.erl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ validate_pkix_fullchain_pem_file(FullchainPemFilePath) ->
case public_key:pem_decode(Bin) of
[] ->
error;
PemEntryList when is_list(PemEntryList) ->
PemEntryList ->
%% PemEntry が全て {'Certificate', _, not_encrypted} であることを確認する
F = fun({'Certificate', Der, not_encrypted}) ->
try
Expand Down
31 changes: 31 additions & 0 deletions src/kvconf_validate.erl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ validate_type(#kvc_list_atom{}, Value) ->
validate_list_atom(Value);
validate_type(#kvc_string{}, Value) ->
validate_string(Value);
validate_type(#kvc_list_string{}, Value) ->
validate_list_string(Value);
validate_type(#kvc_integer{min = Min, max = Max}, Value) ->
validate_integer(Value, Min, Max);
validate_type(#kvc_float{min = Min, max = Max}, Value) ->
Expand Down Expand Up @@ -289,6 +291,17 @@ validate_string(_Value) ->
invalid_value.


validate_list_string(Value) when is_binary(Value) ->
case binary:split(Value, [<<",">>, <<$\s>>], [trim_all, global]) of
[] ->
{ok, []};
Values ->
{ok, Values}
end;
validate_list_string(_Values) ->
invalid_value.


validate_http_uri(Value) ->
case uri_string:parse(Value) of
#{scheme := Scheme}
Expand Down Expand Up @@ -612,4 +625,22 @@ validate_one_test() ->
ok.


validate_list_string_test() ->
?assertEqual({ok, [~"x-abc-efg", ~"x-y-z"]},
validate_list_string(~"x-abc-efg, x-y-z")),
?assertEqual({ok, []},
validate_list_string(~",,,")),
?assertEqual({ok, []},
validate_list_string(~"")),
?assertEqual({ok, [~"a", ~"b"]},
validate_list_string(~"a, , , b")),
?assertEqual({ok, [~"a", ~"b"]},
validate_list_string(~" a, , , b ")),

?assertEqual(invalid_value,
validate_list_string(1)),

ok.


-endif.

0 comments on commit 9793777

Please sign in to comment.