config

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Source       Source       `mapstructure:"source"`
	Target       Target       `mapstructure:"target"`
	Defaults     Defaults     `mapstructure:"defaults"`
	Repositories []Repository `mapstructure:"repositories"`
}

func LoadConfig

func LoadConfig(names []string) (*Config, error)

LoadConfig loads the configuration using viper from the given file and returns the configuration object.

func (*Config) FilteredRepositories

func (c *Config) FilteredRepositories(args []string) iter.Seq[Repository]

func (*Config) LabelledRepositories added in v0.6.0

func (c *Config) LabelledRepositories(labels []string) []Repository

func (*Config) ParseRepositorySpec

func (c *Config) ParseRepositorySpec(spec string) (repo string, err error)

func (*Config) RepositorySetFromArgs

func (c *Config) RepositorySetFromArgs(args []string) RepositorySet

type Defaults

type Defaults struct {
	Owner        string        `mapstructure:"owner"`
	Interval     time.Duration `mapstructure:"interval"`
	PublicSource bool          `mapstructure:"public-source"`
	PublicTarget bool          `mapstructure:"public-target"`
	Labels       []string      `mapstructure:"labels"`
}

type Forge

type Forge interface {
	GetType() string
	GetUrl() string
	GetRemoteUrl() string
	GetToken() string
}

type Repository

type Repository struct {
	Owner        string         `mapstructure:"owner" yaml:"owner,omitempty"`
	Name         string         `mapstructure:"name"`
	Interval     *time.Duration `mapstructure:"interval" yaml:"interval,omitempty"`
	PublicSource *bool          `mapstructure:"public-source" yaml:"public-source,omitempty"`
	PublicTarget *bool          `mapstructure:"public-target" yaml:"public-target,omitempty"`
	Labels       []string       `mapstructure:"labels"`
}

func (*Repository) Failure

func (r *Repository) Failure(err error) string

func (*Repository) String

func (r *Repository) String() string

func (*Repository) Success

func (r *Repository) Success(message ...string) string

type RepositorySet

type RepositorySet map[string]struct{}

func (*RepositorySet) EmptyOrContains

func (r *RepositorySet) EmptyOrContains(repo Repository) bool

type Source

type Source struct {
	Type      string `mapstructure:"type" yaml:"type,omitempty" default:"gitea"`
	Url       string `mapstructure:"url" yaml:"url,omitempty"`
	RemoteUrl string `mapstructure:"remote-url" yaml:"remote-url,omitempty"`
	Token     string `mapstructure:"token" yaml:"-"`
}

Source may be either GitHub or Gitea

func (*Source) GetRemoteUrl

func (s *Source) GetRemoteUrl() string

func (*Source) GetToken

func (s *Source) GetToken() string

func (*Source) GetType

func (s *Source) GetType() string

func (*Source) GetUrl

func (s *Source) GetUrl() string

type Target

type Target struct {
	Url   string `mapstructure:"url" yaml:"url" default:"http://localhost:3000"`
	Token string `mapstructure:"token" yaml:"-"`
}

Target is always a Gitea instance

func (*Target) GetRemoteUrl

func (t *Target) GetRemoteUrl() string

func (*Target) GetToken

func (t *Target) GetToken() string

func (*Target) GetType

func (t *Target) GetType() string

func (*Target) GetUrl

func (t *Target) GetUrl() string

Jump to

Keyboard shortcuts

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