Added optional xivApiKey to CardCreator
This commit is contained in:
parent
e6d9d10182
commit
2023697686
2 changed files with 4 additions and 2 deletions
|
@ -91,8 +91,10 @@ class CardCreator {
|
||||||
/**
|
/**
|
||||||
* Creates a new card creator.
|
* Creates a new card creator.
|
||||||
* @constructor
|
* @constructor
|
||||||
|
* @param {string} [xivApiKey] The API key for the XIV API to be used in all requests.
|
||||||
*/
|
*/
|
||||||
constructor() {
|
constructor(xivApiKey = undefined) {
|
||||||
|
this.xivApiKey = typeof xivApiKey === 'string' && xivApiKey !== '' ? xivApiKey : undefined;
|
||||||
this.isInit = false;
|
this.isInit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
index.js
2
index.js
|
@ -11,7 +11,7 @@ const xivApiKey = typeof process.env.XIV_API_KEY === 'string' && process.env.XIV
|
||||||
const supportedLanguages = ['en', 'ja', 'de', 'fr'];
|
const supportedLanguages = ['en', 'ja', 'de', 'fr'];
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const creator = new CardCreator();
|
const creator = new CardCreator(xivApiKey);
|
||||||
|
|
||||||
// Initialize caching on disk
|
// Initialize caching on disk
|
||||||
const diskCache = cacheManager.caching({
|
const diskCache = cacheManager.caching({
|
||||||
|
|
Loading…
Reference in a new issue