handleHostOption.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var bin_1 = require("../../bin");
  4. function handleHostOption(incoming) {
  5. var host = incoming.get("host");
  6. var listen = incoming.get("listen");
  7. if (host && listen) {
  8. if (host !== listen) {
  9. return [incoming, [{
  10. errors: [
  11. {
  12. error: new Error("Cannot specify both `host` and `listen` options"),
  13. meta: function () {
  14. return [
  15. "",
  16. "Tip: Use just the `listen` option *only* if you want to bind only to a particular host.",
  17. ];
  18. }
  19. }
  20. ],
  21. level: bin_1.BsErrorLevels.Fatal,
  22. type: bin_1.BsErrorTypes.HostAndListenIncompatible
  23. }]];
  24. }
  25. // whenever we have have both `host` + `listen` options,
  26. // we remove the 'host' to prevent complication further down the line
  27. return [
  28. incoming.delete('host'),
  29. []
  30. ];
  31. }
  32. return [incoming, []];
  33. }
  34. exports.handleHostOption = handleHostOption;
  35. //# sourceMappingURL=handleHostOption.js.map