config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
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"

	// Top-level path for the REST APIs exposed by the plugin itself.
	APIPath = "/api/v1"

	// Top-level path for the Apps namespaces, followed by /AppID/subpath.
	AppsPath = "/apps"

	// OAuth2 sub-paths.
	PathOAuth2         = "/oauth2"          // convention for Mattermost Apps, comes from OAuther
	PathOAuth2Complete = "/oauth2/complete" // convention for Mattermost Apps, comes from OAuther

	// Marketplace sub-paths.
	PathMarketplace = "/marketplace"

	// Other sub-paths.
	CallPath        = "/call"
	KVPath          = "/kv"
	SubscribePath   = "/subscribe"
	UnsubscribePath = "/unsubscribe"
	StaticAssetPath = "/" + apps.StaticAssetsFolder

	WebSocketEventRefreshBindings = "refresh_bindings"
)
View Source
const (
	PropTeamID    = "team_id"
	PropChannelID = "channel_id"
	PropPostID    = "post_id"
	PropUserAgent = "user_agent_type"
)
View Source
const (
	KeyCallOnce     = "CallOnce"
	KeyClusterMutex = "Cluster_Mutex"

	PrefixSubs          = "sub_"
	PrefixInstalledApp  = "app_"
	PrefixLocalManifest = "man_"
)

KV namespace

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildConfig

type BuildConfig struct {
	model.Manifest
	BuildDate      string
	BuildHash      string
	BuildHashShort string
}

type Config

type Config struct {
	StoredConfig
	BuildConfig

	BotUserID              string
	MattermostSiteHostname string
	MattermostSiteURL      string
	PluginURL              string
	PluginURLPath          string
}

Config represents the the metadata handed to all request runners (command, http).

Config should be abbreviated as `conf`.

type Configurable

type Configurable interface {
	Configure(Config)
}

type Service

type Service interface {
	GetConfig() Config
	GetMattermostConfig() *model.Config
	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

func NewTestConfigurator

func NewTestConfigurator(config *Config) 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.

Jump to

Keyboard shortcuts

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