database/redis-client.js
function(keys){

  console.log('\nInitializing keys in Redis...\n')

  keys.forEach(function(el,i){

    client.get(el.key, function(e,d){

      if(e) {
        console.log("Error trying to get %s ", el.key)
        return console.error(e)
      }

      // checking for falsey values only is a bad idea
      if(typeof d === 'undefined'){

        console.log("Not OK trying to get %s ", el.key)

        client.set(el.key, el.initialValue, function(e,d){
          if(e) {
            console.log("Error trying to set %s ", el.key)
            return console.error(e)
          }
          if(d !== 'OK') {
            console.log("Not OK trying to set %s ", el.key)
            return console.warn(el.key + " was not set.")
          }
          if(d === 'OK') {
            console.log("OK setting %s ", el.key)
            client.get(el.key, function(e,d){
             console.log(d) 
            })
          }

        }) // end set.
      }

      console.log("The value for key %s is %s", el.key.yellow, d.green)

    }) // end get

  })
}
function(keys){

  console.log('\nInitializing keys in Redis...\n')

  keys.forEach(function(el,i){

    client.get(el.key, function(e,d){

      if(e) {
        console.log("Error trying to get %s ", el.key)
        return console.error(e)
      }

      // checking for falsey values only is a bad idea
      if(typeof d === 'undefined'){

        console.log("Not OK trying to get %s ", el.key)

        client.set(el.key, el.initialValue, function(e,d){
          if(e) {
            console.log("Error trying to set %s ", el.key)
            return console.error(e)
          }
          if(d !== 'OK') {
            console.log("Not OK trying to set %s ", el.key)
            return console.warn(el.key + " was not set.")
          }
          if(d === 'OK') {
            console.log("OK setting %s ", el.key)
            client.get(el.key, function(e,d){
             console.log(d) 
            })
          }

        }) // end set.
      }

      console.log("The value for key %s is %s", el.key.yellow, d.green)

    }) // end get

  })
}
function ( keys ) { console . log ( '\nInitializing keys in Redis...\n' ) keys . forEach ( function ( el , i ) { client . get ( el . key , function ( e , d ) { if ( e ) { console . log ( "Error trying to get %s " , el . key ) return console . error ( e ) } // checking for falsey values only is a bad idea if ( typeof d === 'undefined' ) { console . log ( "Not OK trying to get %s " , el . key ) client . set ( el . key , el . initialValue , function ( e , d ) { if ( e ) { console . log ( "Error trying to set %s " , el . key ) return console . error ( e ) } if ( d !== 'OK' ) { console . log ( "Not OK trying to set %s " , el . key ) return console . warn ( el . key + " was not set." ) } if ( d === 'OK' ) { console . log ( "OK setting %s " , el . key ) client . get ( el . key , function ( e , d ) { console . log ( d ) } ) } } ) // end set. } console . log ( "The value for key %s is %s" , el . key . yellow , d . green ) } ) // end get } ) }
Upon firing up, make sure these baseline keys are set
Upon firing up make sure these baseline keys are set