From 65817e13c7900ea81947e40e177459cfea8acee4 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 2 Aug 2017 01:36:54 -0700 Subject: PLT-6965 jira integration (plus plugin scaffolding) (#6918) * plugin scaffolding / jira integration * add vendored testify packages * webhook fix * don't change i18n ids * support configuration watching * add basic jira plugin configuration to admin console * fix eslint errors * fix another eslint warning * polish * undo unintentional config.json commit >:( * test fix * add jira plugin diagnostics, remove dm support, add bot tag, generate web-safe secrets * rebase, implement requested changes * requested changes * remove tests and minimize makefile change * add missing license headers * add missing comma * remove bad line from Makefile --- app/diagnostics.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'app/diagnostics.go') diff --git a/app/diagnostics.go b/app/diagnostics.go index 603ceb8a5..a22e87587 100644 --- a/app/diagnostics.go +++ b/app/diagnostics.go @@ -4,6 +4,7 @@ package app import ( + "encoding/json" "log" "os" "runtime" @@ -38,6 +39,7 @@ const ( TRACK_CONFIG_ANALYTICS = "config_analytics" TRACK_CONFIG_ANNOUNCEMENT = "config_announcement" TRACK_CONFIG_ELASTICSEARCH = "config_elasticsearch" + TRACK_CONFIG_PLUGIN = "config_plugin" TRACK_ACTIVITY = "activity" TRACK_LICENSE = "license" @@ -87,6 +89,23 @@ func isDefault(setting interface{}, defaultValue interface{}) bool { return false } +func pluginSetting(plugin, key string, defaultValue interface{}) interface{} { + settings, ok := utils.Cfg.PluginSettings.Plugins[plugin] + if !ok { + return defaultValue + } + var m map[string]interface{} + if b, err := json.Marshal(settings); err != nil { + return defaultValue + } else { + json.Unmarshal(b, &m) + } + if value, ok := m[key]; ok { + return value + } + return defaultValue +} + func trackActivity() { var userCount int64 var activeUserCount int64 @@ -393,6 +412,10 @@ func trackConfig() { "enable_searching": *utils.Cfg.ElasticsearchSettings.EnableSearching, "sniff": *utils.Cfg.ElasticsearchSettings.Sniff, }) + + SendDiagnostic(TRACK_CONFIG_PLUGIN, map[string]interface{}{ + "enable_jira": pluginSetting("jira", "enabled", false), + }) } func trackLicense() { -- cgit v1.2.3-1-g7c22