conf

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBitBucketEndpoint = "https://api.bitbucket.org/2.0"
View Source
const DefaultGitHubEndpoint = "https://api.github.com"
View Source
const DefaultGitLabEndpoint = "https://gitlab.com/api/v4"
View Source
const DefaultGitLabTokenType = "oauth"

Variables

This section is empty.

Functions

This section is empty.

Types

type BitBucketConfig added in v0.6.0

type BitBucketConfig struct {
	RefreshToken string `envconfig:"REFRESH_TOKEN" json:"refresh_token,omitempty"`
	ClientID     string `envconfig:"CLIENT_ID" json:"client_id,omitempty"`
	ClientSecret string `envconfig:"CLIENT_SECRET" json:"client_secret,omitempty"`
	Endpoint     string `envconfig:"ENDPOINT" json:"endpoint"`
	Repo         string `envconfig:"REPO" json:"repo"`
}

type Configuration

type Configuration struct {
	JWT       JWTConfiguration `json:"jwt"`
	GitHub    GitHubConfig     `envconfig:"GITHUB" json:"github"`
	GitLab    GitLabConfig     `envconfig:"GITLAB" json:"gitlab"`
	BitBucket BitBucketConfig  `envconfig:"BITBUCKET" json:"bitbucket"`
	Roles     []string         `envconfig:"ROLES" json:"roles"`
}

Configuration holds all the per-instance configuration.

func LoadConfig

func LoadConfig(filename string) (*Configuration, error)

LoadConfig loads per-instance configuration.

func (*Configuration) ApplyDefaults

func (config *Configuration) ApplyDefaults()

ApplyDefaults sets defaults for a Configuration

type DBConfiguration

type DBConfiguration struct {
	Dialect     string `json:"dialect"`
	Driver      string `json:"driver" required:"true"`
	URL         string `json:"url" envconfig:"DATABASE_URL" required:"true"`
	Namespace   string `json:"namespace"`
	Automigrate bool   `json:"automigrate"`
}

DBConfiguration holds all the database related configuration.

type GitHubConfig

type GitHubConfig struct {
	AccessToken string `envconfig:"ACCESS_TOKEN" json:"access_token,omitempty"`
	Endpoint    string `envconfig:"ENDPOINT" json:"endpoint"`
	Repo        string `envconfig:"REPO" json:"repo"` // Should be "owner/repo" format
}

type GitLabConfig added in v0.4.0

type GitLabConfig struct {
	AccessToken     string `envconfig:"ACCESS_TOKEN" json:"access_token,omitempty"`
	AccessTokenType string `envconfig:"ACCESS_TOKEN_TYPE" json:"access_token_type"`
	Endpoint        string `envconfig:"ENDPOINT" json:"endpoint"`
	Repo            string `envconfig:"REPO" json:"repo"` // Should be "owner/repo" format
}

type GlobalConfiguration

type GlobalConfiguration struct {
	API struct {
		Host     string
		Port     int `envconfig:"PORT" default:"8081"`
		Endpoint string
	}
	DB                DBConfiguration
	Logging           nconf.LoggingConfig `envconfig:"LOG"`
	OperatorToken     string              `split_words:"true"`
	MultiInstanceMode bool
}

GlobalConfiguration holds all the configuration that applies to all instances.

func LoadGlobal

func LoadGlobal(filename string) (*GlobalConfiguration, error)

LoadGlobal loads configuration from file and environment variables.

type JWTConfiguration

type JWTConfiguration struct {
	Secret string `json:"secret" required:"true"`
}

JWTConfiguration holds all the JWT related configuration.

Jump to

Keyboard shortcuts

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