Closed sentriz closed 5 months ago
Just to be clear, you're using ff.WithEnvVarSplit(",")
?
I'm still on v1 actually but yes that's the idea. I was hoping it would be possible to escape the env var split delim
I think I understand, but just so there's no ambiguity, can you provide a complete example?
sure, for example a docker-compose env, someone may have
environment:
- GONIC_MUSIC_PATHS="/a,/b"
- GONIC_MPV_DEVICE="iec958:CARD=ta,DEV=0"
the first is correctly parsed as []string{"/a", "/b"}
, but the second is parsed as []string{"iec958:CARD=ta", "DEV=0"}
which in this case is not desired
i'm wondering if it makes sense to provide (or automatically) accept an escape character for the delimiter such as \
, so that iec958:CARD=ta\,DEV=0
could be parsed as []string{"iec958:CARD=ta,DEV=0"}
without an split
Escaping isn't the path forward here — instead, call ff.WithEnvVarSplit
with a different delimiter character, which is never valid in an env var value. For example ·
or •
or etc.
the trouble is that is global to the whole flag set, i need the delimiter to be ,
for some flags such GONIC_MUSIC_PATHS above
i suppose if i had the hindsight i would have used a more obscure delimiter, but now there are potentially 1000s of gonic configs around the world using ,
thank you!
hi! thanks for ff, i've been using it for gonic for years
there was a user today with an env var such as
GONIC_MPV_ARGS="--audio-device=alsa/iec958:CARD=ta,DEV=0"
which resulting in an unwanted split. i know it can turned off or change the delimiter, but gonic does use the comma splitting for other flags already
i wonder is it feasible to comma escape the demilimiter like
a\,b
?thanks!