'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _regenerator;

function _load_regenerator() {
  return _regenerator = _interopRequireDefault(require('babel-runtime/regenerator'));
}

var _bluebird;

function _load_bluebird() {
  return _bluebird = require('bluebird');
}

var _globalConfig;

function _load_globalConfig() {
  return _globalConfig = require('../../api/consumer/lib/global-config');
}

var _constants;

function _load_constants() {
  return _constants = require('../../constants');
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.default = function () {
  var _ref = (0, (_bluebird || _load_bluebird()).coroutine)( /*#__PURE__*/(_regenerator || _load_regenerator()).default.mark(function _callee() {
    var identityFile;
    return (_regenerator || _load_regenerator()).default.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            _context.next = 2;
            return (0, (_globalConfig || _load_globalConfig()).get)((_constants || _load_constants()).CFG_SSH_KEY_FILE_KEY);

          case 2:
            identityFile = _context.sent;
            return _context.abrupt('return', identityFile || (_constants || _load_constants()).DEFAULT_SSH_KEY_FILE);

          case 4:
          case 'end':
            return _context.stop();
        }
      }
    }, _callee, this);
  }));

  function getPathToIdentityFile() {
    return _ref.apply(this, arguments);
  }

  return getPathToIdentityFile;
}();