refactor: extract ProxyProvider interface with None and NPM implementations
Replace direct npm.Client usage throughout the codebase with the proxy.Provider interface, enabling pluggable proxy backends. The deployer, API layer, and proxy manager now use provider-agnostic route management (ConfigureRoute/DeleteRoute) instead of NPM-specific API calls. Adds ProxyRouteID (string) to Instance model and ProxyProvider setting to Settings, with SQLite migrations for backward compatibility.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package proxy
|
||||
|
||||
import "context"
|
||||
|
||||
// NoneProvider is a no-op proxy provider for deployments that don't use a reverse proxy.
|
||||
type NoneProvider struct{}
|
||||
|
||||
func NewNoneProvider() *NoneProvider { return &NoneProvider{} }
|
||||
|
||||
func (n *NoneProvider) Name() string { return "none" }
|
||||
|
||||
func (n *NoneProvider) ConfigureRoute(_ context.Context, _, _ string, _ int, _ RouteOptions) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (n *NoneProvider) DeleteRoute(_ context.Context, _ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *NoneProvider) ContainerLabels(_ string, _ int) map[string]string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *NoneProvider) Ping(_ context.Context) error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user