mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* MM-12193: remove auto configuration unmarshalling Since plugin hook events are called concurrently, there's no way for the plugin framework to coordinate safe access to the automatically unmarshalled configuration fields. Remove this functionality, and update documentation to illustrate a safe way to do this. * better Fprint example * fix unit tests * log when OnConfigurationChange fails through OnActivate * clarify lifecycle when OnConfigurationChange returns an error * call SetAPI even if OnConfigurationChange not implemented
23 lines
470 B
Go
23 lines
470 B
Go
package plugin_test
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/mattermost/mattermost-server/plugin"
|
|
)
|
|
|
|
type HelloWorldPlugin struct {
|
|
plugin.MattermostPlugin
|
|
}
|
|
|
|
func (p *HelloWorldPlugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprint(w, "Hello, world!")
|
|
}
|
|
|
|
// This example demonstrates a plugin that handles HTTP requests which respond by greeting the
|
|
// world.
|
|
func Example_helloWorld() {
|
|
plugin.ClientMain(&HelloWorldPlugin{})
|
|
}
|