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

Proposal: Reduce boilerplate with common config in package.json or .pactrc #602

Open
TimothyJones opened this issue Feb 9, 2021 · 1 comment
Labels
enhancement Indicates new feature requests

Comments

@TimothyJones
Copy link
Contributor

Intensive use of pact often involves rewriting the same config over and over- especially for the broker and consumer/provider names. I'd like to improve this in an idiomatic way by adding a package.json key and a .pactrc. I propose something like this, where PactOptions is under the key "pact" in package.json, or the export from .pactrc.{js,ts,json}:

interface Pacticipant {
  name?: string // Name of the pacticipant
  // Not sure what other info should go here?
  // Possibly tags or version selectors?
  // We may want to extend this type differently for provider verification
  // and consumer tests
}

interface BrokerOptions {
  // token and password are not to be committed, so don't exist here
  // They can both be set by environment variables.
  url?: string // URL to access the broker
  username?: string // username for the broker
}

interface PactOptions {
  consumer?: string | Pacticipant // The consumer name
  provider?: string | Pacticipant // The provider name
  broker?: BrokerOptions
  config?: {
    spec?: number // Which spec version to support
    pactFileDir?: string // Where the pact files are written to or read from
    logDir?: string // Where the logs get stored
    logLevel?: LogLevel // Log level
    doNotTrack?: boolean // Don't track pact download statistics
    binaryLocation?: string // The location of the standalone binaries if github is inaccessible
  }
}

Thoughts?

@stale
Copy link

stale bot commented Jul 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests
Projects
Status: New Issue
Development

No branches or pull requests

2 participants