const tools = require('../tools/general');

// still in app.js
const node_env = process.env.NODE_ENV || 'production';
console.log('node_env=', node_env);

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("Starting Node with : " + file);
require('dotenv').config({ path: file });

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

console.log('process.env.DOMAIN:', process.env.DOMAIN);
process.env.MONGODB_URI = process.env.DOMAIN + process.env.DATABASE;
console.log('process.env.MONGODB_URI:', process.env.MONGODB_URI);



/*
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: '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',
      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,
    },
    {
      idapp: '10',
      name: 'Comunità Nuovo Mondo',
      adminemail: 'cnmrimini@gmail.com',
      manageremail: '',
      replyTo: '',
      host: 'https://comunitanuovomondo.app',
      portapp: '0',
      dir: '/var/www/comunitanuovomondo.app',
      // email_from: 'info.pianetalibero@gmail.com',
      // email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      email_from: 'cnmrimini@gmail.com',
      email_pwd: '9693e200ae56f1119185a29d34079656a628f2663dc108f7d106496ac0042815F+mvJF79KcQcUnF0twoyIg==',
      telegram_key:'1646348227:AAF2qgpHB4KprhB0HPefazGLyoVGW_i4jTA',
      telegram_bot_name: 'cnm_mybot',
      pathreg_add:'_cnm',
      abilitanave: false,
    },
    {
      idapp: '11',
      name: 'ArtEnergetica',
      adminemail: '',
      manageremail: '',
      replyTo: '',
      host: 'https://www.artenergetica.org',
      portapp: '0',
      dir: '',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      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: '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',
      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,
    },
    {
      idapp: '10',
      name: 'Comunità Nuovo Mondo (Server Test)',
      adminemail: 'info.pianetalibero@gmail.com',
      manageremail: '',
      replyTo: '',
      host: 'https://test.comunitanuovomondo.app',
      portapp: '0',
      dir: '/var/www/test.comunitanuovomondo.app',
      // email_from: 'info.pianetalibero@gmail.com',
      // email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'_cnm',
      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: '11',
      name: 'ArtEnergetica',
      adminemail: '',
      manageremail: '',
      host: 'https://www.artenergetica.org',
      portapp: '0',
      dir: '/var/www/artenergetica.org',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
      telegram_key:'',
      telegram_bot_name: '',
      pathreg_add:'',
      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: '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,
    },
    {
      idapp: '10',
      name: 'Comunità Nuovo Mondo',
      adminemail: 'cnmrimini@gmail.com',
      manageremail: '',
      host: 'http://localhost',
        portapp: '8090',
      dir: '',
      email_from: 'cnmrimini@gmail.com',
      email_pwd: 'bc61ab32a09d22e3a5097aa6668d3c724854c5856de9c713c427017bb89cdb0ctIESmuHr3FCNTLlRAK6d5Q',
      telegram_key: '',
      telegram_bot_name: '',
      pathreg_add:'_cnm',
      abilitanave: false,
    },
    {
      idapp: '11',
      name: 'ArtEnergetica',
      adminemail: 'paolo.arena77@gmail.com',
      manageremail: '',
      host: 'http://localhost',
      portapp: '8091',
      dir: '',
      email_from: 'info.pianetalibero@gmail.com',
      email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
      pathreg_add:'',
      abilitanave: false,
    },
  ];

}

 */

