Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(): support host option #1251

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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