diff options
author | Vitaly Takmazov | 2023-03-07 13:04:37 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-03-07 13:04:37 +0300 |
commit | 5d31fffc321717afb6c0cbb0f5dab9bd8f844eda (patch) | |
tree | 3bd96dc3ec6bb5e63a8442992c04f6c96ec35cff /vnext/server/index.js | |
parent | b4ce703820264a7ed16b5b3efee973aadc43335d (diff) |
Conditional modules initialization
Diffstat (limited to 'vnext/server/index.js')
-rw-r--r-- | vnext/server/index.js | 10 |
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'); |