m-lab / go

General purpose libraries / APIs for use in mlab code.
Apache License 2.0
5 stars 6 forks source link

Extend flagx.KeyValue to read values from named files #142

Closed stephen-soltesz closed 2 years ago

stephen-soltesz commented 2 years ago

This change extends the flagx.KeyValue type to be able to read the value from a named file. This change is backward compatible.

This change is Reviewable

coveralls commented 2 years ago

Pull Request Test Coverage Report for Build 1098


Totals Coverage Status
Change from base Build 1082: 0.06%
Covered Lines: 2013
Relevant Lines: 2140

💛 - Coveralls
stephen-soltesz commented 2 years ago

@nkinkade the alternative to this approach would be for the ndt-server to use the flagx.File flag to directly read file contents, but it would additionally need to add these as labels in code. Or, a KeyFileValue flag, that is like the KeyValue flag but reads values from files, or maybe an extension to the KeyValue flag that supports a syntax for reading from files, e.g. like key=@<file> like curl.

stephen-soltesz commented 2 years ago

I think an extension to the KeyValue type to read files may be better than this approach...