Create type ClusterMode string and panic only in the config validation function

This commit is contained in:
TwinProduction
2020-11-11 15:10:44 -05:00
parent ea6c788fa0
commit f406206eae
4 changed files with 37 additions and 29 deletions

View File

@ -10,11 +10,11 @@ type Config struct {
// ServiceTemplate Template for auto discovered services
ServiceTemplate *core.Service `yaml:"service-template"`
// ExcludeSuffix Ignore services with this suffix
// ExcludeSuffix is a slice of service suffixes that should be ignored
ExcludeSuffix []string `yaml:"exclude-suffix"`
// ClusterMode to authenticate with kubernetes
ClusterMode string `yaml:"cluster-mode"`
ClusterMode ClusterMode `yaml:"cluster-mode"`
// Namespaces from which to discover services
Namespaces []*NamespaceConfig `yaml:"namespaces"`
@ -31,3 +31,11 @@ type NamespaceConfig struct {
// HealthAPI URI to append to service to reach health check API
HealthAPI string `yaml:"health-api"`
}
// ClusterMode is the mode to use to authenticate to Kubernetes
type ClusterMode string
const (
ClusterModeIn ClusterMode = "in"
ClusterModeOut ClusterMode = "out"
)