config

package
v1.0.0-rc.1 Latest Latest
Warning

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

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

Documentation

Overview

Package config provides configuration management for batch-tool.

Index

Constants

View Source
const (
	EnvGopath = "gopath"

	GitUser            = "git.user"
	GitHost            = "git.host"
	GitProject         = "git.project"
	GitProjects        = "git.projects"
	GitProvider        = "git.provider"
	GitDirectory       = "git.directory"
	DefaultBranch      = "git.default-branch"
	StashUpdates       = "git.stash-updates"
	DefaultMergeMethod = "git.default-merge-method"

	// CloneSSHURLTmpl is the SSH URL template with placeholders: User, Host, Project, Repo
	CloneSSHURLTmpl = "ssh://%s@%s/%s/%s.git"

	SortRepos      = "repos.sort"
	RepoAliases    = "repos.aliases"
	UnwantedLabels = "repos.unwanted-labels"
	SkipArchived   = "repos.skip-archived"
	SkipUnwanted   = "repos.skip-unwanted"
	SuperSetLabel  = "repos.catch-all"

	DefaultReviewers     = "repos.reviewers"
	DefaultTeamReviewers = "repos.team-reviewers"

	CatalogCachePath = "repos.cache.path"
	CatalogCacheTTL  = "repos.cache.ttl"

	Branch    = "branch"
	AuthToken = "auth-token"

	TokenLabel  = "repos.tokens.label"
	TokenSkip   = "repos.tokens.skip"
	TokenForced = "repos.tokens.forced"

	OutputStyle  = "channels.output-style"
	PrintResults = "channels.print-results"
	WaitOnExit   = "channels.wait-on-exit"

	ChannelBuffer  = "channels.buffer-size"
	MaxConcurrency = "channels.max-concurrency"
	WriteBackoff   = "channels.write-backoff"

	GithubHourlyWriteLimit = "github.hourly-write-limit"
	GithubBackoffSmall     = "github.write-backoff-small"
	GithubBackoffLarge     = "github.write-backoff-large"

	// == COMMAND FLAGS == //
	CmdEnv = "cmd.args.env"

	// git
	GitCommitMessage = "git.args.commit.message"
	GitCommitAmend   = "git.args.commit.amend"
	GitCommitPush    = "git.args.commit.push"
	GitPushForce     = "git.args.push.force"
	GitStashAllowAny = "git.args.stash.allow-any"

	// pr
	PrOptions        = "pr.args.options"
	PrTitle          = "pr.args.title"
	PrDescription    = "pr.args.description"
	PrDraft          = "pr.args.draft"
	PrReviewers      = "pr.args.reviewers"
	PrTeamReviewers  = "pr.args.team-reviewers"
	PrResetReviewers = "pr.args.reset-reviewers"
	PrBaseBranch     = "pr.args.base-branch"
	PrMergeCheck     = "pr.args.merge-check"
	PrMergeMethod    = "pr.args.merge-method"

	// make
	MakeTargets = "make.args.targets"
)

Variables

View Source
var (
	// CfgFile specifies the configuration file path
	CfgFile string

	// Version is dynamically set at build time using the -X linker flag.
	// Default value is used for testing and development builds.
	Version = "dev"
)

Functions

func Cancel

func Cancel(ctx context.Context) context.CancelFunc

Cancel returns the cancel function attached to ctx by WithCancel, or a no-op if none is present.

func Child added in v0.11.0

func Child(ctx context.Context) *viper.Viper

Child creates a new Viper instance that inherits all settings from the parent context.

func Init

func Init(ctx context.Context) context.Context

Init reads in config file and ENV variables if set.

func New added in v0.9.6

func New() *viper.Viper

New creates a new Viper instance with default configuration.

func SetChild added in v0.11.0

func SetChild(ctx context.Context) context.Context

SetChild creates a child Viper instance and saves it into the context.

func SetViper added in v0.9.6

func SetViper(ctx context.Context, v *viper.Viper) context.Context

SetViper saves the Viper instance into the context.

func Viper added in v0.9.6

func Viper(ctx context.Context) *viper.Viper

Viper retrieves the Viper instance from the context.

func WithCancel

func WithCancel(ctx context.Context) (context.Context, context.CancelFunc)

WithCancel returns a copy of ctx with a new cancel function attached as a context value. The returned cancel function should be deferred by the caller. Other packages can retrieve the same cancel function via Cancel(ctx).

Types

This section is empty.

Jump to

Keyboard shortcuts

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