new changes
This commit is contained in:
42
control-plane-go/internal/webserver/adapters.go
Normal file
42
control-plane-go/internal/webserver/adapters.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package webserver
|
||||
|
||||
import "errors"
|
||||
|
||||
type Adapter interface {
|
||||
Name() string
|
||||
ValidateVHost(config string) error
|
||||
Reload() error
|
||||
}
|
||||
|
||||
type NginxAdapter struct{}
|
||||
type ApacheAdapter struct{}
|
||||
type OpenLiteSpeedAdapter struct{}
|
||||
|
||||
func (a NginxAdapter) Name() string { return "nginx" }
|
||||
func (a ApacheAdapter) Name() string { return "apache" }
|
||||
func (a OpenLiteSpeedAdapter) Name() string { return "openlitespeed" }
|
||||
|
||||
func (a NginxAdapter) ValidateVHost(config string) error {
|
||||
if config == "" {
|
||||
return errors.New("empty nginx vhost config")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a ApacheAdapter) ValidateVHost(config string) error {
|
||||
if config == "" {
|
||||
return errors.New("empty apache vhost config")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a OpenLiteSpeedAdapter) ValidateVHost(config string) error {
|
||||
if config == "" {
|
||||
return errors.New("empty openlitespeed vhost config")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a NginxAdapter) Reload() error { return nil }
|
||||
func (a ApacheAdapter) Reload() error { return nil }
|
||||
func (a OpenLiteSpeedAdapter) Reload() error { return nil }
|
||||
Reference in New Issue
Block a user