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