config

package
v0.0.0-...-84ddfae Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewValidatorUsingGoogle

func NewValidatorUsingGoogle(ctx context.Context, cfg *Config, iamService *iam.Service) (*validatorUsingGoogle, error)

Types

type Access

type Access int
const (
	AccessAllow Access = iota
	AccessDeny
)

func (*Access) UnmarshalYAML

func (a *Access) UnmarshalYAML(unmarshal func(any) error) error

type AccessControlListElement

type AccessControlListElement struct {
	Access       Access   `yaml:"access"`
	Identities   []string `yaml:"identities"`
	ModuleRegexp Regexp   `yaml:"moduleRegexp"`
}

type AccessTokenAuthenticator

type AccessTokenAuthenticator struct {
	Audience   string        `yaml:"audience"`
	Secret     *Secret       `yaml:"secret"`
	TimeToLive time.Duration `yaml:"timeToLive"`
}

type ClientAuth

type ClientAuth struct {
	AccessControlList []*AccessControlListElement `yaml:"acl"`
	Authenticators    *struct {
		AccessToken         *AccessTokenAuthenticator         `yaml:"accessToken"`
		GCEInstanceIdentity *GCEInstanceIdentityAuthenticator `yaml:"gceInstanceIdentity"`
	} `yaml:"authenticators"`
	Enabled    bool        `yaml:"enabled"`
	Identities []*Identity `yaml:"identities"`
}

type Config

type Config struct {
	ClientAuth        ClientAuth               `yaml:"clientAuth"`
	GitHub            []*GitHubInstance        `yaml:"gitHub"`
	HTTPProxy         *HTTPProxy               `yaml:"httpProxy"`
	MaxChildProcesses int                      `yaml:"maxChildProcesses"`
	ParentProxy       ParentProxy              `yaml:"parentProxy"`
	PrivateModules    []*PrivateModulesElement `yaml:"privateModules"`
	PublicModules     PublicModules            `yaml:"publicModules"`
	Storage           *Storage                 `yaml:"storage"`
	SumDatabaseProxy  *SumDatabaseProxy        `yaml:"sumDatabaseProxy"`
	TLS               *TLS                     `yaml:"tls"`
}

func LoadFromYAMLFile

func LoadFromYAMLFile(file string) (*Config, error)

LoadFromYAMLFile loads configuration from a YAML file.

type GCEInstanceIdentityAuthenticator

type GCEInstanceIdentityAuthenticator struct {
	Audience string `yaml:"audience"`
}

type GCEInstanceIdentityBinding

type GCEInstanceIdentityBinding struct {
	Email string `yaml:"email"`
}

type GCSStorage

type GCSStorage struct {
	Bucket string `yaml:"bucket"`
}

type GitHubApp

type GitHubApp struct {
	ID               int64           `yaml:"id"`
	PrivateKey       *Secret         `yaml:"privateKey"`
	PrivateKeyParsed *rsa.PrivateKey `yaml:"-"`
}

type GitHubInstance

type GitHubInstance struct {
	GitHubApps []*GitHubApp `yaml:"gitHubApps"`
	Host       string       `yaml:"host"`
	// contains filtered or unexported fields
}

type HTTPProxy

type HTTPProxy struct {
	NoProxy       string                     `yaml:"noProxy"`
	NoProxyParsed *internalhttpproxy.NoProxy `yaml:"-"`
	URL           string                     `yaml:"url"`
	URLParsed     *url.URL                   `yaml:"-"`
	User          string                     `yaml:"user"`
	Password      *Secret                    `yaml:"password"`
	// contains filtered or unexported fields
}

type HTTPProxyInfo

type HTTPProxyInfo struct {
	ProxyFunc         func(*url.URL) (*url.URL, error)
	LibcurlHTTPSProxy string
	LibcurlNoProxy    string
}

func GetHTTPProxyInfoAndUnsetEnviron

func GetHTTPProxyInfoAndUnsetEnviron(cfg *Config) (*HTTPProxyInfo, error)

type Identity

type Identity struct {
	Name                       string                      `yaml:"name"`
	GCEInstanceIdentityBinding *GCEInstanceIdentityBinding `yaml:"gceInstanceIdentityBinding"`
	Password                   *Secret                     `yaml:"password"`
}

type Loader

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

Loader is a helper type to split up configuration loading into multiple functions.

func NewLoader

func NewLoader(reader io.Reader, dir string) (*Loader, error)

NewLoader encapsulates correct initialization of Loader.

func (*Loader) Run

func (l *Loader) Run() (*Config, error)

Run loads the configuration.

type ParentProxy

type ParentProxy struct {
	URL       string   `yaml:"url"`
	URLParsed *url.URL `yaml:"-"`
}

type PrivateModulesElement

type PrivateModulesElement struct {
	Auth PrivateModulesElementAuth `yaml:"auth"`

	PathPrefix     string `yaml:"pathPrefix"`
	PathPrefixHost string `yaml:"-"`
	// contains filtered or unexported fields
}

type PrivateModulesElementAuth

type PrivateModulesElementAuth struct {
	GitHubApp *int64 `yaml:"gitHubApp"`
}

type PublicModules

type PublicModules struct {
	SumDatabase *SumDatabaseElement `yaml:"sumDatabase"`
}

type Regexp

type Regexp struct {
	Value *regexp.Regexp
}

Regexp is a wrapper for a *regexp.Regexp that implements the Unmarshaler interface.

func (*Regexp) UnmarshalYAML

func (c *Regexp) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the Unmarshaler interface.

type Secret

type Secret struct {
	EnvVar *string `yaml:"envVar"`
	File   *string `yaml:"file"`

	Plaintext []byte `yaml:"-"`
	// contains filtered or unexported fields
}

type Storage

type Storage struct {
	GCS *GCSStorage `yaml:"gcs"`
}

type SumDatabaseElement

type SumDatabaseElement struct {
	Name      string   `yaml:"name"`
	PublicKey string   `yaml:"publicKey"`
	URL       string   `yaml:"url"`
	URLParsed *url.URL `yaml:"-"`
	// contains filtered or unexported fields
}

func (*SumDatabaseElement) FormatGoSumDBEnvVar

func (s *SumDatabaseElement) FormatGoSumDBEnvVar() string

FormatGoSumDBEnvVar represents s as the value of a GOSUMDB environment variable as defined by the Go toolchain.

type SumDatabaseProxy

type SumDatabaseProxy struct {
	DiscourageClientDirectSumDatabaseConnections bool `yaml:"discourageClientDirectSumDatabaseConnections"`

	SumDatabases []*SumDatabaseElement `yaml:"sumDatabases"`
}

type TLS

type TLS struct {
	MinVersion TLSVersion `yaml:"minVersion"`
}

type TLSVersion

type TLSVersion uint16

func (*TLSVersion) UnmarshalYAML

func (t *TLSVersion) UnmarshalYAML(unmarshal func(any) error) error

Jump to

Keyboard shortcuts

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