config

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config implements configuration file handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(c *Config) error

Write persists the given Config to the given path.

func WriteAuth

func WriteAuth(o *OAuth2) error

WriteAuth persists the given Config to the given path.

func WriteBasicAuth added in v0.10.0

func WriteBasicAuth(a *BasicAuth) error

WriteBasicAuth persists the given Config to the given path.

Types

type Auth

type Auth struct {
	OAuth2 *OAuth2 `json:"oauth2"`
}

Auth represents the structure of the auth.yml

type BasicAuth added in v0.10.0

type BasicAuth struct {
	User   string `json:"user"`
	APIKey string `json:"apiKey"`
}

BasicAuth represents the structure of the auth.yml

func ReadBasicAuth added in v0.10.0

func ReadBasicAuth() (*BasicAuth, error)

ReadBasicAuth the config file.

type Config

type Config struct {
	JiraURL     string   `json:"jiraURL"`
	Issues      []Issue  `json:"issues"`
	Ignore      []Regexp `json:"ignore"`
	RoundIssues []Regexp `json:"roundIssues"`
}

Config represents the structure of the config file.

func Read

func Read() (*Config, error)

Read the config file.

type Issue

type Issue struct {
	ID             string   `json:"id"`
	Regexes        []Regexp `json:"regexes"`
	DefaultComment string   `json:"defaultComment"`
}

Issue represents the list of known Jira issues.

type OAuth2

type OAuth2 struct {
	ClientID string        `json:"clientID"`
	Secret   string        `json:"secret"`
	Token    *oauth2.Token `json:"token"`
}

OAuth2 is a config entry containing oauth2 secrets

func ReadAuth

func ReadAuth() (*OAuth2, error)

ReadAuth the config file.

type Regexp

type Regexp struct {
	regexp.Regexp
}

Regexp is a type that supports JSON Unmarshalling

func (*Regexp) MarshalJSON

func (r *Regexp) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the json.Marshaler interface.

func (*Regexp) UnmarshalJSON

func (r *Regexp) UnmarshalJSON(text []byte) error

UnmarshalJSON satisfies the json.Unmarshaler interface.

Jump to

Keyboard shortcuts

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