config

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(c *Config, componentsNames []string) error

Types

type Config

type Config struct {
	// ID defines the agola installation id. It's used inside the
	// various services to uniquely distinguish it from other installations
	// Defaults to "agola"
	ID string `yaml:"id"`

	Gateway      Gateway      `yaml:"gateway"`
	Scheduler    Scheduler    `yaml:"scheduler"`
	Notification Notification `yaml:"notification"`
	Runservice   Runservice   `yaml:"runservice"`
	Executor     Executor     `yaml:"executor"`
	Configstore  Configstore  `yaml:"configstore"`
	Gitserver    Gitserver    `yaml:"gitserver"`

	// APIExposedURL is the gateway API exposed url i.e. https://myagola.example.com
	APIExposedURL string `yaml:"apiExposedURL"`

	// WebExposedURL is the web interface exposed url i.e. https://myagola.example.com
	// This is used for generating the redirect_url in oauth2 redirects
	WebExposedURL string `yaml:"webExposedURL"`

	RunserviceURL   string `yaml:"runserviceURL"`
	ConfigstoreURL  string `yaml:"configstoreURL"`
	GitserverURL    string `yaml:"gitserverURL"`
	NotificationURL string `yaml:"notificationURL"`

	// InternalServicesAPIToken is a global api token for internal services (for
	// both servers and clients)
	// Used when a specific token isn't defined
	InternalServicesAPIToken string `yaml:"internalServicesAPIToken"`

	// Global internal services api tokens to avoid repeating them for every
	// service (for both servers and clients)
	// If empty their value will be set to InternalServicesAPIToken
	RunserviceAPIToken   string `yaml:"runserviceAPIToken"`
	ExecutorAPIToken     string `yaml:"executorAPIToken"`
	ConfigstoreAPIToken  string `yaml:"configstoreAPIToken"`
	GitserverAPIToken    string `yaml:"gitserverAPIToken"`
	NotificationAPIToken string `yaml:"notificationAPIToken"`
}

func Parse

func Parse(configFile string, componentsNames []string) (*Config, error)

type Configstore

type Configstore struct {
	Debug bool `yaml:"debug"`

	DataDir string `yaml:"dataDir"`

	DB DB `yaml:"db"`

	Web Web `yaml:"web"`

	APIToken string `yaml:"apiToken"`

	ObjectStorage ObjectStorage `yaml:"objectStorage"`
}

type CookieSigning added in v0.8.0

type CookieSigning struct {
	Duration time.Duration `yaml:"duration"`
	Key      string        `yaml:"key"`
}

type DB added in v0.8.0

type DB struct {
	Type       sql.Type `yaml:"type"`
	ConnString string   `yaml:"connString"`
}

type DockerExecutor added in v0.9.0

type DockerExecutor struct {
	// docker network to use when creating containers
	Network string `yaml:"network"`
}

type DockerRegistryAuth added in v0.7.0

type DockerRegistryAuth struct {
	Type DockerRegistryAuthType `yaml:"type"`

	// basic auth
	Username string `yaml:"username"`
	Password string `yaml:"password"`

	// encoded auth string
	Auth string `yaml:"auth"`
}

type DockerRegistryAuthType added in v0.7.0

type DockerRegistryAuthType string
const (
	DockerRegistryAuthTypeBasic       DockerRegistryAuthType = "basic"
	DockerRegistryAuthTypeEncodedAuth DockerRegistryAuthType = "encodedauth"
)

type Driver

type Driver struct {
	Type DriverType `yaml:"type"`
}

type DriverType

type DriverType string
const (
	DriverTypeDocker DriverType = "docker"
	DriverTypeK8s    DriverType = "kubernetes"
)

type Executor

type Executor struct {
	Debug bool `yaml:"debug"`

	DataDir string `yaml:"dataDir"`

	RunserviceURL      string `yaml:"runserviceURL"`
	RunserviceAPIToken string `yaml:"runserviceAPIToken"`

	ToolboxPath string `yaml:"toolboxPath"`

	Web Web `yaml:"web"`

	APIToken string `yaml:"apiToken"`

	Driver Driver `yaml:"driver"`

	InitImage InitImage `yaml:"initImage"`

	Labels map[string]string `yaml:"labels"`
	// ActiveTasksLimit is the max number of concurrent active tasks
	ActiveTasksLimit int `yaml:"activeTasksLimit"`

	AllowPrivilegedContainers bool `yaml:"allowPrivilegedContainers"`

	// docker specific configuration
	Docker DockerExecutor `yaml:"docker"`
}

type Gateway

type Gateway struct {
	Debug bool `yaml:"debug"`

	// APIExposedURL is the gateway API exposed url i.e. https://myagola.example.com
	APIExposedURL string `yaml:"apiExposedURL"`

	// WebExposedURL is the web interface exposed url i.e. https://myagola.example.com
	// This is used for generating the redirect_url in oauth2 redirects
	WebExposedURL string `yaml:"webExposedURL"`

	RunserviceURL        string `yaml:"runserviceURL"`
	RunserviceAPIToken   string `yaml:"runserviceAPIToken"`
	ConfigstoreURL       string `yaml:"configstoreURL"`
	ConfigstoreAPIToken  string `yaml:"configstoreAPIToken"`
	GitserverURL         string `yaml:"gitserverURL"`
	GitserverAPIToken    string `yaml:"gitserverAPIToken"`
	NotificationURL      string `yaml:"notificationURL"`
	NotificationAPIToken string `yaml:"notificationAPIToken"`

	Web           Web           `yaml:"web"`
	ObjectStorage ObjectStorage `yaml:"objectStorage"`

	TokenSigning  TokenSigning  `yaml:"tokenSigning"`
	CookieSigning CookieSigning `yaml:"cookieSigning"`

	// when true will not set __Host/__Secure and Secure cookies. Should be set only for local development over http
	UnsecureCookies bool `yaml:"unsecureCookies"`

	AdminToken string `yaml:"adminToken"`

	OrganizationMemberAddingMode OrganizationMemberAddingMode `yaml:"organizationMemberAddingMode"`
}

type Gitserver

type Gitserver struct {
	Debug bool `yaml:"debug"`

	DataDir string `yaml:"dataDir"`

	Web Web `yaml:"web"`

	APIToken string `yaml:"apiToken"`

	ObjectStorage ObjectStorage `yaml:"objectStorage"`

	RepositoryCleanupInterval    time.Duration `yaml:"repositoryCleanupInterval"`
	RepositoryRefsExpireInterval time.Duration `yaml:"repositoryRefsExpireInterval"`
}

type InitImage added in v0.7.0

type InitImage struct {
	Image string `yaml:"image"`

	Auth *DockerRegistryAuth `yaml:"auth"`
}

type Notification

type Notification struct {
	Debug bool `yaml:"debug"`

	// WebExposedURL is the web interface exposed url i.e. https://myagola.example.com
	// This is used for generating the redirect_url in oauth2 redirects
	WebExposedURL string `yaml:"webExposedURL"`

	RunserviceURL      string `yaml:"runserviceURL"`
	RunserviceAPIToken string `yaml:"runserviceAPIToken"`

	ConfigstoreURL      string `yaml:"configstoreURL"`
	ConfigstoreAPIToken string `yaml:"configstoreAPIToken"`

	DB DB `yaml:"db"`

	Web Web `yaml:"web"`

	APIToken string `yaml:"apiToken"`

	WebhookURL    string `yaml:"webhookURL"`
	WebhookSecret string `yaml:"webhookSecret"`

	RunWebhookExpireInterval   time.Duration `yaml:"runWebhookExpireInterval"`
	CommitStatusExpireInterval time.Duration `yaml:"commitStatusExpireInterval"`
}

type ObjectStorage

type ObjectStorage struct {
	Type ObjectStorageType `yaml:"type"`

	// Posix
	Path string `yaml:"path"`

	// S3
	Endpoint        string `yaml:"endpoint"`
	Bucket          string `yaml:"bucket"`
	Location        string `yaml:"location"`
	AccessKey       string `yaml:"accessKey"`
	SecretAccessKey string `yaml:"secretAccessKey"`
	DisableTLS      bool   `yaml:"disableTLS"`
}

type ObjectStorageType

type ObjectStorageType string
const (
	ObjectStorageTypePosix ObjectStorageType = "posix"
	ObjectStorageTypeS3    ObjectStorageType = "s3"
)

type OrganizationMemberAddingMode added in v0.8.0

type OrganizationMemberAddingMode string
const (
	OrganizationMemberAddingModeDirect     OrganizationMemberAddingMode = "direct"
	OrganizationMemberAddingModeInvitation OrganizationMemberAddingMode = "invitation"
)

func (OrganizationMemberAddingMode) IsValid added in v0.8.0

func (vt OrganizationMemberAddingMode) IsValid() bool

type Runservice

type Runservice struct {
	Debug bool `yaml:"debug"`

	DataDir string `yaml:"dataDir"`

	DB DB `yaml:"db"`

	Web Web `yaml:"web"`

	APIToken string `yaml:"apiToken"`

	ExecutorAPIToken string `yaml:"executorAPIToken"`

	ObjectStorage ObjectStorage `yaml:"objectStorage"`

	RunCacheExpireInterval     time.Duration `yaml:"runCacheExpireInterval"`
	RunWorkspaceExpireInterval time.Duration `yaml:"runWorkspaceExpireInterval"`
	RunLogExpireInterval       time.Duration `yaml:"runLogExpireInterval"`
}

type Scheduler

type Scheduler struct {
	Debug bool `yaml:"debug"`

	RunserviceURL      string `yaml:"runserviceURL"`
	RunserviceAPIToken string `yaml:"runserviceAPIToken"`
}

type TokenSigning

type TokenSigning struct {
	// token duration (defaults to 12 hours)
	Duration time.Duration `yaml:"duration"`
	// signing method: "hmac" or "rsa"
	Method string `yaml:"method"`
	// signing key. Used only with HMAC signing method
	Key string `yaml:"key"`
	// path to a file containing a pem encoded private key. Used only with RSA signing method
	PrivateKeyPath string `yaml:"privateKeyPath"`
	// path to a file containing a pem encoded public key. Used only with RSA signing method
	PublicKeyPath string `yaml:"publicKeyPath"`
}

type Web

type Web struct {
	// http listen addess
	ListenAddress string `yaml:"listenAddress"`

	// use TLS (https)
	TLS bool `yaml:"tls"`
	// TLSCert is the path to the pem formatted server certificate. If the
	// certificate is signed by a certificate authority, the certFile should be
	// the concatenation of the server's certificate, any intermediates, and the
	// CA's certificate.
	TLSCertFile string `yaml:"tlsCertFile"`
	// Server cert private key
	// TODO(sgotti) support encrypted private keys (add a private key password config entry)
	TLSKeyFile string `yaml:"tlsKeyFile"`

	// CORS allowed origins
	AllowedOrigins []string `yaml:"allowedOrigins"`
}

Jump to

Keyboard shortcuts

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