cfg

package
v0.0.0-...-4d3b9b5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitHubID       fieldKey = iota
	GitHubNumber   fieldKey = iota
	GitHubLabels   fieldKey = iota
	GitHubStatus   fieldKey = iota
	GitHubReporter fieldKey = iota
	LastISUpdate   fieldKey = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is the root configuration object the application creates.

func NewConfig

func NewConfig(cmd *cobra.Command) (Config, error)

NewConfig creates a new, immutable configuration object. This object holds the Viper configuration and the logger, and is validated. The JIRA configuration is not yet initialized.

func (Config) GetConfigFile

func (c Config) GetConfigFile() string

GetConfigFile returns the file that Viper loaded the configuration from.

func (Config) GetConfigString

func (c Config) GetConfigString(key string) string

GetConfigString returns a string value from the Viper configuration.

func (Config) GetDaemonPeriod

func (c Config) GetDaemonPeriod() time.Duration

GetDaemonPeriod returns the period on which the tool runs if in daemon mode.

func (Config) GetFieldID

func (c Config) GetFieldID(key fieldKey) string

GetFieldID returns the customfield ID of a JIRA custom field.

func (Config) GetFieldKey

func (c Config) GetFieldKey(key fieldKey) string

GetFieldKey returns customfield_XXXXX, where XXXXX is the custom field ID (see GetFieldID).

func (Config) GetLogger

func (c Config) GetLogger() logrus.Entry

GetLogger returns the configured application logger.

func (Config) GetProject

func (c Config) GetProject() jira.Project

GetProject returns the JIRA project the user has configured.

func (Config) GetProjectKey

func (c Config) GetProjectKey() string

GetProjectKey returns the JIRA key of the configured project.

func (Config) GetRepo

func (c Config) GetRepo() (string, string)

GetRepo returns the user/org name and the repo name of the configured GitHub repository.

func (Config) GetSinceParam

func (c Config) GetSinceParam() time.Time

GetSinceParam returns the `since` configuration parameter, parsed as a time.Time.

func (Config) GetTimeout

func (c Config) GetTimeout() time.Duration

GetTimeout returns the configured timeout on all API calls, parsed as a time.Duration.

func (Config) IsBasicAuth

func (c Config) IsBasicAuth() bool

IsBasicAuth is true if we're using HTTP Basic Authentication, and false if we're using OAuth.

func (Config) IsDaemon

func (c Config) IsDaemon() bool

IsDaemon returns whether the application is running as a daemon

func (Config) IsDryRun

func (c Config) IsDryRun() bool

IsDryRun returns whether the application is running in dry-run mode or not.

func (*Config) LoadJIRAConfig

func (c *Config) LoadJIRAConfig(client jira.Client) error

LoadJIRAConfig loads the JIRA configuration (project key, custom field IDs) from a remote JIRA server.

func (*Config) SaveConfig

func (c *Config) SaveConfig() error

SaveConfig updates the `since` parameter to now, then saves the configuration file.

func (Config) SetJIRAToken

func (c Config) SetJIRAToken(token *oauth1.Token)

SetJIRAToken adds the JIRA OAuth tokens in the Viper configuration, ensuring that they are saved for future runs.

Jump to

Keyboard shortcuts

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