config

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package config handles configuration loading and normalization across different formats.

Index

Constants

View Source
const (
	// MaxConfigFileSize limits configuration file size to prevent resource exhaustion.
	MaxConfigFileSize = 10 * 1024 * 1024 // 10 MB
)

Variables

View Source
var (
	// ErrConfigNotFound is returned when a configuration file is not found.
	ErrConfigNotFound = errors.New("configuration file not found")

	// ErrConfigTooLarge is returned when a configuration file exceeds size limits.
	ErrConfigTooLarge = errors.New("configuration file too large")

	// ErrConflictingLanguage is returned when merging configs with different language specs.
	ErrConflictingLanguage = errors.New("conflicting language specifications")

	// ErrInvalidPackageFormat is returned when a package string has invalid format.
	ErrInvalidPackageFormat = errors.New("invalid package format")
)
View Source
var StandardFileNames = map[string]string{
	"cargobump-deps.yaml":     "deps.yaml",
	"gobump-deps.yaml":        "deps.yaml",
	"pombump-deps.yaml":       "deps.yaml",
	"pombump-properties.yaml": "properties.yaml",
	"gobump-replaces.yaml":    "replaces.yaml",
}

StandardFileNames maps old configuration file names to the new standard names.

Functions

func DiscoverConfigFiles

func DiscoverConfigFiles(ctx context.Context, dir string) ([]string, error)

DiscoverConfigFiles searches for configuration files in a directory. Returns paths to all found configuration files (both old and new formats).

Types

type Config

type Config struct {
	// Language specifies the language ecosystem (auto, maven, go, rust)
	Language string `json:"language,omitempty" yaml:"language,omitempty"`

	// Packages lists dependencies to update
	Packages []Package `json:"packages,omitempty" yaml:"packages,omitempty"`

	// Properties lists properties to update (Maven, etc.)
	Properties []Property `json:"properties,omitempty" yaml:"properties,omitempty"`

	// Replaces lists module replacements (Go-specific)
	Replaces []Replace `json:"replaces,omitempty" yaml:"replaces,omitempty"`
}

Config represents the unified configuration for omnibump.

func LoadConfig

func LoadConfig(ctx context.Context, path string) (*Config, error)

LoadConfig loads configuration from a file, supporting both old and new naming conventions.

func LoadMultipleConfigs

func LoadMultipleConfigs(ctx context.Context, paths []string) (*Config, error)

LoadMultipleConfigs loads and merges multiple configuration files. This is useful for Maven projects that have separate deps and properties files.

type Package

type Package struct {
	// Common fields
	Name    string `json:"name,omitempty" yaml:"name,omitempty"`
	Version string `json:"version,omitempty" yaml:"version,omitempty"`

	// Maven-specific
	GroupID    string `json:"groupId,omitempty" yaml:"groupId,omitempty"`
	ArtifactID string `json:"artifactId,omitempty" yaml:"artifactId,omitempty"`
	Scope      string `json:"scope,omitempty" yaml:"scope,omitempty"`
	Type       string `json:"type,omitempty" yaml:"type,omitempty"`
}

Package represents a dependency package to update.

func ParseInlinePackages

func ParseInlinePackages(packagesStr string) ([]Package, error)

ParseInlinePackages parses inline package specifications from command line. Format: "name@version" or "groupId@artifactId@version" (Maven).

type Property

type Property struct {
	Property string `json:"property" yaml:"property"`
	Value    string `json:"value" yaml:"value"`
}

Property represents a build property to update.

func ParseInlineProperties

func ParseInlineProperties(propsStr string) ([]Property, error)

ParseInlineProperties parses inline property specifications from command line. Format: "property=value" pairs separated by spaces.

type Replace

type Replace struct {
	OldName string `json:"oldName" yaml:"oldName"`
	Name    string `json:"name" yaml:"name"`
	Version string `json:"version" yaml:"version"`
}

Replace represents a module replacement (Go-specific).

func ParseInlineReplaces

func ParseInlineReplaces(replacesStr string) ([]Replace, error)

ParseInlineReplaces parses inline replace specifications from command line. Format: space-separated "oldpkg=newpkg@version" entries.

Jump to

Keyboard shortcuts

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