mirror of
https://github.com/graphql-hive/console
synced 2026-04-25 16:37:16 +00:00
Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Denis Badurina <denis@denelop.com>
28 lines
673 B
Go
28 lines
673 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 (
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
type Config struct {
|
|
// Endpoint is the address of the authentication server
|
|
Endpoint string `mapstructure:"endpoint"`
|
|
// Timeout is the timeout for the HTTP request to the auth service
|
|
Timeout time.Duration `mapstructure:"timeout"`
|
|
}
|
|
|
|
func (cfg *Config) Validate() error {
|
|
if cfg.Endpoint == "" {
|
|
return errors.New("missing endpoint")
|
|
}
|
|
|
|
if cfg.Timeout <= 0 {
|
|
return errors.New("timeout must be a positive value")
|
|
}
|
|
|
|
return nil
|
|
}
|