hydra-passwordless/internal/hydra/provider.go
William Petit 44338f06e3 Add "fake ssl termination" capability to the hydra client
Replicating de "--fake-ssl-termination" option of the official hydra
client
2020-05-21 13:12:17 +02:00

31 lines
567 B
Go

package hydra
import (
"net/url"
"time"
"github.com/pkg/errors"
"gitlab.com/wpetit/goweb/service"
)
func ServiceProvider(rawBaseURL string, fakeSSLTermination bool, httpTimeout time.Duration) service.Provider {
var (
baseURL *url.URL
err error
)
baseURL, err = url.Parse(rawBaseURL)
if err != nil {
err = errors.Wrap(err, "could not parse base url")
}
client := NewClient(baseURL, fakeSSLTermination, httpTimeout)
return func(ctn *service.Container) (interface{}, error) {
if err != nil {
return nil, err
}
return client, nil
}
}