mirror of
https://github.com/TwiN/gatus.git
synced 2024-12-18 04:31:59 +01:00
9d151fcdb4
* refactor: Partially break core package into dns, result and ssh packages * refactor: Move core package to config/endpoint * refactor: Fix warning about overlapping imported package name with endpoint variable * refactor: Rename EndpointStatus to Status * refactor: Merge result pkg back into endpoint pkg, because it makes more sense * refactor: Rename parameter r to result in Condition.evaluate * refactor: Rename parameter r to result * refactor: Revert accidental change to endpoint.TypeDNS * refactor: Rename parameter r to result * refactor: Merge util package into endpoint package * refactor: Rename parameter r to result
30 lines
865 B
Go
30 lines
865 B
Go
package ssh
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
var (
|
|
// ErrEndpointWithoutSSHUsername is the error with which Gatus will panic if an endpoint with SSH monitoring is configured without a user.
|
|
ErrEndpointWithoutSSHUsername = errors.New("you must specify a username for each SSH endpoint")
|
|
|
|
// ErrEndpointWithoutSSHPassword is the error with which Gatus will panic if an endpoint with SSH monitoring is configured without a password.
|
|
ErrEndpointWithoutSSHPassword = errors.New("you must specify a password for each SSH endpoint")
|
|
)
|
|
|
|
type Config struct {
|
|
Username string `yaml:"username,omitempty"`
|
|
Password string `yaml:"password,omitempty"`
|
|
}
|
|
|
|
// Validate the SSH configuration
|
|
func (cfg *Config) Validate() error {
|
|
if len(cfg.Username) == 0 {
|
|
return ErrEndpointWithoutSSHUsername
|
|
}
|
|
if len(cfg.Password) == 0 {
|
|
return ErrEndpointWithoutSSHPassword
|
|
}
|
|
return nil
|
|
}
|