20 Commity 2075d1b4fd ... 74fa927da3

Autor SHA1 Wiadomość Data
  edmilson-dk 74fa927da3 build: finished initial state of project for build 3 lat temu
  edmilson-dk a340d76635 build: finished initial state of project for build 3 lat temu
  Edmilson Jesus db99f41ffb finshed build 3 lat temu
  Edmilson Jesus 2f3613aa03 build 3 lat temu
  Edmilson Jesus af16001d31 build 3 lat temu
  Edmilson Jesus a94799352d build 3 lat temu
  Edmilson Jesus 2b75c801ac build 3 lat temu
  Edmilson Jesus 3705f20783 build 3 lat temu
  Edmilson Jesus 6d889f1bff build 3 lat temu
  Edmilson Jesus 3e83def763 build 3 lat temu
  Edmilson Jesus 11330cc3de build 3 lat temu
  Edmilson Jesus d6e7e62d97 build 3 lat temu
  Edmilson Jesus 103b168a68 build 3 lat temu
  Edmilson Jesus ff32d27aa2 Merge pull request #10 from fortrax-br/develop 3 lat temu
  Edmilson Jesus 75e3075f97 Merge pull request #9 from fortrax-br/develop 3 lat temu
  Edmilson Jesus 06b2feac07 Merge pull request #8 from fortrax-br/develop 3 lat temu
  Edmilson Jesus c8b710840e Merge pull request #7 from fortrax-br/develop 3 lat temu
  Edmilson Jesus b9f5f871b8 Merge pull request #6 from fortrax-br/develop 3 lat temu
  Edmilson Jesus 689b9f505d Merge pull request #5 from fortrax-br/develop 3 lat temu
  Edmilson Jesus c961ef3fbd Merge pull request #4 from fortrax-br/develop 3 lat temu
2 zmienionych plików z 22 dodań i 4 usunięć
  1. 19 2
      knexfile.js
  2. 3 2
      src/commands/index.js

+ 19 - 2
knexfile.js

@@ -1,11 +1,15 @@
 require('dotenv').config();
 
+const pg = require('pg');
+pg.defaults.ssl = {
+  rejectUnauthorized: false,
+};
 
 module.exports = {
   development: {
     client: process.env.DB_CLIENT,
     connection: {
-      host: process.env.DATABASE_URL,
+      host: process.env.DB_HOST,
       database: process.env.DATABASE,
       user: process.env.DB_USERNAME,
       password: process.env.DB_PASSWORD,
@@ -19,4 +23,17 @@ module.exports = {
       directory: process.env.MIGRATIONS
     }
   },
-};
+  production: {
+    client: process.env.DB_CLIENT,
+    connection: process.env.DATABASE_URL,
+    ssl: { rejectUnauthorized: false },
+    pool: {
+      min: 2,
+      max: 10
+    },
+    migrations: {
+      tableName: 'knex_migrations',
+      directory: process.env.MIGRATIONS
+    }
+  },
+}

+ 3 - 2
src/commands/index.js

@@ -199,6 +199,9 @@ module.exports = bot => {
   async function removeFeedCommand(ctx, finishedViewChatCmd) {
     const feedTitle = removeCommand(ctx.message.text, '/remove');
 
+    const userId = String(ctx.message.from.id);
+    const chatId = await chatRepository.getIsActiveConfigChat(userId);
+
     if (!feedTitle) {
       ctx.telegram.sendMessage(getChatId(ctx), remove_feed.cmd_error, { parse_mode: 'HTML'});
       return;
@@ -208,8 +211,6 @@ module.exports = bot => {
       return;
     }
 
-    const userId = String(ctx.message.from.id);
-    const chatId = await chatRepository.getIsActiveConfigChat(userId);
     await feedRepository.dropFeed(feedTitle, chatId);
 
     ctx.reply(remove_feed.success);