Skip to content

Commit

Permalink
Removed process.env.TELEGRAM_WEBHOOK_URL as it's an aesthetic variable (
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxingloh authored Oct 19, 2020
1 parent 9e92b01 commit 23c82bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
1 change: 0 additions & 1 deletion sadeaf-web/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ module.exports = {
},
TELEGRAM: {
WEBHOOK_ENDPOINT: process.env.TELEGRAM_WEBHOOK_ENDPOINT || 'http://localhost:4001/',
WEBHOOK_URL: process.env.TELEGRAM_WEBHOOK_URL || 'https://sadeaftest.tunnelto.dev/_telegram/webhook',
BASE_URL: `https://api.telegram.org/bot${process.env.SADEAF_TELEGRAM_API_KEY}`,
},
BOOTSTRAP: {
Expand Down
21 changes: 10 additions & 11 deletions sadeaf-web/telegram/server.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import express from 'express';
import bodyParser from 'body-parser';
import { PRODUCTION } from '../config';
import { INVALID_MESSAGE } from './registration-messages';
import { getRegisterMessage, getStartMessage } from './actions';

const {
TELEGRAM: { WEBHOOK_URL },
} = require('../config');
const { PRODUCTION } = require('../config');

export default {
async start(port) {
Expand Down Expand Up @@ -53,14 +50,16 @@ export default {

return new Promise((resolve, reject) => {
app.listen(port, (err) => {
if (err) reject(err);
else {
if (!PRODUCTION) {
console.warn('Remember to install tunnelto and run -> tunnelto --port 3000 -s sadeaftest');
}
console.log(`Telegram webhook listening on: ${WEBHOOK_URL}`);
resolve();
if (err) {
return reject(err);
}

if (!PRODUCTION) {
console.warn('Remember to install tunnelto and run -> tunnelto --port 3000 -s sadeaftest');
console.warn(`Telegram webhook listening on: https://sadeaftest.tunnelto.dev/_telegram/webhook`);
}

resolve();
});
});
},
Expand Down

0 comments on commit 23c82bf

Please sign in to comment.