2020-06-09 02:43:32 +00:00
|
|
|
package factory
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
portainer "github.com/portainer/portainer/api"
|
|
|
|
"github.com/portainer/portainer/api/http/proxy/factory/azure"
|
|
|
|
)
|
|
|
|
|
2021-03-29 21:58:56 +00:00
|
|
|
func newAzureProxy(endpoint *portainer.Endpoint, dataStore portainer.DataStore) (http.Handler, error) {
|
2020-06-09 02:43:32 +00:00
|
|
|
remoteURL, err := url.Parse(azureAPIBaseURL)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
proxy := newSingleHostReverseProxyWithHostHeader(remoteURL)
|
2021-03-29 21:58:56 +00:00
|
|
|
proxy.Transport = azure.NewTransport(&endpoint.AzureCredentials, dataStore, endpoint)
|
2020-06-09 02:43:32 +00:00
|
|
|
return proxy, nil
|
|
|
|
}
|