config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthToPlatformConfig added in v0.4.0

func AuthToPlatformConfig(serverType string, serverUrl string, auth RepoSyncAuth) (vcsapp.PlatformConfig, error)

func SaveState added in v0.4.0

func SaveState(file string, state *SyncState) error

func StateFile added in v0.4.0

func StateFile() string

Types

type CloneMethod added in v0.4.0

type CloneMethod string
const (
	CloneMethodHTTPS CloneMethod = "https"
	CloneMethodSSH   CloneMethod = "ssh"
)

type MirrorOpts added in v0.4.0

type MirrorOpts struct {
	LocalDir      string       `yaml:"dir"`
	CloneMethod   CloneMethod  `yaml:"clone-method"`
	NamingStyle   NamingStyle  `yaml:"naming-style"`
	Rules         []MirrorRule `yaml:"rules"`
	DefaultAction RuleAction   `yaml:"default-action"`
}

type MirrorRule added in v0.4.0

type MirrorRule struct {
	Rule   string     `yaml:"rule"`
	Action RuleAction `yaml:"action"`
}

type NamingStyle added in v0.4.1

type NamingStyle string
const (
	NamingSchemeName      NamingStyle = "name"
	NamingSchemeLowercase NamingStyle = "lowercase"
	NamingSchemeSlug      NamingStyle = "slug"
)

type RepoBundle

type RepoBundle struct {
	TargetDir string       `yaml:"target"`
	Sources   []RepoSource `yaml:"sources"`
}

type RepoBundleOptions

type RepoBundleOptions struct {
	SourcePrefix string   `yaml:"source-prefix"`
	TargetPrefix string   `yaml:"target-prefix"`
	Extensions   []string `yaml:"extensions"`
}

type RepoSource added in v0.4.0

type RepoSource struct {
	Url       string            `yaml:"url"`
	Ref       string            `yaml:"ref"`
	Group     []string          `yaml:"group"`
	TargetDir string            `yaml:"target"`
	Bundle    RepoBundleOptions `yaml:"bundle"`
	Auth      RepoSyncAuth      `yaml:"auth"`
}

type RepoSyncAuth added in v0.2.0

type RepoSyncAuth struct {
	Username        string `yaml:"username"`
	Password        string `yaml:"password"`
	PasswordFile    string `yaml:"password-file"`
	PasswordCommand string `yaml:"password-command"` // PasswordCommand can be defined to call e.g. pass or another cli password manager
}

type RepoSyncConfig

type RepoSyncConfig struct {
	Version int                   `yaml:"version"`
	Servers []Server              `yaml:"servers"`
	Sources []RepoSource          `yaml:"sources"`
	Bundle  map[string]RepoBundle `yaml:"bundle"`
}

func Load added in v0.4.0

func Load() (*RepoSyncConfig, error)

type RepositoryState added in v0.4.0

type RepositoryState struct {
	ID        string    `json:"id"`
	Namespace string    `json:"namespace"`
	Name      string    `json:"name"`
	Remote    string    `json:"remote"`
	Directory string    `json:"directory"`
	LastSync  time.Time `json:"last_sync"`
}

type RuleAction added in v0.4.0

type RuleAction string
const (
	RuleActionInclude RuleAction = "include"
	RuleActionExclude RuleAction = "exclude"
)

func EvaluateRules added in v0.4.0

func EvaluateRules(rules []MirrorRule, defaultAction RuleAction, repo api.Repository) RuleAction

type Server added in v0.4.0

type Server struct {
	Server    string       `yaml:"url"`
	Type      string       `yaml:"type"`
	TargetDir string       `yaml:"target"`
	Auth      RepoSyncAuth `yaml:"auth"`
	Mirror    MirrorOpts   `yaml:"mirror"`
}

type SyncState added in v0.4.0

type SyncState struct {
	Repositories map[string]RepositoryState `json:"repositories"`
}

func LoadState added in v0.4.0

func LoadState(file string) (*SyncState, error)

Jump to

Keyboard shortcuts

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