config

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultEnabled is the default value which define if GRGate should process
	// the repository or not
	DefaultEnabled bool = true

	// DefaultDashboardEnabled define if the issue dashboard your be enabled to
	// provide feedback on the state of GRGate
	DefaultDashboardEnabled bool = true

	// DefaultDashboardAuthor define the title of the issue dashboard
	DefaultDashboardAuthor string = "GRGate[bot]"

	// DefaultDashboardTitle define the title of the issue dashboard
	DefaultDashboardTitle string = "GRGate dashboard"

	// DefaultDashboardTemplate define the default template used to display
	// the state of GRGate in a GitHub/GitLab issue
	DefaultDashboardTemplate string = `` /* 288-byte string literal not displayed */

	// DefaultTagRegexp is the default pattern used to match tags attached to
	// releases
	DefaultTagRegexp string = ".*"

	// DefaultPlatform is the default platform
	DefaultPlatform PlatformType = GithubPlatform

	// DefaultReleaseNoteEnabled define if the statuses should be added to the
	// release note
	DefaultReleaseNoteEnabled bool = true

	// DefaultReleaseNoteMarkerStart is the string that define the start of the
	// section appended to the release note
	DefaultReleaseNoteMarkerStart string = "<!-- GRGate start -->"

	// DefaultReleaseNoteMarkerEnd is the string that define the end of the
	// section appended to the release note
	DefaultReleaseNoteMarkerEnd string = "<!-- GRGate end -->"

	// DefaultReleaseNoteTemplate define the default template used to display
	// statuses in the release note
	DefaultReleaseNoteTemplate string = `` /* 246-byte string literal not displayed */

	// DefaultRepoConfigPath is the default path of the .grgate config stored in
	// the repository
	DefaultRepoConfigPath string = ".grgate.yaml"

	// DefaultServerListenAddress is the default main server listening address
	DefaultServerListenAddress string = "0.0.0.0:8080"

	// DefaultServerMetricsAddress is the default metric server listening address
	DefaultServerMetricsAddress string = "0.0.0.0:9101"

	// DefaultServerProbeAddress is the default probe server listening address
	DefaultServerProbeAddress string = "0.0.0.0:8086"

	// DefaultWorkers defined the default amount of workers
	DefaultWorkers int = 5

	// GithubPlatform represent the Github platform
	GithubPlatform PlatformType = "github"

	// GitlabPlatform represent the Gitlab platform
	GitlabPlatform PlatformType = "gitlab"
)

Variables

View Source
var (
	// CommitSha from source repository used to build GRGate
	CommitSha string

	// Main contains the generated main configuration
	Main *MainConfig

	// Version of GRGate
	Version string
)

Functions

func NewGlobalConfig

func NewGlobalConfig(path string) (v *viper.Viper, err error)

NewGlobalConfig define the viper configuration and set the global config.Main variable base on a config file

Types

type Dashboard added in v0.3.0

type Dashboard struct {
	Enabled  bool   `mapstructure:"enabled"`
	Author   string `mapstructure:"author"`
	Title    string `mapstructure:"title"`
	Template string `mapstructure:"template"`
}

Dashboard define the issue dashboard configuration

type Github

type Github struct {
	AppID          int64  `mapstructure:"appID"`
	InstallationID int64  `mapstructure:"installationID"`
	PrivateKeyPath string `mapstructure:"privateKeyPath"`
}

Github define Github configuration

type Gitlab

type Gitlab struct {
	Token string `mapstructure:"token"`
}

Gitlab define Gitlab configuration

type MainConfig

type MainConfig struct {
	Github         *Github       `mapstructure:"github"`
	Gitlab         *Gitlab       `mapstructure:"gitlab"`
	Globals        *RepoConfig   `mapstructure:"globals"`
	LogFormat      string        `mapstructure:"logFormat"`
	LogLevel       string        `mapstructure:"logLevel"`
	Platform       *PlatformType `mapstructure:"platform"`
	RepoConfigPath string        `mapstructure:"repoConfigPath"`
	Server         *Server       `mapstructure:"server"`
	Workers        int           `mapstructure:"workers"`
}

MainConfig define the main configuration

type PlatformType

type PlatformType string

PlatformType is the type of platform to run against (Github or Gitlab)

type ReleaseNote added in v0.2.0

type ReleaseNote struct {
	Enabled  bool   `mapstructure:"enabled"`
	Template string `mapstructure:"template"`
}

ReleaseNote define the release note configuration

type RepoConfig

type RepoConfig struct {
	Enabled     bool         `mapstructure:"enabled"`
	Dashboard   *Dashboard   `mapstructure:"dashboard"`
	ReleaseNote *ReleaseNote `mapstructure:"releaseNote"`
	Statuses    []string     `mapstructure:"statuses"`
	TagRegexp   string       `mapstructure:"tagRegexp"`
}

RepoConfig define repository configuration

func NewRepoConfig

func NewRepoConfig(platform platforms.Platform, owner, repository string) (config *RepoConfig, err error)

NewRepoConfig returns configuration defined in a repository

type Server

type Server struct {
	ListenAddress  string `mapstructure:"listenAddress"`
	MetricsAddress string `mapstructure:"metricsAddress"`
	ProbeAddress   string `mapstructure:"probeAddress"`
	WebhookSecret  string `mapstructure:"webhookSecret"`
}

Server define server configuration

Jump to

Keyboard shortcuts

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