Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@negasus
Copy link
Contributor

@negasus negasus commented Feb 15, 2022

No description provided.

@negasus negasus requested a review from umputun as a code owner February 15, 2022 08:36
@umputun
Copy link
Owner

umputun commented Feb 15, 2022

is there an actual problem this pr is supposed to address? SSL types handled by go-flags library and won't allow to pass anything except what defined in choice tags

Type string long:"type" env:"TYPE" description:"ssl (auto) support" choice:"none" choice:"static" choice:"auto" default:"none"`

@negasus
Copy link
Contributor Author

negasus commented Feb 15, 2022

I made this PR after I mistyped SSL_TYPE=true a couple of times myself and didn't get any error.
I believe returning an error in this case will not degrade the user experience. But it can help in finding an erroneous configuration

@umputun
Copy link
Owner

umputun commented Feb 15, 2022

ah, you meant from env, because this choice handles command-line flags only I think. makes sense

go run app/main.go --dbg --ssl.type=true    
reproxy unknown
Invalid value `true' for option `--ssl.type'. Allowed values are: none, static or auto
2022/02/15 02:49:00 ERROR cli error: Invalid value `true' for option `--ssl.type'. Allowed values are: none, static or auto

@umputun
Copy link
Owner

umputun commented Feb 15, 2022

could you please match the error your return to the one cli will throw?, just for consistency, i.e.

Invalid value "true" for SSL_TYPE. Allowed values are: none, static or auto

@umputun
Copy link
Owner

umputun commented Feb 15, 2022

LGTM, will merge.

the minor thing just FYI: you don't need to put \"%s\", this is what %q is for. I'll change it after merge

@umputun umputun merged commit 4126fa7 into umputun:master Feb 15, 2022
@negasus negasus deleted the fix/wrong-ssl-type branch February 15, 2022 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants