(cobra2sentry bot) take a sentry client as input instead of a dsn
This commit is contained in:
		@@ -9,7 +9,6 @@
 | 
			
		||||
 | 
			
		||||
#include <chrono>
 | 
			
		||||
#include <ixcobra/IXCobraConnection.h>
 | 
			
		||||
#include <ixsentry/IXSentryClient.h>
 | 
			
		||||
#include <spdlog/spdlog.h>
 | 
			
		||||
#include <sstream>
 | 
			
		||||
#include <thread>
 | 
			
		||||
@@ -20,7 +19,7 @@ namespace ix
 | 
			
		||||
    int cobra_to_sentry_bot(const CobraConfig& config,
 | 
			
		||||
                            const std::string& channel,
 | 
			
		||||
                            const std::string& filter,
 | 
			
		||||
                            const std::string& dsn,
 | 
			
		||||
                            SentryClient& sentryClient,
 | 
			
		||||
                            bool verbose,
 | 
			
		||||
                            bool strict,
 | 
			
		||||
                            size_t maxQueueSize,
 | 
			
		||||
@@ -84,8 +83,7 @@ namespace ix
 | 
			
		||||
        std::thread t2(heartbeat);
 | 
			
		||||
 | 
			
		||||
        auto sentrySender =
 | 
			
		||||
            [&queueManager, verbose, &errorSending, &sentCount, &stop, &throttled, &dsn] {
 | 
			
		||||
                SentryClient sentryClient(dsn);
 | 
			
		||||
            [&queueManager, verbose, &errorSending, &sentCount, &stop, &throttled, &sentryClient] {
 | 
			
		||||
 | 
			
		||||
                while (true)
 | 
			
		||||
                {
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <ixcobra/IXCobraConfig.h>
 | 
			
		||||
#include <ixsentry/IXSentryClient.h>
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
namespace ix
 | 
			
		||||
@@ -13,7 +14,7 @@ namespace ix
 | 
			
		||||
    int cobra_to_sentry_bot(const CobraConfig& config,
 | 
			
		||||
                            const std::string& channel,
 | 
			
		||||
                            const std::string& filter,
 | 
			
		||||
                            const std::string& dsn,
 | 
			
		||||
                            SentryClient& sentryClient,
 | 
			
		||||
                            bool verbose,
 | 
			
		||||
                            bool strict,
 | 
			
		||||
                            size_t maxQueueSize,
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,7 @@
 | 
			
		||||
#include <ixsnake/IXSnakeServer.h>
 | 
			
		||||
#include <ixwebsocket/IXHttpServer.h>
 | 
			
		||||
#include <ixwebsocket/IXUserAgent.h>
 | 
			
		||||
#include <ixsentry/IXSentryClient.h>
 | 
			
		||||
 | 
			
		||||
using namespace ix;
 | 
			
		||||
 | 
			
		||||
@@ -157,13 +158,15 @@ TEST_CASE("Cobra_to_sentry_bot", "[foo]")
 | 
			
		||||
        oss << scheme << "xxxxxxx:yyyyyyy@localhost:" << sentryPort << "/1234567";
 | 
			
		||||
        std::string dsn = oss.str();
 | 
			
		||||
 | 
			
		||||
        SentryClient sentryClient(dsn);
 | 
			
		||||
 | 
			
		||||
        // Only run the bot for 3 seconds
 | 
			
		||||
        int runtime = 3;
 | 
			
		||||
 | 
			
		||||
        int sentCount = cobra_to_sentry_bot(config,
 | 
			
		||||
                                            channel,
 | 
			
		||||
                                            filter,
 | 
			
		||||
                                            dsn,
 | 
			
		||||
                                            sentryClient,
 | 
			
		||||
                                            verbose,
 | 
			
		||||
                                            strict,
 | 
			
		||||
                                            maxQueueSize,
 | 
			
		||||
 
 | 
			
		||||
@@ -17,6 +17,7 @@
 | 
			
		||||
#include <ixwebsocket/IXNetSystem.h>
 | 
			
		||||
#include <ixwebsocket/IXSocket.h>
 | 
			
		||||
#include <ixwebsocket/IXUserAgent.h>
 | 
			
		||||
#include <ixsentry/IXSentryClient.h>
 | 
			
		||||
#include <spdlog/spdlog.h>
 | 
			
		||||
#include <sstream>
 | 
			
		||||
#include <string>
 | 
			
		||||
@@ -447,10 +448,12 @@ int main(int argc, char** argv)
 | 
			
		||||
    {
 | 
			
		||||
        bool enableHeartbeat = true;
 | 
			
		||||
        int runtime = -1;
 | 
			
		||||
        ix::SentryClient sentryClient(dsn);
 | 
			
		||||
 | 
			
		||||
        ret = ix::cobra_to_sentry_bot(cobraConfig,
 | 
			
		||||
                                      channel,
 | 
			
		||||
                                      filter,
 | 
			
		||||
                                      dsn,
 | 
			
		||||
                                      sentryClient,
 | 
			
		||||
                                      verbose,
 | 
			
		||||
                                      strict,
 | 
			
		||||
                                      maxQueueSize,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user