mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-31 01:52:04 +08:00

* fix: use common timeout middleware * fix: use apiserver factory for config * fix: add backward compatibility for old variables * fix: remove apiserver provider and use config directly * fix: remove apiserver interface * fix: address comments * fix: address minor comments * fix: address minor comments
43 lines
936 B
Go
43 lines
936 B
Go
package apiserver
|
|
|
|
import (
|
|
"time"
|
|
|
|
"go.signoz.io/signoz/pkg/factory"
|
|
)
|
|
|
|
// Config holds the configuration for config.
|
|
type Config struct {
|
|
Timeout Timeout `mapstructure:"timeout"`
|
|
}
|
|
|
|
type Timeout struct {
|
|
// The default context timeout that can be overridden by the request
|
|
Default time.Duration `mapstructure:"default"`
|
|
// The maximum allowed context timeout
|
|
Max time.Duration `mapstructure:"max"`
|
|
// The list of routes that are excluded from the timeout
|
|
ExcludedRoutes []string `mapstructure:"excluded_routes"`
|
|
}
|
|
|
|
func NewConfigFactory() factory.ConfigFactory {
|
|
return factory.NewConfigFactory(factory.MustNewName("apiserver"), newConfig)
|
|
}
|
|
|
|
func newConfig() factory.Config {
|
|
return &Config{
|
|
Timeout: Timeout{
|
|
Default: 60 * time.Second,
|
|
Max: 600 * time.Second,
|
|
ExcludedRoutes: []string{
|
|
"/api/v1/logs/tail",
|
|
"/api/v3/logs/livetail",
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func (c Config) Validate() error {
|
|
return nil
|
|
}
|