config

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Disabled bool `envconfig:"DRONE_AGENTS_DISABLED"`
}

type Authentication

type Authentication struct {
	Endpoint   string `envconfig:"DRONE_ADMISSION_PLUGIN_ENDPOINT"`
	Secret     string `envconfig:"DRONE_ADMISSION_PLUGIN_SECRET"`
	SkipVerify bool   `envconfig:"DRONE_ADMISSION_PLUGIN_SKIP_VERIFY"`
}

Authentication Controller configuration

type AzureBlob added in v1.3.0

type AzureBlob struct {
	ContainerName      string `envconfig:"DRONE_AZURE_BLOB_CONTAINER_NAME"`
	StorageAccountName string `envconfig:"DRONE_AZURE_STORAGE_ACCOUNT_NAME"`
	StorageAccessKey   string `envconfig:"DRONE_AZURE_STORAGE_ACCESS_KEY"`
}

AzureBlob providers the storage configuration.

type Bitbucket

type Bitbucket struct {
	ClientID     string `envconfig:"DRONE_BITBUCKET_CLIENT_ID"`
	ClientSecret string `envconfig:"DRONE_BITBUCKET_CLIENT_SECRET"`
	SkipVerify   bool   `envconfig:"DRONE_BITBUCKET_SKIP_VERIFY"`
	Debug        bool   `envconfig:"DRONE_BITBUCKET_DEBUG"`
}

Bitbucket provides the bitbucket client configuration.

type Bytes

type Bytes int64

Bytes stores number bytes (e.g. megabytes)

func (*Bytes) Decode

func (b *Bytes) Decode(value string) error

Decode implements a decoder that parses a string representation of bytes into the number of bytes it represents.

func (*Bytes) Int64

func (b *Bytes) Int64() int64

Int64 returns the int64 value of the Byte.

func (*Bytes) String

func (b *Bytes) String() string

String returns the string value of the Byte.

type Cleanup added in v1.8.0

type Cleanup struct {
	Disabled bool          `envconfig:"DRONE_CLEANUP_DISABLED"`
	Interval time.Duration `envconfig:"DRONE_CLEANUP_INTERVAL"         default:"24h"`
	Running  time.Duration `envconfig:"DRONE_CLEANUP_DEADLINE_RUNNING" default:"24h"`
	Pending  time.Duration `envconfig:"DRONE_CLEANUP_DEADLINE_PENDING" default:"24h"`
}

type Cloning

type Cloning struct {
	AlwaysAuth bool   `envconfig:"DRONE_GIT_ALWAYS_AUTH"`
	Username   string `envconfig:"DRONE_GIT_USERNAME"`
	Password   string `envconfig:"DRONE_GIT_PASSWORD"`
	Image      string `envconfig:"DRONE_GIT_IMAGE"`
	Pull       string `envconfig:"DRONE_GIT_IMAGE_PULL" default:"IfNotExists"`
}

Cloning provides the cloning configuration.

type Config

type Config struct {
	License string `envconfig:"DRONE_LICENSE"`

	Authn        Authentication
	Agent        Agent
	AzureBlob    AzureBlob
	Convert      Convert
	Cleanup      Cleanup
	Cron         Cron
	Cloning      Cloning
	Database     Database
	Datadog      Datadog
	Docker       Docker
	HTTP         HTTP
	Jsonnet      Jsonnet
	Starlark     Starlark
	Logging      Logging
	Prometheus   Prometheus
	Proxy        Proxy
	Registration Registration
	Registries   Registries
	Repository   Repository
	Runner       Runner
	Nomad        Nomad
	Kube         Kubernetes
	RPC          RPC
	S3           S3
	Secrets      Secrets
	Server       Server
	Session      Session
	Status       Status
	Users        Users
	Validate     Validate
	Webhook      Webhook
	Yaml         Yaml

	// Remote configurations
	Bitbucket Bitbucket
	Gitea     Gitea
	Github    Github
	GitLab    GitLab
	Gogs      Gogs
	Stash     Stash
}

Config provides the system configuration.

func Environ

func Environ() (Config, error)

Environ returns the settings from the environment.

func (*Config) IsBitbucket

func (c *Config) IsBitbucket() bool

IsBitbucket returns true if the Bitbucket Cloud integration is activated.

func (*Config) IsGitHub

func (c *Config) IsGitHub() bool

IsGitHub returns true if the GitHub integration is activated.

func (*Config) IsGitHubEnterprise

func (c *Config) IsGitHubEnterprise() bool

IsGitHubEnterprise returns true if the GitHub integration is activated.

func (*Config) IsGitLab

func (c *Config) IsGitLab() bool

IsGitLab returns true if the GitLab integration is activated.

func (*Config) IsGitea

func (c *Config) IsGitea() bool

IsGitea returns true if the Gitea integration is activated.

func (*Config) IsGogs

func (c *Config) IsGogs() bool

IsGogs returns true if the Gogs integration is activated.

func (*Config) IsStash

func (c *Config) IsStash() bool

IsStash returns true if the Atlassian Stash integration is activated.

func (*Config) String

func (c *Config) String() string

String returns the configuration in string format.

type Convert added in v1.4.0

type Convert struct {
	Extension  string        `envconfig:"DRONE_CONVERT_PLUGIN_EXTENSION"`
	Endpoint   string        `envconfig:"DRONE_CONVERT_PLUGIN_ENDPOINT"`
	Secret     string        `envconfig:"DRONE_CONVERT_PLUGIN_SECRET"`
	SkipVerify bool          `envconfig:"DRONE_CONVERT_PLUGIN_SKIP_VERIFY"`
	Timeout    time.Duration `envconfig:"DRONE_CONVERT_TIMEOUT" default:"1m"`
}

Convert provides the converter webhook configuration.

type Cron

type Cron struct {
	Disabled bool          `envconfig:"DRONE_CRON_DISABLED"`
	Interval time.Duration `envconfig:"DRONE_CRON_INTERVAL" default:"30m"`
}

Cron provides the cron configuration.

type Database

type Database struct {
	Driver     string `envconfig:"DRONE_DATABASE_DRIVER"     default:"sqlite3"`
	Datasource string `envconfig:"DRONE_DATABASE_DATASOURCE" default:"core.sqlite"`
	Secret     string `envconfig:"DRONE_DATABASE_SECRET"`

	// Feature flag
	LegacyBatch bool `envconfig:"DRONE_DATABASE_LEGACY_BATCH"`
}

Database provides the database configuration.

type Datadog

type Datadog struct {
	Enabled  bool   `envconfig:"DRONE_DATADOG_ENABLED"`
	Endpoint string `envconfig:"DRONE_DATADOG_ENDPOINT"`
	Token    string `envconfig:"DRONE_DATADOG_TOKEN"`
}

Datadog provides datadog configuration

type Docker

type Docker struct {
	Config string `envconfig:"DRONE_DOCKER_CONFIG"`
}

Docker provides docker configuration

type GitLab

type GitLab struct {
	Server       string `envconfig:"DRONE_GITLAB_SERVER" default:"https://gitlab.com"`
	ClientID     string `envconfig:"DRONE_GITLAB_CLIENT_ID"`
	ClientSecret string `envconfig:"DRONE_GITLAB_CLIENT_SECRET"`
	SkipVerify   bool   `envconfig:"DRONE_GITLAB_SKIP_VERIFY"`
	Debug        bool   `envconfig:"DRONE_GITLAB_DEBUG"`
}

GitLab provides the gitlab client configuration.

type Gitea

type Gitea struct {
	Server       string   `envconfig:"DRONE_GITEA_SERVER"`
	ClientID     string   `envconfig:"DRONE_GITEA_CLIENT_ID"`
	ClientSecret string   `envconfig:"DRONE_GITEA_CLIENT_SECRET"`
	SkipVerify   bool     `envconfig:"DRONE_GITEA_SKIP_VERIFY"`
	Scope        []string `envconfig:"DRONE_GITEA_SCOPE" default:"repo,repo:status,user:email,read:org"`
	Debug        bool     `envconfig:"DRONE_GITEA_DEBUG"`
}

Gitea provides the gitea client configuration.

type Github

type Github struct {
	Server       string   `envconfig:"DRONE_GITHUB_SERVER" default:"https://github.com"`
	APIServer    string   `envconfig:"DRONE_GITHUB_API_SERVER"`
	ClientID     string   `envconfig:"DRONE_GITHUB_CLIENT_ID"`
	ClientSecret string   `envconfig:"DRONE_GITHUB_CLIENT_SECRET"`
	SkipVerify   bool     `envconfig:"DRONE_GITHUB_SKIP_VERIFY"`
	Scope        []string `envconfig:"DRONE_GITHUB_SCOPE" default:"repo,repo:status,user:email,read:org"`
	RateLimit    int      `envconfig:"DRONE_GITHUB_USER_RATELIMIT"`
	Debug        bool     `envconfig:"DRONE_GITHUB_DEBUG"`
}

Github provides the github client configuration.

type Gogs

type Gogs struct {
	Server     string `envconfig:"DRONE_GOGS_SERVER"`
	SkipVerify bool   `envconfig:"DRONE_GOGS_SKIP_VERIFY"`
	Debug      bool   `envconfig:"DRONE_GOGS_DEBUG"`
}

Gogs provides the gogs client configuration.

type HTTP

type HTTP struct {
	AllowedHosts          []string          `envconfig:"DRONE_HTTP_ALLOWED_HOSTS"`
	HostsProxyHeaders     []string          `envconfig:"DRONE_HTTP_PROXY_HEADERS"`
	SSLRedirect           bool              `envconfig:"DRONE_HTTP_SSL_REDIRECT"`
	SSLTemporaryRedirect  bool              `envconfig:"DRONE_HTTP_SSL_TEMPORARY_REDIRECT"`
	SSLHost               string            `envconfig:"DRONE_HTTP_SSL_HOST"`
	SSLProxyHeaders       map[string]string `envconfig:"DRONE_HTTP_SSL_PROXY_HEADERS"`
	STSSeconds            int64             `envconfig:"DRONE_HTTP_STS_SECONDS"`
	STSIncludeSubdomains  bool              `envconfig:"DRONE_HTTP_STS_INCLUDE_SUBDOMAINS"`
	STSPreload            bool              `envconfig:"DRONE_HTTP_STS_PRELOAD"`
	ForceSTSHeader        bool              `envconfig:"DRONE_HTTP_STS_FORCE_HEADER"`
	BrowserXSSFilter      bool              `envconfig:"DRONE_HTTP_BROWSER_XSS_FILTER"    default:"true"`
	FrameDeny             bool              `envconfig:"DRONE_HTTP_FRAME_DENY"            default:"true"`
	ContentTypeNosniff    bool              `envconfig:"DRONE_HTTP_CONTENT_TYPE_NO_SNIFF"`
	ContentSecurityPolicy string            `envconfig:"DRONE_HTTP_CONTENT_SECURITY_POLICY"`
	ReferrerPolicy        string            `envconfig:"DRONE_HTTP_REFERRER_POLICY"`
}

HTTP provides http configuration.

type Jsonnet

type Jsonnet struct {
	Enabled bool `envconfig:"DRONE_JSONNET_ENABLED"`
}

Jsonnet configures the jsonnet plugin

type Kubernetes

type Kubernetes struct {
	Enabled            bool   `envconfig:"DRONE_KUBERNETES_ENABLED"`
	Namespace          string `envconfig:"DRONE_KUBERNETES_NAMESPACE"`
	Path               string `envconfig:"DRONE_KUBERNETES_CONFIG_PATH"`
	URL                string `envconfig:"DRONE_KUBERNETES_CONFIG_URL"`
	TTL                int    `envconfig:"DRONE_KUBERNETES_TTL_AFTER_FINISHED" default:"300"`
	ServiceAccountName string `envconfig:"DRONE_KUBERNETES_SERVICE_ACCOUNT"`
	PullPolicy         string `envconfig:"DRONE_KUBERNETES_IMAGE_PULL" default:"Always"`
	Image              string `envconfig:"DRONE_KUBERNETES_IMAGE"`
}

Kubernetes provides kubernetes configuration

type License

type License struct {
	Key      string `envconfig:"DRONE_LICENSE"`
	Endpoint string `envconfig:"DRONE_LICENSE_ENDPOINT"`
}

License provides license configuration

type Logging

type Logging struct {
	Debug  bool `envconfig:"DRONE_LOGS_DEBUG"`
	Trace  bool `envconfig:"DRONE_LOGS_TRACE"`
	Color  bool `envconfig:"DRONE_LOGS_COLOR"`
	Pretty bool `envconfig:"DRONE_LOGS_PRETTY"`
	Text   bool `envconfig:"DRONE_LOGS_TEXT"`
}

Logging provides the logging configuration.

type Nomad

type Nomad struct {
	Enabled     bool              `envconfig:"DRONE_NOMAD_ENABLED"`
	Datacenters []string          `envconfig:"DRONE_NOMAD_DATACENTER" default:"dc1"`
	Namespace   string            `envconfig:"DRONE_NOMAD_NAMESPACE"`
	Region      string            `envconfig:"DRONE_NOMAD_REGION"`
	Prefix      string            `envconfig:"DRONE_NOMAD_JOB_PREFIX" default:"drone-job-"`
	Image       string            `envconfig:"DRONE_NOMAD_IMAGE"`
	ImagePull   bool              `envconfig:"DRONE_NOMAD_IMAGE_PULL"`
	Memory      int               `envconfig:"DRONE_NOMAD_DEFAULT_RAM" default:"1024"`
	Labels      map[string]string `envconfig:"DRONE_NOMAD_LABELS"`
	CPU         int               `envconfig:"DRONE_NOMAD_DEFAULT_CPU" default:"500"`
}

Nomad configuration.

type Prometheus added in v1.2.0

type Prometheus struct {
	EnableAnonymousAccess bool `envconfig:"DRONE_PROMETHEUS_ANONYMOUS_ACCESS" default:"false"`
}

Prometheus provides the prometheus configuration.

type Proxy

type Proxy struct {
	Addr  string `envconfig:"-"`
	Host  string `envconfig:"DRONE_SERVER_PROXY_HOST"`
	Proto string `envconfig:"DRONE_SERVER_PROXY_PROTO"`
}

Proxy provides proxy server configuration.

type RPC

type RPC struct {
	Server string `envconfig:"DRONE_RPC_SERVER"`
	Secret string `envconfig:"DRONE_RPC_SECRET"`
	Debug  bool   `envconfig:"DRONE_RPC_DEBUG"`
	Host   string `envconfig:"DRONE_RPC_HOST"`
	Proto  string `envconfig:"DRONE_RPC_PROTO"`
}

RPC provides the rpc configuration.

type Registration

type Registration struct {
	Closed bool `envconfig:"DRONE_REGISTRATION_CLOSED"`
}

Registration configuration.

type Registries

type Registries struct {
	Endpoint   string `envconfig:"DRONE_REGISTRY_ENDPOINT"`
	Password   string `envconfig:"DRONE_REGISTRY_SECRET"`
	SkipVerify bool   `envconfig:"DRONE_REGISTRY_SKIP_VERIFY"`
}

Registries provides the registry configuration.

type Repository

type Repository struct {
	Filter     []string `envconfig:"DRONE_REPOSITORY_FILTER"`
	Visibility string   `envconfig:"DRONE_REPOSITORY_VISIBILITY"`
	Trusted    bool     `envconfig:"DRONE_REPOSITORY_TRUSTED"`

	// THIS SETTING IS INTERNAL USE ONLY AND SHOULD
	// NOT BE USED OR RELIED UPON IN PRODUCTION.
	Ignore []string `envconfig:"DRONE_REPOSITORY_IGNORE"`
}

Repository provides the repository configuration.

type Runner

type Runner struct {
	Local      bool              `envconfig:"DRONE_RUNNER_LOCAL"`
	Image      string            `envconfig:"DRONE_RUNNER_IMAGE"    default:"drone/controller:1"`
	Platform   string            `envconfig:"DRONE_RUNNER_PLATFORM" default:"linux/amd64"`
	OS         string            `envconfig:"DRONE_RUNNER_OS"`
	Arch       string            `envconfig:"DRONE_RUNNER_ARCH"`
	Kernel     string            `envconfig:"DRONE_RUNNER_KERNEL"`
	Variant    string            `envconfig:"DRONE_RUNNER_VARIANT"`
	Machine    string            `envconfig:"DRONE_RUNNER_NAME"`
	Capacity   int               `envconfig:"DRONE_RUNNER_CAPACITY" default:"2"`
	Labels     map[string]string `envconfig:"DRONE_RUNNER_LABELS"`
	Volumes    []string          `envconfig:"DRONE_RUNNER_VOLUMES"`
	Networks   []string          `envconfig:"DRONE_RUNNER_NETWORKS"`
	Devices    []string          `envconfig:"DRONE_RUNNER_DEVICES"`
	Privileged []string          `envconfig:"DRONE_RUNNER_PRIVILEGED_IMAGES"`
	Environ    map[string]string `envconfig:"DRONE_RUNNER_ENVIRON"`
	Limits     struct {
		MemSwapLimit Bytes  `envconfig:"DRONE_LIMIT_MEM_SWAP"`
		MemLimit     Bytes  `envconfig:"DRONE_LIMIT_MEM"`
		ShmSize      Bytes  `envconfig:"DRONE_LIMIT_SHM_SIZE"`
		CPUQuota     int64  `envconfig:"DRONE_LIMIT_CPU_QUOTA"`
		CPUShares    int64  `envconfig:"DRONE_LIMIT_CPU_SHARES"`
		CPUSet       string `envconfig:"DRONE_LIMIT_CPU_SET"`
	}
}

Runner provides the runner configuration.

type S3

type S3 struct {
	Bucket    string `envconfig:"DRONE_S3_BUCKET"`
	Prefix    string `envconfig:"DRONE_S3_PREFIX"`
	Endpoint  string `envconfig:"DRONE_S3_ENDPOINT"`
	PathStyle bool   `envconfig:"DRONE_S3_PATH_STYLE"`
}

S3 provides the storage configuration.

type Secrets

type Secrets struct {
	Endpoint   string `envconfig:"DRONE_SECRET_ENDPOINT"`
	Password   string `envconfig:"DRONE_SECRET_SECRET"`
	SkipVerify bool   `envconfig:"DRONE_SECRET_SKIP_VERIFY"`
}

Secrets provides the secret configuration.

type Server

type Server struct {
	Addr  string `envconfig:"-"`
	Host  string `envconfig:"DRONE_SERVER_HOST" default:"localhost:8080"`
	Port  string `envconfig:"DRONE_SERVER_PORT" default:":8080"`
	Proto string `envconfig:"DRONE_SERVER_PROTO" default:"http"`
	Pprof bool   `envconfig:"DRONE_PPROF_ENABLED"`
	Acme  bool   `envconfig:"DRONE_TLS_AUTOCERT"`
	Email string `envconfig:"DRONE_TLS_EMAIL"`
	Cert  string `envconfig:"DRONE_TLS_CERT"`
	Key   string `envconfig:"DRONE_TLS_KEY"`
}

Server provides the server configuration.

type Session

type Session struct {
	Timeout     time.Duration `envconfig:"DRONE_COOKIE_TIMEOUT" default:"720h"`
	Secret      string        `envconfig:"DRONE_COOKIE_SECRET"`
	Secure      bool          `envconfig:"DRONE_COOKIE_SECURE"`
	MappingFile string        `envconfig:"DRONE_LEGACY_TOKEN_MAPPING_FILE"`
}

Session provides the session configuration.

type Starlark added in v1.10.0

type Starlark struct {
	Enabled bool `envconfig:"DRONE_STARLARK_ENABLED"`
}

Starlark configures the starlark plugin

type Stash

type Stash struct {
	Server         string `envconfig:"DRONE_STASH_SERVER"`
	ConsumerKey    string `envconfig:"DRONE_STASH_CONSUMER_KEY"`
	ConsumerSecret string `envconfig:"DRONE_STASH_CONSUMER_SECRET"`
	PrivateKey     string `envconfig:"DRONE_STASH_PRIVATE_KEY"`
	SkipVerify     bool   `envconfig:"DRONE_STASH_SKIP_VERIFY"`
	Debug          bool   `envconfig:"DRONE_STASH_DEBUG"`
}

Stash provides the stash client configuration.

type Status

type Status struct {
	Disabled bool   `envconfig:"DRONE_STATUS_DISABLED"`
	Name     string `envconfig:"DRONE_STATUS_NAME"`
}

Status provides status configurations.

type UserCreate

type UserCreate struct {
	Username string
	Machine  bool
	Admin    bool
	Token    string
}

UserCreate stores account information used to bootstrap the admin user account when the system initializes.

func (*UserCreate) Decode

func (u *UserCreate) Decode(value string) error

Decode implements a decoder that extracts user information from the environment variable string.

type Users

type Users struct {
	Create UserCreate    `envconfig:"DRONE_USER_CREATE"`
	Filter []string      `envconfig:"DRONE_USER_FILTER"`
	MinAge time.Duration `envconfig:"DRONE_MIN_AGE"`
}

Users provides the user configuration.

type Validate added in v1.4.0

type Validate struct {
	Endpoint   string        `envconfig:"DRONE_VALIDATE_PLUGIN_ENDPOINT"`
	Secret     string        `envconfig:"DRONE_VALIDATE_PLUGIN_SECRET"`
	SkipVerify bool          `envconfig:"DRONE_VALIDATE_PLUGIN_SKIP_VERIFY"`
	Timeout    time.Duration `envconfig:"DRONE_VALIDATE_TIMEOUT" default:"1m"`
}

Validate provides the validation webhook configuration.

type Webhook

type Webhook struct {
	Events     []string `envconfig:"DRONE_WEBHOOK_EVENTS"`
	Endpoint   []string `envconfig:"DRONE_WEBHOOK_ENDPOINT"`
	Secret     string   `envconfig:"DRONE_WEBHOOK_SECRET"`
	SkipVerify bool     `envconfig:"DRONE_WEBHOOK_SKIP_VERIFY"`
}

Webhook provides the webhook configuration.

type Yaml

type Yaml struct {
	Endpoint   string        `envconfig:"DRONE_YAML_ENDPOINT"`
	Secret     string        `envconfig:"DRONE_YAML_SECRET"`
	SkipVerify bool          `envconfig:"DRONE_YAML_SKIP_VERIFY"`
	Timeout    time.Duration `envconfig:"DRONE_YAML_TIMEOUT" default:"1m"`
}

Yaml provides the yaml webhook configuration.

Jump to

Keyboard shortcuts

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