config

package
v0.0.0-...-d654738 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 10 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Find

func Find(org, repo string, cfg []IRepoFilter) int

Types

type Config

type Config interface {
	Validate() error
	SetDefault()
}

type ConfigAgent

type ConfigAgent struct {
	// contains filtered or unexported fields
}

func NewConfigAgent

func NewConfigAgent(b NewConfig) ConfigAgent

func (*ConfigAgent) GetConfig

func (ca *ConfigAgent) GetConfig() (string, Config)

func (*ConfigAgent) Start

func (ca *ConfigAgent) Start(path string) error

Start starts polling path for plugin config. If the first attempt fails, then start returns the error.

func (*ConfigAgent) Stop

func (ca *ConfigAgent) Stop()

type IRepoFilter

type IRepoFilter interface {
	CanApply(org, orgRepo string) (applyOrgRepo bool, applyOrg bool)
}

type NewConfig

type NewConfig func() Config

The returned value of NewConfig must be a pointer. Otherwise, it should deep copy the config when reading it.

type RepoFilter

type RepoFilter struct {
	// Repos is either in the form of org/repos or just org.
	Repos []string `json:"repos" required:"true"`

	// ExcludedRepos is in the form of org/repo.
	ExcludedRepos []string `json:"excluded_repos,omitempty"`
}

func (RepoFilter) CanApply

func (p RepoFilter) CanApply(org, orgRepo string) (applyOrgRepo bool, applyOrg bool)

The return value will be one of the following cases: true, false: the config can be applied to the org/repo true, true: the config can be applied to the org and org/repo false, true: the config can be applied to the org except org/repo false, false: the config can be applied to neither org or org/repo

func (RepoFilter) Validate

func (p RepoFilter) Validate() error

Jump to

Keyboard shortcuts

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