bufconfig

package
v0.20.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package bufconfig contains the configuration functionality.

Index

Constants

View Source
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

type Config struct {
	Build    *bufmod.Config
	Breaking *bufbreaking.Config
	Lint     *buflint.Config
}

Config is the user config.

type ExternalConfig

type ExternalConfig struct {
	Build    bufmod.ExternalConfig      `json:"build,omitempty" yaml:"build,omitempty"`
	Breaking bufbreaking.ExternalConfig `json:"breaking,omitempty" yaml:"breaking,omitempty"`
	Lint     buflint.ExternalConfig     `json:"lint,omitempty" yaml:"lint,omitempty"`
}

ExternalConfig is an external config.

type Provider

type Provider interface {
	// GetConfig gets the Config for the given JSON or YAML data.
	//
	// If the data is of length 0, returns the default config.
	GetConfig(ctx context.Context, readBucket 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(ctx context.Context, 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL