config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 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
const (
	GithubPlatform PlatformType = "github"
	GitlabPlatform PlatformType = "gitlab"
)

type RepoConfig

type RepoConfig struct {
	Enabled   bool     `mapstructure:"enabled"`
	TagRegexp string   `mapstructure:"tagRegexp"`
	Statuses  []string `mapstructure:"statuses"`
}

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