Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
67 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,7 @@ resources/overlay/js/port.js | |
eslint.log.htm | ||
doc/ | ||
*.iws | ||
keys.json | ||
secrets.json | ||
|
||
# Editors | ||
.idea/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"use strict"; | ||
|
||
const logger = require("./logwrapper"); | ||
|
||
/** | ||
* @typedef FirebotSecrets | ||
* @property {string} twitchClientId | ||
* @property {string} twitchClientSecret | ||
* @property {string} tipeeeStreamClientId | ||
* @property {string} tipeeeStreamClientSecret | ||
* @property {string} streamLabsClientId | ||
* @property {string} streamLabsClientSecret | ||
*/ | ||
|
||
exports.testSecrets = () => { | ||
try { | ||
/**@type {FirebotSecrets} */ | ||
const secrets = require("../secrets.json") || {}; | ||
|
||
/**@type {(keyof FirebotSecrets)[]} */ | ||
const expected = [ | ||
"twitchClientId", | ||
"twitchClientSecret", | ||
"tipeeeStreamClientId", | ||
"tipeeeStreamClientSecret", | ||
"streamLabsClientId", | ||
"streamLabsClientSecret" | ||
]; | ||
const missing = expected.filter(k => secrets[k] == null); | ||
|
||
if (missing.length) { | ||
logger.error(`secrets.json is missing the following keys: ${missing.join(", ")}`); | ||
return false; | ||
} | ||
|
||
return true; | ||
} catch (err) { | ||
logger.error("Unable to find secrets.json in the root directory. Please create it."); | ||
return false; | ||
} | ||
}; | ||
|
||
/**@type {FirebotSecrets} */ | ||
let secrets = {}; | ||
try { | ||
secrets = require("../secrets.json"); | ||
} catch (error) { | ||
//silently fail | ||
} | ||
|
||
exports.secrets = secrets; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters