From 4c5436a83dd086d157d861017c4da57869e17575 Mon Sep 17 00:00:00 2001 From: Shawn Erquhart Date: Fri, 27 Jul 2018 18:40:53 -0400 Subject: [PATCH] fix(git-gateway): pass options through git-gateway backend (#1532) --- .../src/implementation.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/netlify-cms-backend-git-gateway/src/implementation.js b/packages/netlify-cms-backend-git-gateway/src/implementation.js index 48f6e1d3..ec19cb73 100644 --- a/packages/netlify-cms-backend-git-gateway/src/implementation.js +++ b/packages/netlify-cms-backend-git-gateway/src/implementation.js @@ -34,7 +34,12 @@ function getEndpoint(endpoint, netlifySiteURL) { } export default class GitGateway { - constructor(config) { + constructor(config, options = {}) { + this.options = { + proxied: false, + API: null, + ...options, + }; this.config = config; this.branch = config.getIn(["backend", "branch"], "master").trim(); this.squash_merges = config.getIn(["backend", "squash_merges"]); @@ -103,17 +108,17 @@ export default class GitGateway { if (this.backendType === "github") { this.api = new GitHubAPI(apiConfig); - this.backend = new GitHubBackend(this.config, { proxied: true, API: this.api }); + this.backend = new GitHubBackend(this.config, { ...this.options, API: this.api }); } else if (this.backendType === "gitlab") { this.api = new GitLabAPI(apiConfig); - this.backend = new GitLabBackend(this.config, { proxied: true, API: this.api }); + this.backend = new GitLabBackend(this.config, { ...this.options, API: this.api }); } else if (this.backendType === "bitbucket") { this.api = new BitBucketAPI({ ...apiConfig, requestFunction: this.requestFunction, hasWriteAccess: async () => true, }); - this.backend = new BitBucketBackend(this.config, { proxied: true, API: this.api }); + this.backend = new BitBucketBackend(this.config, { ...this.options, API: this.api }); } if (!(await this.api.hasWriteAccess())) {