config

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MattermostSessionIDHeader = "Mattermost-Session-Id"
	MattermostPluginIDHeader  = "Mattermost-Plugin-Id"
	MattermostUserIDHeader    = "Mattermost-User-Id"
)
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 (
	// Top-level path(s) for HTTP example apps.
	HelloHTTPPath = "/example/hello"

	WebSocketEventRefreshBindings = "refresh_bindings"
	WebSocketEventPluginEnabled   = "plugin_enabled"
	WebSocketEventPluginDisabled  = "plugin_disabled"
)
View Source
const (
	PropTeamID    = "team_id"
	PropChannelID = "channel_id"
	PropUserAgent = "user_agent_type"
)
View Source
const (
	RequestTimeout = time.Second * 30
)

Variables

View Source
var BuildDate string
View Source
var BuildHash string
View Source
var BuildHashShort string

Functions

This section is empty.

Types

type Config

type Config struct {
	StoredConfig

	PluginManifest model.Manifest
	BuildDate      string
	BuildHash      string
	BuildHashShort string

	MattermostCloudMode bool
	DeveloperMode       bool
	AllowHTTPApps       bool

	BotUserID          string
	MattermostSiteURL  string
	MattermostLocalURL string
	PluginURL          string
	PluginURLPath      string

	// Maximum size of incoming remote webhook messages
	MaxWebhookSize int

	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) AppURL added in v0.7.0

func (conf Config) AppURL(appID apps.AppID) string

func (Config) GetPluginVersionInfo added in v1.0.0

func (conf Config) GetPluginVersionInfo() map[string]interface{}

func (*Config) InfoTemplateData added in v1.0.0

func (conf *Config) InfoTemplateData() map[string]string

func (Config) Loggable added in v1.1.0

func (conf Config) Loggable() []interface{}

func (Config) StaticURL added in v0.7.0

func (conf Config) StaticURL(appID apps.AppID, name string) string

StaticURL returns the URL to a static asset.

type Configurable

type Configurable interface {
	Configure(Config, utils.Logger) error
}

type Service

type Service interface {
	Get() Config
	MattermostAPI() *pluginapi.Client
	MattermostConfig() configservice.ConfigService
	I18N() *i18n.Bundle
	Telemetry() *telemetry.Telemetry
	NewBaseLogger() utils.Logger
	SystemDefaultFlags() (devMode, allowHTTPApps bool)

	Reconfigure(_ StoredConfig, verbose bool, _ ...Configurable) error
	StoreConfig(StoredConfig, utils.Logger) error
}

func MakeService added in v1.2.1

func MakeService(mm *pluginapi.Client, pliginManifest model.Manifest, botUserID string, telemetry *telemetry.Telemetry, i18nBundle *i18n.Bundle, log utils.Logger) (Service, error)

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"`

	DeveloperModeOverride *bool `json:"developer_mode"`
	AllowHTTPAppsOverride *bool `json:"allow_http_apps"`

	LogChannelID    string `json:"log_channel_id,omitempty"`
	LogChannelLevel int    `json:"log_channel_level,omitempty"`
	LogChannelJSON  bool   `json:"log_channel_json,omitempty"`
}

StoredConfig represents the data stored in and managed with the Mattermost config.

StoredConfig should be abbreviated as sc.

type TestService added in v1.0.0

type TestService struct {
	// contains filtered or unexported fields
}

func NewTestConfigService added in v1.0.0

func NewTestConfigService(testConfig *Config) *TestService

func NewTestService added in v1.0.0

func NewTestService(testConfig *Config) (*TestService, *plugintest.API)

func (*TestService) Get added in v1.0.0

func (s *TestService) Get() Config

func (*TestService) I18N added in v1.0.0

func (s *TestService) I18N() *i18n.Bundle

func (*TestService) MattermostAPI added in v1.0.0

func (s *TestService) MattermostAPI() *pluginapi.Client

func (*TestService) MattermostConfig added in v1.0.0

func (s *TestService) MattermostConfig() configservice.ConfigService

func (*TestService) NewBaseLogger added in v1.2.0

func (s *TestService) NewBaseLogger() utils.Logger

func (*TestService) Reconfigure added in v1.0.0

func (s *TestService) Reconfigure(StoredConfig, bool, ...Configurable) error

func (*TestService) StoreConfig added in v1.0.0

func (s *TestService) StoreConfig(sc StoredConfig, _ utils.Logger) error

func (*TestService) SystemDefaultFlags added in v1.2.1

func (s *TestService) SystemDefaultFlags() (bool, bool)

func (*TestService) Telemetry added in v1.0.0

func (s *TestService) Telemetry() *telemetry.Telemetry

func (TestService) WithMattermostAPI added in v1.0.0

func (s TestService) WithMattermostAPI(mm *pluginapi.Client) *TestService

func (TestService) WithMattermostConfig added in v1.0.0

func (s TestService) WithMattermostConfig(mmconfig model.Config) *TestService

Jump to

Keyboard shortcuts

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