config

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 19 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 {
	Name         string          `yaml:"name"`
	Host         string          `yaml:"host"`
	Port         int             `yaml:"port"`
	AnonAccess   string          `yaml:"anon-access"`
	AllowKeyless bool            `yaml:"allow-keyless"`
	Users        []User          `yaml:"users"`
	Repos        []Repo          `yaml:"repos"`
	Source       *git.RepoSource `yaml:"-"`
	Cfg          *config.Config  `yaml:"-"`
	// contains filtered or unexported fields
}

Config is the Soft Serve configuration.

func NewConfig

func NewConfig(cfg *config.Config) (*Config, error)

NewConfig creates a new internal Config struct.

func (*Config) AuthRepo

func (cfg *Config) AuthRepo(repo string, pk ssh.PublicKey) gm.AccessLevel

AuthRepo grants repo authorization to the given key.

func (*Config) Fetch

func (cfg *Config) Fetch(repo string, pk ssh.PublicKey)

Fetch registers Git fetch functionality for the given repo and key.

func (*Config) PasswordHandler

func (cfg *Config) PasswordHandler(ctx ssh.Context, password string) bool

PasswordHandler returns whether or not password access is allowed.

func (*Config) PublicKeyHandler

func (cfg *Config) PublicKeyHandler(ctx ssh.Context, pk ssh.PublicKey) bool

PublicKeyHandler returns whether or not the given public key may access the repo.

func (*Config) Push

func (cfg *Config) Push(repo string, pk ssh.PublicKey)

Push registers Git push functionality for the given repo and key.

func (*Config) Reload

func (cfg *Config) Reload() error

Reload reloads the configuration.

type Repo

type Repo struct {
	Name    string `yaml:"name"`
	Repo    string `yaml:"repo"`
	Note    string `yaml:"note"`
	Private bool   `yaml:"private"`
	Readme  string `yaml:"readme"`
}

Repo contains repository configuration information.

type User

type User struct {
	Name        string   `yaml:"name"`
	Admin       bool     `yaml:"admin"`
	PublicKeys  []string `yaml:"public-keys"`
	CollabRepos []string `yaml:"collab-repos"`
}

User contains user-level configuration for a repository.

Jump to

Keyboard shortcuts

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