aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/server/index.js')
-rw-r--r--vnext/server/index.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/vnext/server/index.js b/vnext/server/index.js
index b4c637bf..5bfa9070 100644
--- a/vnext/server/index.js
+++ b/vnext/server/index.js
@@ -10,11 +10,9 @@ import event from './middleware/event';
import oembed from './middleware/oembed';
import urlExpand from './middleware/urlexpand';
-const bot_token = config.get('service.durov.token');
-
const PORT = 8081;
import path from 'path';
-import { webhook } from './durov';
+import { webhook, webhookPath } from './durov';
// initialize the application and create the routes
const app = express();
@@ -25,7 +23,11 @@ const router = express.Router();
router.post('/api/sender', event);
router.get('/api/oembed', oembed);
router.get('/api/urlexpand', urlExpand);
-router.post(`/api/${bot_token}`, webhook);
+
+const durov_webhook = webhookPath();
+if (durov_webhook) {
+ router.post(`/api/${durov_webhook}`, webhook);
+}
router.use('^/$', serverRenderer);
const STATIC_ROOT = config.get('service.static_root') || path.resolve(__dirname, 'public');