Documentation ¶
Index ¶
- Constants
- type BuildConfig
- type Config
- func (conf Config) AppURL(appID apps.AppID) string
- func (conf *Config) Reconfigure(stored StoredConfig, mmconf *model.Config, license *model.License) error
- func (conf Config) SetContextDefaults(cc *apps.Context) *apps.Context
- func (conf Config) SetContextDefaultsForApp(appID apps.AppID, cc *apps.Context) *apps.Context
- func (conf Config) StaticURL(appID apps.AppID, name string) string
- type Configurable
- type Service
- type StoredConfig
- type TestConfigurator
- func (c *TestConfigurator) GetConfig() Config
- func (c *TestConfigurator) GetMattermostConfig() configservice.ConfigService
- func (c *TestConfigurator) Reconfigure(StoredConfig, ...Configurable) error
- func (c *TestConfigurator) StoreConfig(sc StoredConfig) error
- func (c TestConfigurator) WithMattermostConfig(mmconfig model.Config) *TestConfigurator
Constants ¶
const ( Repository = "mattermost-plugin-apps" CommandTrigger = "apps" ManifestsFile = "manifests.json" BotUsername = "appsbot" BotDisplayName = "Mattermost Apps" BotDescription = "Mattermost Apps Registry and API proxy." )
Internal configuration apps.of mattermost-plugin-apps
const ( // TODO replace Interactive Dialogs with Modal, eliminate the need for // /dialog endpoints. InteractiveDialogPath = "/dialog" // Top-level path(s) for HTTP example apps. HelloHTTPPath = "/example/hello" // Path to the Call API // <>/<> TODO: ticket migrate to gateway PathCall = "/call" // Top-level path for the Apps namespaces, followed by /{AppID}/... PathApps = "/apps" // OAuth2 App's HTTP endpoints in the {PluginURL}/apps/{AppID} space. PathMattermostOAuth2Connect = "/oauth2/mattermost/connect" PathMattermostOAuth2Complete = "/oauth2/mattermost/complete" PathRemoteOAuth2Connect = "/oauth2/remote/connect" PathRemoteOAuth2Complete = "/oauth2/remote/complete" // Static assets are served from {PluginURL}/static/... PathStatic = "/" + apps.StaticFolder // Marketplace sub-paths. PathMarketplace = "/marketplace" WebSocketEventRefreshBindings = "refresh_bindings" )
const ( PropTeamID = "team_id" PropChannelID = "channel_id" PropPostID = "post_id" PropUserAgent = "user_agent_type" )
const ( // KVAppPrefix is the Apps global namespace. KVAppPrefix = ".k" // KVUserPrefix is the global namespase used to store OAuth2 user // records. KVUserPrefix = ".u" // KVOAuth2StatePrefix is the global namespase used to store OAuth2 // ephemeral state data. KVOAuth2StatePrefix = ".o" // KVSubPrefix is used for keys storing subscriptions. KVSubPrefix = "sub." // KVInstalledAppPrefix is used to store App records. KVInstalledAppPrefix = "app." // KVLocalManifestPrefix is used to store locally-listed manifests. KVLocalManifestPrefix = "man." // KVCallOnceKey and KVClusterMutexKey are used for invoking App Calls once, // usually upon a Mattermost instance startup. KVCallOnceKey = "CallOnce" KVClusterMutexKey = "Cluster_Mutex" )
KV namespace
Keys starting with a '.' are reserved for app-specific keys in the "hashkey" format. Hashkeys have the following format (see service_test.go#TestHashkey for examples):
- global prefix of ".X" where X is exactly 1 byte (2 bytes)
- bot user ID (26 bytes)
- app-specific prefix, limited to 2 non-space ASCII characters, right-filled with ' ' to 2 bytes.
- app-specific key hash: 16 bytes, ascii85 (20 bytes)
All other keys must start with an ASCII letter. '.' is usually used as the terminator since it is not used in the base64 representation.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildConfig ¶
type Config ¶
type Config struct { StoredConfig BuildConfig DeveloperMode bool MattermostCloudMode bool BotUserID string MattermostSiteHostname string MattermostSiteURL string PluginURL string PluginURLPath string // Maximum size of incoming remote webhook messages MaxWebhookSize int64 AWSRegion string AWSAccessKey string AWSSecretKey string AWSS3Bucket string }
Config represents the the metadata handed to all request runners (command, http).
Config should be abbreviated as `conf`.
func (*Config) Reconfigure ¶ added in v0.7.0
func (Config) SetContextDefaults ¶ added in v0.3.0
func (Config) SetContextDefaultsForApp ¶ added in v0.3.0
type Configurable ¶
type Configurable interface {
Configure(Config)
}
type Service ¶
type Service interface { GetConfig() Config GetMattermostConfig() configservice.ConfigService Reconfigure(StoredConfig, ...Configurable) error StoreConfig(sc StoredConfig) error }
Configurator should be abbreviated as `cfg`
func NewService ¶
func NewService(mattermost *pluginapi.Client, buildConfig BuildConfig, botUserID string) Service
type StoredConfig ¶
type StoredConfig struct { // InstalledApps is a list of all apps installed on the Mattermost instance. // // For each installed app, an entry of string(AppID) -> sha1(App) is added, // and the App struct is stored in KV under app_<sha1(App)>. Implementation // in `store.App`. InstalledApps map[string]string `json:"installed_apps,omitempty"` // LocalManifests is a list of locally-stored manifests. Local is in // contrast to the "global" list of manifests which in the initial version // is loaded from S3. // // For each installed app, an entry of string(AppID) -> sha1(Manifest) is // added, and the Manifest struct is stored in KV under // manifest_<sha1(Manifest)>. Implementation in `store.Manifest`. LocalManifests map[string]string `json:"local_manifests,omitempty"` }
StoredConfig represents the data stored in and managed with the Mattermost config.
StoredConfig should be abbreviated as sc.
type TestConfigurator ¶ added in v0.3.0
type TestConfigurator struct {
// contains filtered or unexported fields
}
func NewTestConfigurator ¶
func NewTestConfigurator(config Config) *TestConfigurator
func (*TestConfigurator) GetConfig ¶ added in v0.3.0
func (c *TestConfigurator) GetConfig() Config
func (*TestConfigurator) GetMattermostConfig ¶ added in v0.3.0
func (c *TestConfigurator) GetMattermostConfig() configservice.ConfigService
func (*TestConfigurator) Reconfigure ¶ added in v0.3.0
func (c *TestConfigurator) Reconfigure(StoredConfig, ...Configurable) error
func (*TestConfigurator) StoreConfig ¶ added in v0.3.0
func (c *TestConfigurator) StoreConfig(sc StoredConfig) error
func (TestConfigurator) WithMattermostConfig ¶ added in v0.3.0
func (c TestConfigurator) WithMattermostConfig(mmconfig model.Config) *TestConfigurator