diff --git a/bin/u-wave-core b/bin/u-wave-core index b4a2d6c3..7c218bec 100755 --- a/bin/u-wave-core +++ b/bin/u-wave-core @@ -6,6 +6,7 @@ const Ajv = require('ajv').default; const addFormats = require('ajv-formats').default; const ytSource = require('u-wave-source-youtube'); const scSource = require('u-wave-source-soundcloud'); +const announce = require('u-wave-announce'); const uwave = require('..'); const pkg = require('../package.json'); const argv = require('minimist')(process.argv.slice(2)); @@ -70,6 +71,10 @@ if (argv.h || argv.help || !validConfig) { console.log(' URL of the Redis instance to connect to. Defaults to redis://localhost:6379/.'); console.log(' MONGODB_URL'); console.log(' URL of the MongoDB database to use. Defaults to mongodb://localhost:27017/uwave.'); + console.log(' YOUTUBE_API_KEY [optional]'); + console.log(' Your YouTube Data API key.'); + console.log(' SOUNDCLOUD_API_KEY [optional]'); + console.log(' Your SoundCloud API key.'); console.log(); } @@ -109,6 +114,8 @@ uw.on('redisError', (err) => { throw explain(err, 'Could not connect to the Redis server. Is it installed and running?'); }); +uw.use(announce); + if (config.YOUTUBE_API_KEY) { uw.source(ytSource, { key: config.YOUTUBE_API_KEY, diff --git a/dev/u-wave-dev-server b/dev/u-wave-dev-server index 409f282e..6cc9689e 100755 --- a/dev/u-wave-dev-server +++ b/dev/u-wave-dev-server @@ -59,12 +59,10 @@ async function start() { throw explain(err, 'Could not connect to the Redis server. Is it installed and running?'); }); - if (process.env.HUB_URL) { - uw.use(announce, { - // Generate a random one in a real app! - seed: Buffer.from('8286a5e55c62d93a042b8c56c8face52c05354c288807d941751f0e9060c2ded', 'hex'), - }); - } + uw.use(announce, { + // Omit this in a real app: it will auto-generate one for you. + seed: Buffer.from('8286a5e55c62d93a042b8c56c8face52c05354c288807d941751f0e9060c2ded', 'hex'), + }); uw.use(async (uw) => { if (process.env.YOUTUBE_API_KEY) { diff --git a/package.json b/package.json index 2b05d18f..79b8f94f 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "router": "^1.3.3", "secure-json-parse": "^2.1.0", "transliteration": "^2.1.11", + "u-wave-announce": "^0.5.1", "u-wave-source-soundcloud": "^2.0.0", "u-wave-source-youtube": "^1.3.0", "ultron": "^1.1.1", @@ -74,8 +75,7 @@ "nodemon": "^2.0.2", "recaptcha-test-keys": "^1.0.0", "sinon": "^9.0.0", - "supertest": "^6.1.3", - "u-wave-announce": "^0.4.0" + "supertest": "^6.1.3" }, "scripts": { "test:mocha": "mocha --exit", diff --git a/src/plugins/configStore.js b/src/plugins/configStore.js index bc2f2096..9efa7b34 100644 --- a/src/plugins/configStore.js +++ b/src/plugins/configStore.js @@ -97,6 +97,7 @@ class ConfigStore { if (!validate) return undefined; const config = (await this.load(key)) || {}; + // Allowed to fail--just fills in defaults validate(config); return config;