Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

1.0 KB
Raw Blame
package serviceaccount

import (
	"github.com/SigNoz/signoz/pkg/errors"
	"github.com/SigNoz/signoz/pkg/factory"
	"github.com/SigNoz/signoz/pkg/types/serviceaccounttypes"
)

type Config struct {
	// Email config for service accounts
	Email EmailConfig `mapstructure:"email"`

	// Analytics collection config for service accounts
	Analytics AnalyticsConfig `mapstructure:"analytics"`
}

type EmailConfig struct {
	Domain string `mapstructure:"domain"`
}

type AnalyticsConfig struct {
	Enabled bool `mapstructure:"enabled"`
}

func NewConfigFactory() factory.ConfigFactory {
	return factory.NewConfigFactory(factory.MustNewName("serviceaccount"), newConfig)
}

func newConfig() factory.Config {
	return &Config{
		Email: EmailConfig{
			Domain: "signozserviceaccount.com",
		},
		Analytics: AnalyticsConfig{
			Enabled: false,
		},
	}
}

func (c Config) Validate() error {
	if c.Email.Domain == "" {
		return errors.New(errors.TypeInvalidInput, serviceaccounttypes.ErrCodeServiceAccountInvalidConfig, "email domain cannot be empty")
	}

	return nil
}