config

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

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

	// Custom field names.
	CustomFieldNameGitHubID       = "github-id"
	CustomFieldNameGitHubNumber   = "github-number"
	CustomFieldNameGitHubLabels   = "github-labels"
	CustomFieldNameGitHubStatus   = "github-status"
	CustomFieldNameGitHubReporter = "github-reporter"
	CustomFieldNameGitHubLastSync = "github-last-sync"
)

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 New

func New(ctx context.Context, cmd *cobra.Command) (*Config, error)

New 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) Context

func (c *Config) Context() context.Context

Context returns the context.

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) GetJiraComponents added in v0.0.8

func (c *Config) GetJiraComponents() []*jira.Component

GetJiraComponents returns the Jira component the user has configured.

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 confirmed mode or not.

func (*Config) LoadJiraConfig added in v0.0.7

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 added in v0.0.7

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.

type ReadingJiraComponentError added in v0.0.8

type ReadingJiraComponentError string

func (ReadingJiraComponentError) Error added in v0.0.8

Jump to

Keyboard shortcuts

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