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 ¶
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.
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.
Click to show internal directories.
Click to hide internal directories.