Name the setting and value when a size does not parse (closes #429)
check / check (push) Successful in 9m51s
check / check (push) Successful in 9m51s
A size setting such as chunk_size: banana failed with "invalid size
format: strconv.ParseFloat: parsing "": invalid syntax", naming neither
the setting nor the value. The size decoder now quotes the value, and
Parse checks every size setting after ${...} references are filled in,
so the error reads chunk_size: "banana" is not a size; use a number of
bytes or a unit such as 10MB. This covers chunk_size, blob_size_limit
and s3.part_size, and config set.
Model: opus-5-5
This commit is contained in:
1 parent
d8d13d1c8b
commit
c33639cb69
5 files changed
+169
-17
No files matched your search
@@ -287,7 +287,8 @@ func Load(path string) (*Config, error) {
|
||||
}
|
||||
|
||||
// Parse reads YAML config data as Load does, without validating it. It
|
||||
// refuses a key that no setting has, applies default values for optional
|
||||
// refuses a key that no setting has and a size setting whose value is not a
|
||||
// size, naming the setting. It applies default values for optional
|
||||
// fields, fills in ${...} references using smartconfig, and expands ~ in
|
||||
// paths.
|
||||
func Parse(data []byte) (*Config, error) {
|
||||
@@ -312,8 +313,9 @@ func Parse(data []byte) (*Config, error) {
|
||||
return nil, fmt.Errorf("failed to load config file: %w", err)
|
||||
}
|
||||
|
||||
// A ${...} reference can bring in keys that are not in the file.
|
||||
err = checkFilledKeys(sc.Data())
|
||||
// A ${...} reference can bring in keys that are not in the file, and
|
||||
// is the value of a size setting only once it is filled in.
|
||||
err = checkFilledConfig(sc.Data())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user