28 lines
611 B
Go
28 lines
611 B
Go
package setup
|
|
|
|
import (
|
|
"context"
|
|
|
|
"forge.cadoles.com/wpetit/clearcase/internal/config"
|
|
"forge.cadoles.com/wpetit/clearcase/internal/http"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func NewHTTPServerFromConfig(ctx context.Context, conf *config.Config) (*http.Server, error) {
|
|
// Configure Web UI handler
|
|
webui, err := NewWebUIHandlerFromConfig(ctx, conf)
|
|
if err != nil {
|
|
return nil, errors.Wrap(err, "could not configure webui handler from config")
|
|
}
|
|
|
|
// Create HTTP server
|
|
|
|
server := http.NewServer(
|
|
webui,
|
|
http.WithAddress(conf.HTTP.Address),
|
|
http.WithBaseURL(conf.HTTP.BaseURL),
|
|
)
|
|
|
|
return server, nil
|
|
}
|