config

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNoToken informs the user that at least one token is required.
	ErrNoToken = errors.New("no GitHub token or GitLab token configured")
)

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	// Path to directory to store files and repository clones.
	DataDir *string `json:"dataDir,omitempty" yaml:"dataDir,omitempty" mapstructure:"dataDir,omitempty"`

	// Toggle dry-run mode. No pull requests will be created or merged when enabled.
	DryRun bool `json:"dryRun,omitempty" yaml:"dryRun,omitempty" mapstructure:"dryRun,omitempty"`

	// Author to use for git commits. Global git configuration applies if not set.
	// Must conform to RFC5322: `User Name <user@name.local>`.
	GitAuthor string `json:"gitAuthor,omitempty" yaml:"gitAuthor,omitempty" mapstructure:"gitAuthor,omitempty"`

	// Command-line options to pass to `git clone`.
	GitCloneOptions []string `json:"gitCloneOptions,omitempty" yaml:"gitCloneOptions,omitempty" mapstructure:"gitCloneOptions,omitempty"`

	// Default commit message to use if a task does not define a custom one.
	GitCommitMessage string `json:"gitCommitMessage,omitempty" yaml:"gitCommitMessage,omitempty" mapstructure:"gitCommitMessage,omitempty"`

	// Level for logs sent by the git sub-system. These logs can be very verbose and
	// can make it tricky to find logs of other sub-systems.
	GitLogLevel ConfigurationGitLogLevel `json:"gitLogLevel,omitempty" yaml:"gitLogLevel,omitempty" mapstructure:"gitLogLevel,omitempty"`

	// Path to `git` executable. PATH will be searched if not set.
	GitPath string `json:"gitPath,omitempty" yaml:"gitPath,omitempty" mapstructure:"gitPath,omitempty"`

	// Configure how to clone git repositories.
	GitUrl ConfigurationGitUrl `json:"gitUrl,omitempty" yaml:"gitUrl,omitempty" mapstructure:"gitUrl,omitempty"`

	// Address of GitHub server to use.
	GithubAddress *string `json:"githubAddress,omitempty" yaml:"githubAddress,omitempty" mapstructure:"githubAddress,omitempty"`

	// If true, disables caching of HTTP responses received from the GitHub API.
	GithubCacheDisabled bool `json:"githubCacheDisabled,omitempty" yaml:"githubCacheDisabled,omitempty" mapstructure:"githubCacheDisabled,omitempty"`

	// Token to use for authentication at the GitHub API.
	GithubToken *string `json:"githubToken,omitempty" yaml:"githubToken,omitempty" mapstructure:"githubToken,omitempty"`

	// Address of GitLab server to use.
	GitlabAddress string `json:"gitlabAddress,omitempty" yaml:"gitlabAddress,omitempty" mapstructure:"gitlabAddress,omitempty"`

	// Token to use for authentication at the GitLab API.
	GitlabToken *string `json:"gitlabToken,omitempty" yaml:"gitlabToken,omitempty" mapstructure:"gitlabToken,omitempty"`

	// Path to the Java binary to execute plugins. If not set explicitly, then
	// saturn-bot searches for the binary in $PATH.
	JavaPath string `json:"javaPath,omitempty" yaml:"javaPath,omitempty" mapstructure:"javaPath,omitempty"`

	// Format of log messages.
	LogFormat ConfigurationLogFormat `json:"logFormat,omitempty" yaml:"logFormat,omitempty" mapstructure:"logFormat,omitempty"`

	// Log level of the application.
	LogLevel ConfigurationLogLevel `json:"logLevel,omitempty" yaml:"logLevel,omitempty" mapstructure:"logLevel,omitempty"`

	// Level of logs sent by plugins. Set this to the same value as `logLevel` in
	// order to display the logs of a plugin.
	PluginLogLevel ConfigurationPluginLogLevel `json:"pluginLogLevel,omitempty" yaml:"pluginLogLevel,omitempty" mapstructure:"pluginLogLevel,omitempty"`

	// Address of a Prometheus Pushgateway to send metrics to.
	PrometheusPushgatewayUrl *string `` /* 133-byte string literal not displayed */

	// Path to the Python binary to execute plugins. If not set explicitly, then
	// saturn-bot searches for the binary in $PATH.
	PythonPath string `json:"pythonPath,omitempty" yaml:"pythonPath,omitempty" mapstructure:"pythonPath,omitempty"`

	// Turn access log of server on or off.
	ServerAccessLog bool `json:"serverAccessLog,omitempty" yaml:"serverAccessLog,omitempty" mapstructure:"serverAccessLog,omitempty"`

	// Address of the server.
	ServerAddr string `json:"serverAddr,omitempty" yaml:"serverAddr,omitempty" mapstructure:"serverAddr,omitempty"`

	// URL of the API server. The value is used to populate the `servers` array in the
	// OpenAPI definition.
	ServerBaseUrl string `json:"serverBaseUrl,omitempty" yaml:"serverBaseUrl,omitempty" mapstructure:"serverBaseUrl,omitempty"`

	// Turn compression of responses on or off.
	ServerCompress bool `json:"serverCompress,omitempty" yaml:"serverCompress,omitempty" mapstructure:"serverCompress,omitempty"`

	// If `true`, display executed SQL queries and errors of the database. Useful for
	// debugging.
	ServerDatabaseLog bool `json:"serverDatabaseLog,omitempty" yaml:"serverDatabaseLog,omitempty" mapstructure:"serverDatabaseLog,omitempty"`

	// Path to the sqlite database of the server. If unset, defaults to
	// `{{dataDir}}/db/saturn-bot.db`.
	ServerDatabasePath string `json:"serverDatabasePath,omitempty" yaml:"serverDatabasePath,omitempty" mapstructure:"serverDatabasePath,omitempty"`

	// Interval at which a worker queries the server for new tasks to run.
	WorkerLoopInterval string `json:"workerLoopInterval,omitempty" yaml:"workerLoopInterval,omitempty" mapstructure:"workerLoopInterval,omitempty"`

	// Number of parallel executions of tasks per worker.
	WorkerParallelExecutions int `` /* 133-byte string literal not displayed */

	// Base URL of the server API to query for new tasks to execute.
	WorkerServerAPIBaseURL string `` /* 127-byte string literal not displayed */
}

Configuration settings of saturn-bot.

func Read

func Read(cfgFile string) (cfg Configuration, err error)

func (Configuration) GitUserEmail

func (c Configuration) GitUserEmail() string

func (Configuration) GitUserName

func (c Configuration) GitUserName() string

func (*Configuration) UnmarshalJSON

func (j *Configuration) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Configuration) UnmarshalYAML

func (j *Configuration) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type ConfigurationGitLogLevel

type ConfigurationGitLogLevel string
const ConfigurationGitLogLevelDebug ConfigurationGitLogLevel = "debug"
const ConfigurationGitLogLevelError ConfigurationGitLogLevel = "error"
const ConfigurationGitLogLevelInfo ConfigurationGitLogLevel = "info"
const ConfigurationGitLogLevelWarn ConfigurationGitLogLevel = "warn"

func (*ConfigurationGitLogLevel) UnmarshalJSON

func (j *ConfigurationGitLogLevel) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*ConfigurationGitLogLevel) UnmarshalYAML

func (j *ConfigurationGitLogLevel) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type ConfigurationGitUrl added in v0.9.0

type ConfigurationGitUrl string
const ConfigurationGitUrlHttps ConfigurationGitUrl = "https"
const ConfigurationGitUrlSsh ConfigurationGitUrl = "ssh"

func (*ConfigurationGitUrl) UnmarshalJSON added in v0.9.0

func (j *ConfigurationGitUrl) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*ConfigurationGitUrl) UnmarshalYAML added in v0.9.0

func (j *ConfigurationGitUrl) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type ConfigurationLogFormat

type ConfigurationLogFormat string
const ConfigurationLogFormatAuto ConfigurationLogFormat = "auto"
const ConfigurationLogFormatConsole ConfigurationLogFormat = "console"
const ConfigurationLogFormatJson ConfigurationLogFormat = "json"

func (*ConfigurationLogFormat) UnmarshalJSON

func (j *ConfigurationLogFormat) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*ConfigurationLogFormat) UnmarshalYAML

func (j *ConfigurationLogFormat) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type ConfigurationLogLevel

type ConfigurationLogLevel string
const ConfigurationLogLevelDebug ConfigurationLogLevel = "debug"
const ConfigurationLogLevelError ConfigurationLogLevel = "error"
const ConfigurationLogLevelInfo ConfigurationLogLevel = "info"
const ConfigurationLogLevelWarn ConfigurationLogLevel = "warn"

func (*ConfigurationLogLevel) UnmarshalJSON

func (j *ConfigurationLogLevel) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*ConfigurationLogLevel) UnmarshalYAML

func (j *ConfigurationLogLevel) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type ConfigurationPluginLogLevel added in v0.12.0

type ConfigurationPluginLogLevel string
const ConfigurationPluginLogLevelDebug ConfigurationPluginLogLevel = "debug"
const ConfigurationPluginLogLevelError ConfigurationPluginLogLevel = "error"
const ConfigurationPluginLogLevelInfo ConfigurationPluginLogLevel = "info"
const ConfigurationPluginLogLevelWarn ConfigurationPluginLogLevel = "warn"

func (*ConfigurationPluginLogLevel) UnmarshalJSON added in v0.12.0

func (j *ConfigurationPluginLogLevel) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*ConfigurationPluginLogLevel) UnmarshalYAML added in v0.12.0

func (j *ConfigurationPluginLogLevel) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

Jump to

Keyboard shortcuts

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