"use strict";
var program           = require('commander');
var logger            = require("./libs/utils.js").logger;
var loadGeneralConfig = require("./libs/utils.js").loadGeneralConfig;

var FilePlan   = require("./classes/file_plan.js");

var configFilePath = '/etc/runnerty/conf.json';
var config;

//var runtimePlan;
var reloadPlan = false;

// CHECK ARGS APP:
program
  .version('0.0.1')
  .option('-c, --config <path>', `set config path. defaults to ${configFilePath}`,function(filePath){
    configFilePath = filePath;
  })
  .option('-r, --reload', 'reload plan', function(){
    reloadPlan = true;
  })

program.parse(process.argv);

logger.log('info',`RUNNERTY RUNNING - TIME...: ${new Date()}`);

//LOAD GENERAL CONFIG:
loadGeneralConfig(configFilePath)
  .then(function(fileConfig){
    config = fileConfig;
    global.config = config;

    var fileLoad;
    if(reloadPlan){
      fileLoad = config.general.planFilePath;
      logger.log('warn',`Reloading plan from ${fileLoad}`);
    }
    else{
      fileLoad = config.general.binBackup;
    }

    new FilePlan(fileLoad, config)
      .then(function(plan){
        global.runtimePlan = plan;
        require('./api/api.js')(config.general, logger, global.runtimePlan);

/* BORRAR
        var txt = 'hola :ARG_UNO http://www.pepe.com';
        console.log('i:',txt);
        var replaceWith       = require("./libs/utils.js").replaceWith;
        var pvals= {"GV_UNO":"uunnoo"};

        function queryFormat(query, values) {
          if (!values) return query.replace(/(\:\/)/g,':');
          else {
            var _query = query.replace(/\:(\w+)/g, function (txt, key) {
              console.log('values[key]:',values[key]);

              return (values && key && values.hasOwnProperty(key))
                ? replaceWith(values[key],pvals)
                : null;
            }.bind(this));
          }
          return _query;
        }

        console.log('r:',queryFormat(txt,{"ARG_UNO":":GV_UNO"}));

       // console.log(txt.replace(/\:(\w+)/g,'XXX'));

*/
      })
      .catch(function(e){
        logger.log('error','FilePlan: '+e);
      });

  })
  .catch(function(e){
    logger.log('error',`Config file ${configFilePath}: `+e);
  });


//==================================================================
//
process.on('uncaughtException', function (err) {
  logger.log('error',err.stack);
});

process.on('exit', function (err) {
  logger.log('warn','--> [R]unnerty stoped.', err);
});
@@ -1232,810 +1232,8 @@
 an);
-%0A%0A/* BORRAR%0A        var txt = 'hola :ARG_UNO http://www.pepe.com';%0A        console.log('i:',txt);%0A        var replaceWith       = require(%22./libs/utils.js%22).replaceWith;%0A        var pvals= %7B%22GV_UNO%22:%22uunnoo%22%7D;%0A%0A        function queryFormat(query, values) %7B%0A          if (!values) return query.replace(/(%5C:%5C/)/g,':');%0A          else %7B%0A            var _query = query.replace(/%5C:(%5Cw+)/g, function (txt, key) %7B%0A              console.log('values%5Bkey%5D:',values%5Bkey%5D);%0A%0A              return (values && key && values.hasOwnProperty(key))%0A                ? replaceWith(values%5Bkey%5D,pvals)%0A                : null;%0A            %7D.bind(this));%0A          %7D%0A          return _query;%0A        %7D%0A%0A        console.log('r:',queryFormat(txt,%7B%22ARG_UNO%22:%22:GV_UNO%22%7D));%0A%0A       // console.log(txt.replace(/%5C:(%5Cw+)/g,'XXX'));%0A%0A*/
 %0A   

Fix Iters into Iters