SetConfig sets the module config
(projectID string, eventing *config.EventingConfig)
| 97 | |
| 98 | // SetConfig sets the module config |
| 99 | func (m *Module) SetConfig(projectID string, eventing *config.EventingConfig) error { |
| 100 | m.lock.Lock() |
| 101 | defer m.lock.Unlock() |
| 102 | |
| 103 | if eventing == nil || !eventing.Enabled { |
| 104 | m.config.Enabled = false |
| 105 | return nil |
| 106 | } |
| 107 | |
| 108 | if eventing.DBAlias == "" { |
| 109 | return errors.New("invalid eventing config provided") |
| 110 | } |
| 111 | |
| 112 | m.project = projectID |
| 113 | m.config.Enabled = eventing.Enabled |
| 114 | m.config.DBAlias = eventing.DBAlias |
| 115 | |
| 116 | // `m.config.InternalRules` cannot be set by the eventing module. Its used by other modules only. |
| 117 | if m.config.InternalRules == nil { |
| 118 | m.config.InternalRules = make(config.EventingTriggers) |
| 119 | } |
| 120 | |
| 121 | return nil |
| 122 | } |
| 123 | |
| 124 | // SetSchemaConfig sets schema config of eventing module |
| 125 | func (m *Module) SetSchemaConfig(evSchemas config.EventingSchemas) error { |