feat(platform): add the notification inbox and deterministic match search
This commit is contained in:
1 parent
5edff21d2d
commit
0b11021b16
169 files changed
+17083
-443
No files matched your search
@@ -63,6 +63,10 @@ type Config struct {
|
||||
// ConsumerEnabled runs the registered event consumers next to the HTTP
|
||||
// servers.
|
||||
ConsumerEnabled bool
|
||||
// NotificationSyntheticEnabled lets the inbox consume and render the
|
||||
// synthetic notification event. Off by default; a development or browser
|
||||
// test stand turns it on.
|
||||
NotificationSyntheticEnabled bool
|
||||
// ConsumerGroupPrefix and a consumer name form the consumer group ID.
|
||||
ConsumerGroupPrefix string
|
||||
ConsumerMaxAttempts int
|
||||
@@ -191,6 +195,9 @@ func LoadFromEnv(lookup LookupEnv) (Config, error) {
|
||||
if err := config.loadConsumer(lookup); err != nil {
|
||||
return Config{}, err
|
||||
}
|
||||
if err := config.loadNotification(lookup); err != nil {
|
||||
return Config{}, err
|
||||
}
|
||||
if err := config.loadJobs(lookup); err != nil {
|
||||
return Config{}, err
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package config
|
||||
|
||||
// defaultNotificationSyntheticEnabled keeps the synthetic inbox event off:
|
||||
// a production deployment neither consumes nor renders it. A development or
|
||||
// browser-test stand turns it on.
|
||||
const defaultNotificationSyntheticEnabled = false
|
||||
|
||||
func (config *Config) loadNotification(lookup LookupEnv) error {
|
||||
var err error
|
||||
config.NotificationSyntheticEnabled, err = boolOrDefault(lookup, "NOTIFICATION_SYNTHETIC_ENABLED", defaultNotificationSyntheticEnabled)
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package config
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestLoadFromEnvReadsTheSyntheticNotificationSwitch(t *testing.T) {
|
||||
settings, err := LoadFromEnv(testEnvironment(nil))
|
||||
if err != nil || settings.NotificationSyntheticEnabled {
|
||||
t.Fatalf("default = %t, %v, want off", settings.NotificationSyntheticEnabled, err)
|
||||
}
|
||||
settings, err = LoadFromEnv(testEnvironment(map[string]string{"NOTIFICATION_SYNTHETIC_ENABLED": " True "}))
|
||||
if err != nil || !settings.NotificationSyntheticEnabled {
|
||||
t.Fatalf("enabled = %t, %v, want on", settings.NotificationSyntheticEnabled, err)
|
||||
}
|
||||
if _, err := LoadFromEnv(testEnvironment(map[string]string{"NOTIFICATION_SYNTHETIC_ENABLED": "yes"})); err == nil {
|
||||
t.Fatal("LoadFromEnv() accepted a value that is not true or false")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user