Simplify declaration and use of vars
- Dominant language
- Go
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
This issue is a proposal to rationalize our use of NetSender vars.
Revid's are defined in:
`av/revid/config/variables.go`
Speaker's are defined in:
`av/cmd/speaker/main.go`
They need to be used by clients and cloud alike.
1. I don't think they belong in av, as they're client/device properties.
2. We have a lot of cookie-cutter code for parsing these vars, such as.
```
{
Name: KeyPSITime,
Type: typeUint,
Update: func(c *Config, v string) { c.PSITime = parseUint(KeyPSITime, v, c) },
Validate: func(c *Config) { c.PSITime = lessThanOrEqual(KeyPSITime, c.PSITime, 0, c, defaultPSITime) },
},
{
Name: KeyQuantization,
Type: typeUint,
Update: func(c *Config, v string) { c.Quantization = parseUint(KeyQuantization, v, c) },
},
}
```
I propose moving to a data-driven approach where vars and their types are represented in JSON and parsed by a general-purpose parser. Using reflection, we could map JSON keys onto config struct fields.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.