Only validate URL if type is url
This commit is contained in:
parent
2315b0bb70
commit
c708c17177
@ -27,6 +27,7 @@ func NewConfig(actionType string, actionData string) *Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (config *Config) Validate() {
|
func (config *Config) Validate() {
|
||||||
|
if config.ActionType == "url" {
|
||||||
// Parse URL in config
|
// Parse URL in config
|
||||||
urlParser, err := url.Parse(config.ActionData)
|
urlParser, err := url.Parse(config.ActionData)
|
||||||
// If there was an error parsing
|
// If there was an error parsing
|
||||||
@ -42,6 +43,7 @@ func (config *Config) Validate() {
|
|||||||
// Alert user of invalid host
|
// Alert user of invalid host
|
||||||
log.Fatal().Msg("Invalid URL host")
|
log.Fatal().Msg("Invalid URL host")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create config file
|
// Create config file
|
||||||
|
Reference in New Issue
Block a user