* remove feature flag managed plugins

* remove unneeded plugin blocklist

* remove unnecessary wrappers

* documentation and logging improvements

* avoid use of global logger
* leverage wrapped loggers (e.g. consistently log `plugin_id`)
* promote some logs from `Debug` to `Info` for better visibility.
* extract installPluginToFilestore
* rename some variables for consistency / clarity

* make generated
Этот коммит содержится в:
Jesse Hallam
2023-08-08 18:29:57 -03:00
коммит произвёл GitHub
родитель 0e30d0abb8
Коммит 8372267739
8 изменённых файлов: 187 добавлений и 268 удалений

Просмотреть файл

@@ -22,12 +22,6 @@ type FeatureFlags struct {
// AppsEnabled toggles the Apps framework functionalities both in server and client side
AppsEnabled bool
// Feature flags to control plugin versions
PluginPlaybooks string `plugin_id:"playbooks"`
PluginApps string `plugin_id:"com.mattermost.apps"`
PluginFocalboard string `plugin_id:"focalboard"`
PluginCalls string `plugin_id:"com.mattermost.calls"`
PermalinkPreviews bool
// CallsEnabled controls whether or not the Calls plugin should be enabled
@@ -64,8 +58,6 @@ func (f *FeatureFlags) SetDefaults() {
f.TestBoolFeature = false
f.EnableRemoteClusterService = false
f.AppsEnabled = true
f.PluginApps = ""
f.PluginFocalboard = ""
f.BoardsDataRetention = false
f.NormalizeLdapDNs = false
f.GraphQL = false
@@ -79,26 +71,6 @@ func (f *FeatureFlags) SetDefaults() {
f.DataRetentionConcurrencyEnabled = true
}
func (f *FeatureFlags) Plugins() map[string]string {
rFFVal := reflect.ValueOf(f).Elem()
rFFType := reflect.TypeOf(f).Elem()
pluginVersions := make(map[string]string)
for i := 0; i < rFFVal.NumField(); i++ {
rFieldVal := rFFVal.Field(i)
rFieldType := rFFType.Field(i)
pluginId, hasPluginId := rFieldType.Tag.Lookup("plugin_id")
if !hasPluginId {
continue
}
pluginVersions[pluginId] = rFieldVal.String()
}
return pluginVersions
}
// ToMap returns the feature flags as a map[string]string
// Supports boolean and string feature flags.
func (f *FeatureFlags) ToMap() map[string]string {

Просмотреть файл

@@ -103,34 +103,9 @@ func scanSearchPath(path string) ([]*model.BundleInfo, error) {
return ret, nil
}
var pluginIDBlocklist = map[string]bool{
"com.mattermost.plugin-incident-response": true,
"com.mattermost.plugin-incident-management": true,
}
func PluginIDIsBlocked(id string) bool {
_, ok := pluginIDBlocklist[id]
return ok
}
// Returns a list of all plugins within the environment.
func (env *Environment) Available() ([]*model.BundleInfo, error) {
rawList, err := scanSearchPath(env.pluginDir)
if err != nil {
return nil, err
}
// Filter any plugins that match the blocklist
filteredList := make([]*model.BundleInfo, 0, len(rawList))
for _, bundleInfo := range rawList {
if PluginIDIsBlocked(bundleInfo.Manifest.Id) {
env.logger.Debug("Plugin ignored by blocklist", mlog.String("plugin_id", bundleInfo.Manifest.Id))
} else {
filteredList = append(filteredList, bundleInfo)
}
}
return filteredList, nil
return scanSearchPath(env.pluginDir)
}
// Returns a list of prepackaged plugins available in the local prepackaged_plugins folder.