Skip to content

Commit

Permalink
feat(): support host option
Browse files Browse the repository at this point in the history
  • Loading branch information
andreascful committed Sep 25, 2023
1 parent f974823 commit 2dd32cb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type RunMigrationConfig = {
yes?: boolean
retryLimit?: number
requestBatchSize?: number
host?: string
} & ({ filePath: string } | { migrationFunction: MigrationFunction })

export function runMigration(config: RunMigrationConfig): Promise<any>
Expand Down
2 changes: 2 additions & 0 deletions src/bin/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function getArgvConfig({
rawProxy,
requestBatchSize,
headers,
host,
retryLimit
}): ClientConfig {
const config = {
Expand All @@ -51,6 +52,7 @@ function getArgvConfig({
rawProxy,
requestBatchSize,
headers: addSequenceHeader(headers),
host,
retryLimit
}

Expand Down
2 changes: 0 additions & 2 deletions test/teardown.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ if (!space) {
throw new Error('CONTENTFUL_SPACE_ID is missing')
}

console.log(`space id ${space}`)

const contentful = require('contentful-management')

function initClient() {
Expand Down
5 changes: 5 additions & 0 deletions test/unit/bin/lib/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ describe('Config', function () {
expect(config.retryLimit).to.eql(10)
})

it('exposes host from argv', function () {
const config = getConfig({ host: 'https://foo.bar:443' })
expect(config.host).to.eql('https://foo.bar:443')
})

it('validates retryLimit argument', function () {
expect(() => getConfig({ retryLimit: -1 })).to.throw(
Error,
Expand Down

0 comments on commit 2dd32cb

Please sign in to comment.