Handle config options
This commit is contained in:
parent
b1b9eaa028
commit
accd7e75d8
6 changed files with 192 additions and 1 deletions
27
internal/config/custom.go
Normal file
27
internal/config/custom.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
)
|
||||
|
||||
type URL struct {
|
||||
URL *url.URL
|
||||
}
|
||||
|
||||
func (i *URL) String() string {
|
||||
if i.URL != nil {
|
||||
return i.URL.String()
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (i *URL) Set(value string) error {
|
||||
u, err := url.Parse(value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*i.URL = *u
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue