Skip to content

Commit

Permalink
[Node] Add warnings to all SDK example apps that would check if propp…
Browse files Browse the repository at this point in the history
…er credentials have been set or it still has the defaults. (#90)

* feat: add warning for defaults

* feat: warn
  • Loading branch information
arifBurakDemiray authored Jan 29, 2024
1 parent deb8848 commit da7465c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
11 changes: 9 additions & 2 deletions examples/apm_example.js
Original file line number Diff line number Diff line change
@@ -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
});

Expand Down
11 changes: 9 additions & 2 deletions examples/bulk_import_example.js
Original file line number Diff line number Diff line change
@@ -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
});

Expand Down
12 changes: 9 additions & 3 deletions examples/example.js
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
11 changes: 9 additions & 2 deletions examples/multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand Down

0 comments on commit da7465c

Please sign in to comment.