From da7465c58f9217fbd976ea04407b93a2471cbfe7 Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray <57103426+arifBurakDemiray@users.noreply.github.com> Date: Mon, 29 Jan 2024 13:34:40 +0000 Subject: [PATCH] [Node] Add warnings to all SDK example apps that would check if propper credentials have been set or it still has the defaults. (#90) * feat: add warning for defaults * feat: warn --- examples/apm_example.js | 11 +++++++++-- examples/bulk_import_example.js | 11 +++++++++-- examples/example.js | 12 +++++++++--- examples/multi-process.js | 11 +++++++++-- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/examples/apm_example.js b/examples/apm_example.js index be2da01..93d9163 100644 --- a/examples/apm_example.js +++ b/examples/apm_example.js @@ -1,10 +1,17 @@ //since we need to test crashing the app /*global app*/ +const COUNTLY_SERVER_KEY = "https://your.server.ly"; +const COUNTLY_APP_KEY = "YOUR_APP_KEY"; + +if(COUNTLY_APP_KEY === "YOUR_APP_KEY" || COUNTLY_SERVER_KEY === "https://your.server.ly"){ + console.warn("Please do not use default set of app key and server url") +} + var Countly = require("../lib/countly.js"); Countly.init({ - app_key: "YOUR_APP_KEY", - url: "https://try.count.ly", //your server goes here + app_key: COUNTLY_APP_KEY, + url: COUNTLY_SERVER_KEY, //your server goes here debug: true }); diff --git a/examples/bulk_import_example.js b/examples/bulk_import_example.js index 83da019..65a9d76 100644 --- a/examples/bulk_import_example.js +++ b/examples/bulk_import_example.js @@ -1,8 +1,15 @@ +const COUNTLY_SERVER_KEY = "https://your.server.ly"; +const COUNTLY_APP_KEY = "YOUR_APP_KEY"; + +if(COUNTLY_APP_KEY === "YOUR_APP_KEY" || COUNTLY_SERVER_KEY === "https://your.server.ly"){ + console.warn("Please do not use default set of app key and server url") +} + var CountlyBulk = require("../lib/countly").Bulk; var server = new CountlyBulk({ - app_key: "YOUR_APP_KEY", - url: "https://try.count.ly", //your server goes here + app_key: COUNTLY_APP_KEY, + url: COUNTLY_SERVER_KEY, //your server goes here debug: true }); diff --git a/examples/example.js b/examples/example.js index 65fdd35..635f7e7 100644 --- a/examples/example.js +++ b/examples/example.js @@ -1,14 +1,20 @@ //since we need to test crashing the app /*global runthis, crashDaApp*/ +const COUNTLY_SERVER_KEY = "https://your.server.ly"; +const COUNTLY_APP_KEY = "YOUR_APP_KEY"; + +if(COUNTLY_APP_KEY === "YOUR_APP_KEY" || COUNTLY_SERVER_KEY === "https://your.server.ly"){ + console.warn("Please do not use default set of app key and server url") +} + var Countly = require("../lib/countly.js"); Countly.init({ - app_key: "YOUR_APP_KEY", - url: "https://try.count.ly", //your server goes here + app_key: COUNTLY_APP_KEY, + url: COUNTLY_SERVER_KEY, //your server goes here debug: true }); - Countly.begin_session(); Countly.track_errors(); diff --git a/examples/multi-process.js b/examples/multi-process.js index 5e1e711..59086fe 100644 --- a/examples/multi-process.js +++ b/examples/multi-process.js @@ -13,11 +13,18 @@ else if (cluster.isWorker) { console.log("I am worker " + cluster.worker.id); } +const COUNTLY_SERVER_KEY = "https://your.server.ly"; +const COUNTLY_APP_KEY = "YOUR_APP_KEY"; + +if(COUNTLY_APP_KEY === "YOUR_APP_KEY" || COUNTLY_SERVER_KEY === "https://your.server.ly"){ + console.warn("Please do not use default set of app key and server url") +} + var Countly = require("../lib/countly.js"); Countly.init({ - app_key: "YOUR_APP_KEY", - url: "https://try.count.ly", //your server goes here + app_key: COUNTLY_APP_KEY, + url: COUNTLY_SERVER_KEY, //your server goes here debug: true });