Update option descriptions + prefer multiple singular options

Plus backwards compatability for legacy comma separated list options
This commit is contained in:
Thom Seddon
2019-04-23 18:26:56 +01:00
parent 93912f4a6e
commit 3cc9cd13e1
3 changed files with 65 additions and 21 deletions

View File

@ -311,10 +311,20 @@ func (c *CookieDomain) Match(host string) bool {
return false
}
func (c *CookieDomain) UnmarshalFlag(value string) error {
*c = *NewCookieDomain(value)
return nil
}
func (c *CookieDomain) MarshalFlag() (string, error) {
return c.Domain, nil
}
// Legacy support for comma separated list of cookie domains
type CookieDomains []CookieDomain
func (c *CookieDomains) UnmarshalFlag(value string) error {
// TODO: test
if len(value) > 0 {
for _, d := range strings.Split(value, ",") {
cookieDomain := NewCookieDomain(d)