mirror of
https://github.com/graphql-hive/console
synced 2026-05-02 20:07:17 +00:00
35 lines
1,012 B
Go
35 lines
1,012 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package hiveauthextension // import "github.com/graphql-hive/console/docker/configs/otel-collector/extension-hiveauth"
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"go.opentelemetry.io/collector/component"
|
|
"go.opentelemetry.io/collector/extension"
|
|
|
|
"github.com/graphql-hive/console/docker/configs/otel-collector/extension-hiveauth/internal/metadata"
|
|
)
|
|
|
|
// NewFactory creates a factory for the static bearer token Authenticator extension.
|
|
func NewFactory() extension.Factory {
|
|
return extension.NewFactory(
|
|
metadata.Type,
|
|
createDefaultConfig,
|
|
createExtension,
|
|
metadata.ExtensionStability,
|
|
)
|
|
}
|
|
|
|
func createDefaultConfig() component.Config {
|
|
return &Config{
|
|
Endpoint: "http://localhost:3000/",
|
|
Timeout: 5 * time.Second,
|
|
}
|
|
}
|
|
|
|
func createExtension(_ context.Context, params extension.Settings, cfg component.Config) (extension.Extension, error) {
|
|
return newHiveAuthExtension(params.Logger, cfg.(*Config), params.TelemetrySettings)
|
|
}
|