config

package
v2.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderAPNsFCM represents the real APNs + FCM implementation.
	ProviderAPNsFCM = "apns_fcm"
	// ProviderNoop represents the no-op implementation.
	ProviderNoop = "noop"
)

Variables

View Source
var (
	// Providers are what we provide to dependency injection.
	Providers = wire.NewSet(
		ProvidePushSender,
	)
)

Functions

func ProvidePushSender

func ProvidePushSender(
	ctx context.Context,
	cfg Config,
	logger logging.Logger,
	tracerProvider tracing.TracerProvider,
) (notifications.PushNotificationSender, error)

ProvidePushSender provides a PushNotificationSender from config.

func RegisterPushSender

func RegisterPushSender(i do.Injector)

RegisterPushSender registers a notifications.PushNotificationSender with the injector.

Types

type APNsConfig

type APNsConfig struct {
	AuthKeyPath string `env:"AUTH_KEY_PATH" json:"authKeyPath"`
	KeyID       string `env:"KEY_ID"        json:"keyID"`
	TeamID      string `env:"TEAM_ID"       json:"teamID"`
	BundleID    string `env:"BUNDLE_ID"     json:"bundleID"`
	Production  bool   `env:"PRODUCTION"    json:"production"`
}

APNsConfig configures APNs for iOS push notifications.

type Config

type Config struct {
	APNs     *APNsConfig `env:"init"     envPrefix:"APNS_" json:"apns"`
	FCM      *FCMConfig  `env:"init"     envPrefix:"FCM_"  json:"fcm"`
	Provider string      `env:"PROVIDER" json:"provider"`
}

Config is the push notifications configuration.

func (*Config) ProvidePushSender

func (cfg *Config) ProvidePushSender(
	ctx context.Context,
	logger logging.Logger,
	tracerProvider tracing.TracerProvider,
) (notifications.PushNotificationSender, error)

ProvidePushSender returns a PushNotificationSender based on config. When provider is "apns_fcm" and at least one platform config is valid, returns MultiPlatformPushSender. Each platform is initialized independently; a failed init for one does not disable the other.

func (*Config) ValidateWithContext

func (cfg *Config) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates the Config.

type FCMConfig

type FCMConfig struct {
	// CredentialsPath is the path to the Firebase service account JSON file.
	// If empty, Application Default Credentials (ADC) are used.
	CredentialsPath string `env:"CREDENTIALS_PATH" json:"credentialsPath"`
}

FCMConfig configures FCM for Android push notifications.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL