Rudder key and dataplane in Config (#15026)

* To allow for ease of testing telemetry changes, we should make it so that the rudder key and dataplane URL can be customized through the config or environment.

* Instead of using a real config element that would be exposed to end users, we'll just use 'secret' environment variables to inject Rudder config data.

Co-authored-by: Alex Dovenmuehle <alex.dovenmuehle@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Alex Dovenmuehle
2020-08-19 10:53:39 -04:00
коммит произвёл GitHub
родитель 3fc9ed9871
Коммит 4791aca112
3 изменённых файлов: 39 добавлений и 5 удалений

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

@@ -1299,7 +1299,7 @@ func (s *Server) stopSearchEngine() {
}
// initDiagnostics initialises the Rudder client for the diagnostics system.
func (s *Server) initDiagnostics(endpoint string) {
func (s *Server) initDiagnostics(endpoint string, rudderKey string) {
if s.rudderClient == nil {
config := rudder.Config{}
config.Logger = rudder.StdLogger(s.Log.StdLog(mlog.String("source", "rudder")))
@@ -1309,7 +1309,7 @@ func (s *Server) initDiagnostics(endpoint string) {
config.Verbose = true
config.BatchSize = 1
}
client, err := rudder.NewWithConfig(RUDDER_KEY, endpoint, config)
client, err := rudder.NewWithConfig(rudderKey, endpoint, config)
if err != nil {
mlog.Error("Failed to create Rudder instance", mlog.Err(err))
return