server/boot/load-model.js
function loadConfig(app, apimanager, models, currdir, snapdir, uid, cb) {
  logger.debug('loadConfig entry');
  var dirToLoad = (snapdir === '') ? currdir : snapdir;

  loadConfigFromFS(app, apimanager, models, dirToLoad, uid, function(err) {
    if (err) {
      logger.error(err);
      logger.debug('loadConfig error(1)');
      cb(err);
      return;
    } else if (mixedProtocols) {
      logger.debug('loadConfig error(2)');
      cb(new Error('mixed protocols'));
      return;
    } else {
      // update current snapshot pointer
      updateSnapshot(app, uid, function(err) {
        if (err) {
          logger.debug('loadConfig error(3)');
          cb(err);
          return;
        }

        // only update pointer to latest configuration
        // when latest configuration successful loaded
        if (snapdir === dirToLoad) {
          process.env[CONFIGDIR] = snapdir;
          setPreviousSnapshotDir(snapdir);
        }

        logger.debug('loadConfig exit');
        cb();
      });
    }
  });
}
function loadConfig(app, apimanager, models, currdir, snapdir, uid, cb) {
  logger.debug('loadConfig entry');
  var dirToLoad = (snapdir === '') ? currdir : snapdir;

  loadConfigFromFS(app, apimanager, models, dirToLoad, uid, function(err) {
    if (err) {
      logger.error(err);
      logger.debug('loadConfig error(1)');
      cb(err);
      return;
    } else if (mixedProtocols) {
      logger.debug('loadConfig error(2)');
      cb(new Error('mixed protocols'));
      return;
    } else {
      // update current snapshot pointer
      updateSnapshot(app, uid, function(err) {
        if (err) {
          logger.debug('loadConfig error(3)');
          cb(err);
          return;
        }

        // only update pointer to latest configuration
        // when latest configuration successful loaded
        if (snapdir === dirToLoad) {
          process.env[CONFIGDIR] = snapdir;
          setPreviousSnapshotDir(snapdir);
        }

        logger.debug('loadConfig exit');
        cb();
      });
    }
  });
}
function loadConfig ( app , apimanager , models , currdir , snapdir , uid , cb ) { logger . debug ( 'loadConfig entry' ) ; var dirToLoad = ( snapdir === '' ) ? currdir : snapdir ; loadConfigFromFS ( app , apimanager , models , dirToLoad , uid , function ( err ) { if ( err ) { logger . error ( err ) ; logger . debug ( 'loadConfig error(1)' ) ; cb ( err ) ; return ; } else if ( mixedProtocols ) { logger . debug ( 'loadConfig error(2)' ) ; cb ( new Error ( 'mixed protocols' ) ) ; return ; } else { // update current snapshot pointer updateSnapshot ( app , uid , function ( err ) { if ( err ) { logger . debug ( 'loadConfig error(3)' ) ; cb ( err ) ; return ; } // only update pointer to latest configuration // when latest configuration successful loaded if ( snapdir === dirToLoad ) { process . env [ CONFIGDIR ] = snapdir ; setPreviousSnapshotDir ( snapdir ) ; } logger . debug ( 'loadConfig exit' ) ; cb ( ) ; } ) ; } } ) ; }
Loads persisted data from disk and populates models and updates
'current snapshot'
@param {???} app - loopback application
@param {Array} models - instances of ModelType to populate with data
@param {string} currdir - current snapshot symbolic link path
@param {string} snapdir - path to directory containing persisted data to load
@param {string} uid - snapshot identifier
@param {callback} cb - callback that handles error or successful completion
Loads persisted data from disk and populates models and updates current snapshot