Documentation ¶
Overview ¶
Package bufconfig contains the configuration functionality.
Index ¶
Constants ¶
const ConfigFilePath = "buf.yaml"
ConfigFilePath is the default config file path within a bucket.
TODO: make sure copied for git
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config is the user config.
Configs must not be linked to a specific Bucket object, that is if a Config is Generated from bucket1, and bucket1 is copied to bucket2, the Config must be valid for bucket2.
type ExternalBreakingConfig ¶
type ExternalBreakingConfig struct { Use []string `json:"use,omitempty" yaml:"use,omitempty"` Except []string `json:"except,omitempty" yaml:"except,omitempty"` Ignore []string `json:"ignore,omitempty" yaml:"ignore,omitempty"` IgnoreOnly map[string][]string `json:"ignore_only,omitempty" yaml:"ignore_only,omitempty"` }
ExternalBreakingConfig is an external config.
Should only be used outside this package for testing.
type ExternalBuildConfig ¶
type ExternalBuildConfig struct { Roots []string `json:"roots,omitempty" yaml:"roots,omitempty"` Excludes []string `json:"excludes,omitempty" yaml:"excludes,omitempty"` }
ExternalBuildConfig is an external config.
Should only be used outside this package for testing.
type ExternalConfig ¶
type ExternalConfig struct { Build ExternalBuildConfig `json:"build,omitempty" yaml:"build,omitempty"` Breaking ExternalBreakingConfig `json:"breaking,omitempty" yaml:"breaking,omitempty"` Lint ExternalLintConfig `json:"lint,omitempty" yaml:"lint,omitempty"` }
ExternalConfig is an external config.
Should only be used outside this package for testing.
type ExternalLintConfig ¶
type ExternalLintConfig struct { Use []string `json:"use,omitempty" yaml:"use,omitempty"` Except []string `json:"except,omitempty" yaml:"except,omitempty"` Ignore []string `json:"ignore,omitempty" yaml:"ignore,omitempty"` IgnoreOnly map[string][]string `json:"ignore_only,omitempty" yaml:"ignore_only,omitempty"` EnumZeroValueSuffix string `json:"enum_zero_value_suffix,omitempty" yaml:"enum_zero_value_suffix,omitempty"` RPCAllowSameRequestResponse bool `json:"rpc_allow_same_request_response,omitempty" yaml:"rpc_allow_same_request_response,omitempty"` RPCAllowGoogleProtobufEmptyRequests bool `json:"rpc_allow_google_protobuf_empty_requests,omitempty" yaml:"rpc_allow_google_protobuf_empty_requests,omitempty"` RPCAllowGoogleProtobufEmptyResponses bool `json:"rpc_allow_google_protobuf_empty_responses,omitempty" yaml:"rpc_allow_google_protobuf_empty_responses,omitempty"` ServiceSuffix string `json:"service_suffix,omitempty" yaml:"service_suffix,omitempty"` }
ExternalLintConfig is an external config.
Should only be used outside this package for testing.
type Provider ¶
type Provider interface { // GetConfigForBucket gets the Config for the given JSON or YAML data. // // If the data is of length 0, returns the default config. GetConfigForBucket(ctx context.Context, bucket storage.ReadBucket) (*Config, error) // GetConfig gets the Config for the given JSON or YAML data. // // If the data is of length 0, returns the default config. GetConfigForData(data []byte) (*Config, error) }
Provider is a provider.
func NewProvider ¶
func NewProvider(logger *zap.Logger, options ...ProviderOption) Provider
NewProvider returns a new Provider.
type ProviderOption ¶
type ProviderOption func(*provider)
ProviderOption is an option for a new Provider.
func ProviderWithExternalConfigModifier ¶
func ProviderWithExternalConfigModifier(externalConfigModifier func(*ExternalConfig) error) ProviderOption
ProviderWithExternalConfigModifier returns a new ProviderOption that applies the following external config modifier before processing an ExternalConfig.
Useful for testing.