[#857] config: allow to parse sizes with suffix

The code is taken from viper as `cast` package that we use
doesn't have needed converter.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-10-07 19:15:48 +03:00 committed by Leonard Lyubich
parent b8ba677c85
commit a0abf10c8e
4 changed files with 100 additions and 0 deletions

View file

@ -46,5 +46,15 @@
"correct": true,
"correct_string": "true",
"incorrect": "not true"
},
"sizes": {
"size_kb": "1 kb",
"size_kb_no_space": "2kb",
"size_mb": "12m",
"size_gb": "4g",
"size_tb": "5 TB",
"size_bytes": "2048b",
"size_bytes_no_suffix": 123456
}
}

View file

@ -40,3 +40,12 @@ bool:
correct: true
correct_string: "true"
incorrect: not true
sizes:
size_kb: 1 kb
size_kb_no_space: 2kb
size_mb: 12m
size_gb: 4g
size_tb: 5 TB
size_bytes: 2048b
size_bytes_no_suffix: 123456