2024-08-21 14:18:44 +05:30
|
|
|
package config
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
2025-01-04 01:28:54 +05:30
|
|
|
"go.signoz.io/signoz/pkg/cache"
|
2024-12-23 16:44:48 +05:30
|
|
|
signozconfmap "go.signoz.io/signoz/pkg/confmap"
|
2024-08-21 14:18:44 +05:30
|
|
|
"go.signoz.io/signoz/pkg/instrumentation"
|
2024-08-22 20:56:15 +05:30
|
|
|
"go.signoz.io/signoz/pkg/web"
|
2024-08-21 14:18:44 +05:30
|
|
|
)
|
|
|
|
|
|
2024-12-23 16:44:48 +05:30
|
|
|
// This map contains the default values of all config structs
|
|
|
|
|
var (
|
|
|
|
|
defaults = map[string]signozconfmap.Config{
|
2025-01-17 14:54:33 +05:30
|
|
|
"web": &web.Config{},
|
|
|
|
|
"cache": &cache.Config{},
|
2024-12-23 16:44:48 +05:30
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
2024-08-21 14:18:44 +05:30
|
|
|
// Config defines the entire configuration of signoz.
|
|
|
|
|
type Config struct {
|
|
|
|
|
Instrumentation instrumentation.Config `mapstructure:"instrumentation"`
|
2024-08-22 20:56:15 +05:30
|
|
|
Web web.Config `mapstructure:"web"`
|
2025-01-04 01:28:54 +05:30
|
|
|
Cache cache.Config `mapstructure:"cache"`
|
2024-08-21 14:18:44 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func New(ctx context.Context, settings ProviderSettings) (*Config, error) {
|
|
|
|
|
provider, err := NewProvider(settings)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return provider.Get(ctx)
|
|
|
|
|
}
|