config

package
v0.0.0-...-d1f9358 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ApplicationName stores application name
	ApplicationName = "Anonymous plugin"

	// Repository stores repository
	Repository = "mattermost-plugin-anonymous"

	// CommandTrigger stores command trigger word
	CommandTrigger = "anonymous"

	// APIPath stores api prefix
	APIPath = "/api/v1"
)

Variables

This section is empty.

Functions

func Context

func Context(ctx context.Context, conf *Config) context.Context

Context sets config object in context

Types

type Config

type Config struct {
	PluginID      string
	PluginVersion string
}

Config captures the plugin's external Config as exposed in the Mattermost server Config, as well as values computed from the Config. Any public fields will be deserialized from the Mattermost server Config in OnConfigurationChange.

As plugins are inherently concurrent (hooks being called asynchronously), and the plugin Config can change at any time, access to the Config must be synchronized. The strategy used in this plugin is to guard a pointer to the Config, and clone the entire struct whenever it changes. You may replace this with whatever strategy you choose.

If you add non-reference types to your Config struct, be sure to rewrite Clone as a deep copy appropriate for your types.

func FromContext

func FromContext(ctx context.Context) *Config

FromContext loads context object from context

func (*Config) Clone

func (c *Config) Clone() *Config

Clone shallow copies the Config. Your implementation may require a deep copy if your Config has reference types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL