chore: Remove WEBSOCKETS_ENABLED flag (#1383)
* chore: Remove WEBSOCKETS_ENALBED flag * lint
This commit is contained in:
@ -18,7 +18,6 @@ PORT=3000
|
|||||||
FORCE_HTTPS=true
|
FORCE_HTTPS=true
|
||||||
|
|
||||||
ENABLE_UPDATES=true
|
ENABLE_UPDATES=true
|
||||||
WEBSOCKETS_ENABLED=true
|
|
||||||
DEBUG=cache,presenters,events
|
DEBUG=cache,presenters,events
|
||||||
|
|
||||||
# Third party signin credentials (at least one is required)
|
# Third party signin credentials (at least one is required)
|
||||||
|
5
app.json
5
app.json
@ -39,11 +39,6 @@
|
|||||||
"value": "true",
|
"value": "true",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"WEBSOCKETS_ENABLED": {
|
|
||||||
"value": "true",
|
|
||||||
"required": true,
|
|
||||||
"description": "Allow realtime data to be pushed to clients over websockets"
|
|
||||||
},
|
|
||||||
"URL": {
|
"URL": {
|
||||||
"description": "https://{your app name}.herokuapp.com",
|
"description": "https://{your app name}.herokuapp.com",
|
||||||
"required": true
|
"required": true
|
||||||
|
@ -13,7 +13,6 @@ import PoliciesStore from "stores/PoliciesStore";
|
|||||||
import ViewsStore from "stores/ViewsStore";
|
import ViewsStore from "stores/ViewsStore";
|
||||||
import AuthStore from "stores/AuthStore";
|
import AuthStore from "stores/AuthStore";
|
||||||
import UiStore from "stores/UiStore";
|
import UiStore from "stores/UiStore";
|
||||||
import env from "env";
|
|
||||||
|
|
||||||
export const SocketContext: any = React.createContext();
|
export const SocketContext: any = React.createContext();
|
||||||
|
|
||||||
@ -35,8 +34,6 @@ class SocketProvider extends React.Component<Props> {
|
|||||||
@observable socket;
|
@observable socket;
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (!env.WEBSOCKETS_ENABLED) return;
|
|
||||||
|
|
||||||
this.socket = io(window.location.origin, {
|
this.socket = io(window.location.origin, {
|
||||||
path: "/realtime",
|
path: "/realtime",
|
||||||
});
|
});
|
||||||
|
6
index.js
6
index.js
@ -62,12 +62,6 @@ if (!process.env.REDIS_URL) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!process.env.WEBSOCKETS_ENABLED) {
|
|
||||||
console.log(
|
|
||||||
"WARNING: Websockets are disabled. Set WEBSOCKETS_ENABLED env variable to true to enable"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "production") {
|
if (process.env.NODE_ENV === "production") {
|
||||||
console.log("\n\x1b[33m%s\x1b[0m", "Running Outline in production mode.");
|
console.log("\n\x1b[33m%s\x1b[0m", "Running Outline in production mode.");
|
||||||
} else if (process.env.NODE_ENV === "development") {
|
} else if (process.env.NODE_ENV === "development") {
|
||||||
|
@ -7,6 +7,5 @@ export default {
|
|||||||
SLACK_KEY: process.env.SLACK_KEY,
|
SLACK_KEY: process.env.SLACK_KEY,
|
||||||
SLACK_APP_ID: process.env.SLACK_APP_ID,
|
SLACK_APP_ID: process.env.SLACK_APP_ID,
|
||||||
SUBDOMAINS_ENABLED: process.env.SUBDOMAINS_ENABLED === "true",
|
SUBDOMAINS_ENABLED: process.env.SUBDOMAINS_ENABLED === "true",
|
||||||
WEBSOCKETS_ENABLED: process.env.WEBSOCKETS_ENABLED === "true",
|
|
||||||
GOOGLE_ANALYTICS_ID: process.env.GOOGLE_ANALYTICS_ID,
|
GOOGLE_ANALYTICS_ID: process.env.GOOGLE_ANALYTICS_ID,
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,6 @@ import policy from "./policies";
|
|||||||
const server = http.createServer(app.callback());
|
const server = http.createServer(app.callback());
|
||||||
let io;
|
let io;
|
||||||
|
|
||||||
if (process.env.WEBSOCKETS_ENABLED === "true") {
|
|
||||||
const { can } = policy;
|
const { can } = policy;
|
||||||
|
|
||||||
io = IO(server, {
|
io = IO(server, {
|
||||||
@ -173,7 +172,6 @@ if (process.env.WEBSOCKETS_ENABLED === "true") {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
server.on("error", err => {
|
server.on("error", err => {
|
||||||
throw err;
|
throw err;
|
||||||
|
@ -13,7 +13,9 @@ import subHours from "date-fns/sub_hours";
|
|||||||
|
|
||||||
export default class Websockets {
|
export default class Websockets {
|
||||||
async on(event: Event) {
|
async on(event: Event) {
|
||||||
if (process.env.WEBSOCKETS_ENABLED !== "true" || !socketio) return;
|
if (!socketio) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (event.name) {
|
switch (event.name) {
|
||||||
case "documents.publish":
|
case "documents.publish":
|
||||||
|
Reference in New Issue
Block a user