bufconfig

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: Apache-2.0 Imports: 12 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.

Variables

This section is empty.

Functions

func WriteBufYAMLToBucket added in v0.22.0

func WriteBufYAMLToBucket(ctx context.Context, writeBucket storage.WriteBucket, externalConfig ExternalConfig) (retErr error)

WriteBufYAMLToBucket writes the given ExternalConfig (buf.yaml) into the bucket.

Types

type Config

type Config struct {
	Name     bufmodule.ModuleName
	Build    *bufmodulebuild.Config
	Breaking *bufbreaking.Config
	Lint     *buflint.Config
}

Config is the user config.

type ExternalConfig

type ExternalConfig struct {
	Name     string                        `json:"name,omitempty" yaml:"name,omitempty"`
	Build    bufmodulebuild.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"`
	Deps     []string                      `json:"deps,omitempty" yaml:"deps,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