diff --git a/server/plugin/configuration.go b/server/plugin/configuration.go index d0bf31bc4..d320c7dd2 100644 --- a/server/plugin/configuration.go +++ b/server/plugin/configuration.go @@ -7,6 +7,7 @@ import ( "reflect" "strings" + pluginapi "github.com/mattermost/mattermost-plugin-api" "github.com/mattermost/mattermost-plugin-api/experimental/telemetry" "github.com/mattermost/mattermost-server/v6/model" "github.com/pkg/errors" @@ -190,6 +191,10 @@ func (p *Plugin) setConfiguration(configuration *Configuration) { // OnConfigurationChange is invoked when configuration changes may have been made. func (p *Plugin) OnConfigurationChange() error { + if p.client == nil { + p.client = pluginapi.NewClient(p.API, p.Driver) + } + var configuration = new(Configuration) // Load the public configuration fields from the Mattermost server configuration. diff --git a/server/plugin/plugin.go b/server/plugin/plugin.go index 4e07ecd8a..ec711017c 100644 --- a/server/plugin/plugin.go +++ b/server/plugin/plugin.go @@ -220,7 +220,9 @@ func (p *Plugin) setDefaultConfiguration() error { } func (p *Plugin) OnActivate() error { - p.client = pluginapi.NewClient(p.API, p.Driver) + if p.client == nil { + p.client = pluginapi.NewClient(p.API, p.Driver) + } siteURL := p.client.Configuration.GetConfig().ServiceSettings.SiteURL if siteURL == nil || *siteURL == "" {