// still in app.js
const node_env = process.env.NODE_ENV || 'production';
var file = `.env.${node_env}`;

// GLOBALI (Uguali per TUTTI)
process.env.LINKVERIF_REG = '/vreg';
process.env.LINK_REQUEST_NEWPASSWORD = '/requestnewpwd';
process.env.LINK_UPDATE_PASSWORD = '/updatepassword';
process.env.LINK_UPDATE_PWD = '/updatepwd';
process.env.LINK_CHECK_UPDATES = '/checkupdates';
process.env.KEY_APP_ID = 'KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF';

console.log("FILE : " + file);
require('dotenv').config({ path: file });

process.env.DATABASE = process.env.DATABASE || 'FreePlanet';

process.env.MONGODB_URI = process.env.DOMAIN + process.env.DATABASE;

if (process.env.NODE_ENV === 'production') {
  // ----------------  AMBIENTE DI PRODUZIONE !!!!!!!!!!  --------------------
  MYAPPS = [
    {
      idapp: '1',
      name: 'FreePlanet',
      adminemail: 'paolo.arena77@gmail.com',
      manageremail: '',
      replyTo: 'paolo.arena77@gmail.com',
      host: 'https://freeplanet.app',
      portapp: '0',
      dir: '/var/www/www.freeplanet.app',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '2',
      name: 'Associazione Shen',
      adminemail: 'pao.loarena77@gmail.com',
      manageremail: 'info@associazioneshen.it',
      replyTo: 'info@associazioneshen.it',
      host: 'https://www.associazioneshen.it',
      portapp: '0',
      dir: '/var/www/associazioneshen.it',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '3',
      name: 'Brigitte MG Dumont',
      adminemail: '',
      manageremail: '',
      replyTo: '',
      host: 'http://brigittemgdumont.com',
      portapp: '0',
      dir: '',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '4',
      name: 'Mandala Solidale',
      adminemail: 'pao.loarena77@gmail.com',
      manageremail: '',
      replyTo: '',
      host: 'https://mandala.freeplanet.app',
      portapp: '0',
      dir: '/var/www/mandala.freeplanet.app',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '6',
      name: 'Mandala per l\'Anima',
      adminemail: '',
      manageremail: '',
      replyTo: '',
      host: 'http://mandalaperlanima.eu',
      portapp: '0',
      dir: '',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '7',
      name: 'Ayni',
      adminemail: 'ayni.gifteconomy@gmail.com',
      manageremail: '',
      replyTo: '',
      host: 'https://ayni.gifteconomy.app',
      portapp: '0',
      dir: '/var/www/ayni.gifteconomy.app',
      email_from: 'ayni.gifteconomy@gmail.com',
      email_pwd: 'b72b121f6fb69f7c58a269f5b5110e179430cd6fa940a168c2c10b255aa75fd1ebql9yXWoH1LwANdHD7Yvw==',
      telegram_key:'1037577457:AAGQbdIuYoB838v61ewJ0Hearx9UPpTBhMI',
      telegram_bot_name: 'notevoleaynibot',
      pathreg_add:'_ayni',
      abilitanave: true,
    },
    {
      idapp: '8',
      name: 'CentrOlistico Rimini',
      adminemail: 'pao.loarena77@gmail.com',
      manageremail: '',
      replyTo: 'info@arcodiluce.it',
      host: 'https://www.centrolisticorimini.it',
      portapp: '0',
      dir: '/var/www/centrolisticorimini.it',
      email_from: 'info.pianetalibero@gmail.com',  // ++TODO: Sarà da cambiare email d'invio !?!?!?
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '9',
      name: 'SalviamoIlPianeta',
      adminemail: 'salviamoilpianeta2020@gmail.com',
      manageremail: '',
      replyTo: '',
      host: 'https://salviamoilpianeta.app',
      portapp: '0',
      dir: '/var/www/salviamoilpianeta.app',
      email_from: 'salviamoilpianeta2020@gmail.com',
      email_pwd: 'c6f63e7aba9393c73f56e338a7fe5283a73949363662d26bd375dd05b6f6f37ebkw4vINQ0O/4d8JN71aNH3UsyndeFRgyyMvJMVl4iOk=',
      telegram_key:'1202788747:AAErwzIsD7k-3Yj5AX6ci3p7ELMuyASq4vA',
      telegram_bot_name: 'SalviamoIlPianeta_bot',
      pathreg_add:'_sip',
      abilitanave: false,
    },
  ];
} else if (process.env.NODE_ENV === 'test') {
   // ----------------  AMBIENTE DI TEST  --------------------
  MYAPPS = [
    {
      idapp: '1',
      name: 'FreePlanet',
      adminemail: 'paolo.arena77@gmail.com',
      manageremail: '',
      replyTo: 'paolo.arena77@gmail.com',
      host: 'https://test.freeplanet.app',
      portapp: '0',
      dir: '/var/www/www.freeplanet.app',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '2',
      name: 'Associazione Shen',
      adminemail: 'pao.loarena77@gmail.com',
      manageremail: '',
      replyTo: 'info@associazioneshen.it',
      host: 'http://test.associazioneshen.it',
      portapp: '0',
      dir: '/var/www/associazioneshen.it',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '3',
      name: 'Brigitte MG Dumont',
      adminemail: 'pao.loarena77@gmail.com',
      manageremail: '',
      host: 'http://test.brigittemgdumont.com',
      portapp: '0',
      dir: '',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '4',
      name: 'Mandala Solidale',
      adminemail: '',
      manageremail: '',
      host: 'https://mandala.freeplanet.app',
      portapp: '0',
      dir: '/var/www/mandalatest.freeplanet.app',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '6',
      name: 'Mandala per l\'Anima',
      adminemail: '',
      manageremail: '',
      host: 'http://test.mandalaperlanima.eu',
      portapp: '0',
      dir: '',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '7',
      name: 'Ayni (Server Test)',
      adminemail: 'pao.loarena77@gmail.com',
      manageremail: '',
      host: 'https://test.gifteconomy.app',
      portapp: '0',
      dir: '/var/www/test.gifteconomy.app',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'1011893908:AAEThZB3fVPw8P5gTCFgTEsDmY21DdbV1Cw',
      telegram_bot_name: 'testnotevoleaynibot',
      pathreg_add:'_ayni',
      abilitanave: true,
    },
    {
      idapp: '8',
      name: 'CentrOlistico Rimini',
      adminemail: 'pao.loarena77@gmail.com',
      manageremail: '',
      replyTo: 'info@arcodiluce.it',
      host: 'https://www.centrolisticorimini.it',
      portapp: '0',
      dir: '/var/www/centrolisticorimini.it',
      email_from: 'info.pianetalibero@gmail.com',  // ++TODO: Sarà da cambiare email d'invio !?!?!?
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '9',
      name: 'SalviamoIlPianeta (Server Test)',
      adminemail: 'info.pianetalibero@gmail.com',
      manageremail: '',
      replyTo: '',
      host: 'https://test.salviamoilpianeta.app',
      portapp: '0',
      dir: '/var/www/test.salviamoilpianeta.app',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'_sip',
      abilitanave: false,
    },
  ];
} else {
  // ----------------  AMBIENTE IN  L O C A L E  --------------------
  MYAPPS = [
    {
      idapp: '1',
      name: 'FreePlanet',
      adminemail: 'paolo.arena77@gmail.com',
      manageremail: '',
      replyTo: 'paolo.arena77@gmail.com',
      host: 'http://localhost',
      portapp: '8080',
      dir: '/home/paolo/myproject/freeplanet/dist/spa',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '2',
      name: 'Associazione Shen',
      adminemail: 'paolo.arena77@gmail.com',
      manageremail: '',
      replyTo: 'info@associazioneshen.it',
      host: 'http://localhost',
      portapp: '8081',
      dir: '/home/paolo/myproject/associazioneShen/dist/spa',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '3',
      name: 'Brigitte',
      adminemail: 'paolo.arena77@gmail.com',
      manageremail: '',
      host: 'http://localhost',
      portapp: '8082',
      dir: '',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '4',
      name: 'Mandala Solidale',
      adminemail: 'paolo.arena77@gmail.com',
      manageremail: '',
      host: 'http://localhost',
      portapp: '8084',
      dir: '',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '6',
      name: 'Mandala per l\'Anima',
      adminemail: 'paolo.arena77@gmail.com',
      manageremail: '',
      host: 'http://localhost',
      portapp: '8083',
      dir: '',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '7',
      name: 'Ayni',
      adminemail: 'paolo.arena77@gmail.com',
      manageremail: '',
      host: 'http://localhost',
      portapp: '8085',
      dir: '',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
      telegram_bot_name: 'paotestlocalebot',
      telegram_key:'353996190:AAEcEbfrm_zTK6mBKf8ye9j-PXt958SDxew',
      pathreg_add:'_ayni',
      abilitanave: true,
    },
    {
      idapp: '8',
      name: 'CentrOlistico Rimini',
      adminemail: 'pao.loarena77@gmail.com',
      manageremail: '',
      replyTo: 'info@arcodiluce.it',
      host: 'http://localhost',
      portapp: '8086',
      dir: '/home/paolo/myproject/centrolisticorimini.it/dist/spa',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      abilitanave: false,
    },
    {
      idapp: '9',
      name: 'SalviamoIlPianeta',
      adminemail: 'paolo.arena77@gmail.com',
      manageremail: '',
      host: 'http://localhost',
        portapp: '8087',
      dir: '',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
      telegram_key: '',
      telegram_bot_name: '',

      // telegram_key:'1049833543:AAE1RhGUJVdm0N_vrj0ijHZ04GCkKjl8TuQ',
      // telegram_bot_name: 'TestSalviamoIlPianeta_bot',
      pathreg_add:'_sip',
      abilitanave: false,
    },
  ];

}
