Forráskód Böngészése

move signs to env

isundil 6 éve
szülő
commit
4055c7d1b4
1 módosított fájl, 3 hozzáadás és 7 törlés
  1. 3 7
      horoscope.js

+ 3 - 7
horoscope.js

@@ -3,10 +3,7 @@ const req = require('request'),
     { JSDOM } = require('jsdom'),
     https = require('https');
 
-const SIGNS = {
-    "balance": [ "Pierre", "Paul" ],
-    "gemeaux": [ "Jacque" ]
-    },
+const SIGNS = JSON.parse(process.env.SIGNS),
     CHANNEL = "#jenkins-up";
 
 (function() {
@@ -31,7 +28,7 @@ const SIGNS = {
     }
 
     function horoscopesToSingleAttachment(horoscopes) {
-        const SIGNS = {
+        const signsEmojis = {
             balance: ":libra:",
             belier: ":aries:",
             taureau: ":taurus:",
@@ -47,14 +44,13 @@ const SIGNS = {
         };
         return [{
             text: horoscopes.sort((a, b) => a.sign.localeCompare(b.sign)).map(i => {
-                    return SIGNS[i.sign.toLowerCase()] +" *<" +i.source +"|" +i.sign +">*\n" +
+                    return signsEmojis[i.sign.toLowerCase()] +" *<" +i.source +"|" +i.sign +">*\n" +
                         i.text +'\n' +
                         "_" +i.people.join(", ") +"_";
                 }).join("\n\n")
         }];
     }
 
-
     function sendMsg(horoscopes) {
         const req = https.request({
             hostname: 'team-009.slack.com',