diff --git a/docker-compose.yml b/docker-compose.yml index 579295fb7a88a..18622eb0ad0d9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -120,6 +120,10 @@ services: - ./superset-websocket:/home/superset-websocket - /home/superset-websocket/node_modules - /home/superset-websocket/dist + + # Mounting a config file that contains a dummy secret required to boot up. + # do no not use this docker-compose in production + - ./docker/superset-websocket/config.json:/home/superset-websocket/config.json environment: - PORT=8080 - REDIS_HOST=redis diff --git a/docker/superset-websocket/config.json b/docker/superset-websocket/config.json new file mode 100644 index 0000000000000..8f6afdcc22aeb --- /dev/null +++ b/docker/superset-websocket/config.json @@ -0,0 +1,22 @@ +{ + "port": 8080, + "logLevel": "info", + "logToFile": false, + "logFilename": "app.log", + "statsd": { + "host": "127.0.0.1", + "port": 8125, + "globalTags": [] + }, + "redis": { + "port": 6379, + "host": "127.0.0.1", + "password": "", + "db": 0, + "ssl": false + }, + "redisStreamPrefix": "async-events-", + "jwtAlgorithms": ["HS256"], + "jwtSecret": "CHANGE-ME-IN-PRODUCTION-GOTTA-BE-LONG-AND-SECRET", + "jwtCookieName": "async-token" +} diff --git a/superset-websocket/src/index.ts b/superset-websocket/src/index.ts index ced46f18bbabf..96d056a92ff3c 100644 --- a/superset-websocket/src/index.ts +++ b/superset-websocket/src/index.ts @@ -94,8 +94,17 @@ export const statsd = new StatsD({ }); // enforce JWT secret length -if (startServer && opts.jwtSecret.length < 32) - throw new Error('Please provide a JWT secret at least 32 bytes long'); +if (startServer && opts.jwtSecret.length < 32) { + console.error('ERROR: Please provide a JWT secret at least 32 bytes long'); + process.exit(1); +} + +if (startServer && opts.jwtSecret.startsWith('CHANGE-ME')) { + console.warn( + 'WARNING: it appears you secret in your config.json is insecure', + ); + console.warn('DO NOT USE IN PRODUCTION'); +} export const buildRedisOpts = (baseConfig: RedisConfig) => { const redisOpts: RedisOptions = {