Files
livekit/pkg
Abhishek B R 428edee0bf config: reject out-of-range values in generated numeric flags (#5022)
* config: reject out-of-range values in generated numeric flags

Generated flags for uint8, uint16, uint32, int32 and float32 config
fields were parsed at a wider type and then converted with
reflect.Value.Convert, which wraps silently. For example
LIVEKIT_TURN_RELAY_RANGE_START=70000 became 4464, and
LIVEKIT_LIMIT_MAX_METADATA_SIZE=4294967296 became 0, which turns the
limit off. The YAML config rejects the same values.

Use the cli flag type that matches each field's width so the parse
fails with the env var or flag name in the error.

* config: cover uint, int8 and int16 in generated numeric flags

Move the numeric cases into numericCLIFlag and add Int8Flag, Int16Flag and UintFlag, so every numeric kind gets a flag of its own width even though no config field uses these three yet. TestNumericCLIFlagWidths checks each kind directly with an in-range value and one that does not fit.

* config: return an error from numericCLIFlag for unsupported kinds

numericCLIFlag returned nil when no case matched, and GenerateCLIFlags appended it unchecked. It now returns (cli.Flag, error) and the caller returns the error like the default case does.
2026-10-28 11:28:29 +05:30
..
2025-11-28 21:51:53 +05:30
2026-10-27 21:04:38 +08:00