config

package
v0.0.0-...-4030d2b Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package config provides access to the comply.yml file.

Index

Constants

View Source
const (
	Jira      = "jira"
	GitHub    = "github"
	GitLab    = "gitlab"
	NoTickets = "none"
)
View Source
const (
	// UseDocker invokes pandoc within Docker
	UseDocker = "docker"
	// UsePandoc invokes pandoc directly
	UsePandoc = "pandoc"
)

Variables

View Source
var Config = func() *Project {
	p := Project{}
	cfgBytes, err := ioutil.ReadFile(filepath.Join(ProjectRoot(), "comply.yml"))
	if err != nil {
		panic("unable to load config.yml: " + err.Error())
	}
	yaml.Unmarshal(cfgBytes, &p)
	return &p
}

Config is the parsed contents of ProjectRoot()/config.yml.

Functions

func Exists

func Exists() bool

Exists tests for the presence of a comply configuration file.

func ProjectRoot

func ProjectRoot() string

ProjectRoot is the fully-qualified path to the root directory.

func SetPandoc

func SetPandoc(pandoc bool, docker bool)

SetPandoc records pandoc availability during initialization

func SetProjectRoot

func SetProjectRoot(dir string)

SetProjectRoot is used by the test suite.

func WhichPandoc

func WhichPandoc() string

WhichPandoc indicates which pandoc invocation path should be used

func YAML

func YAML() map[interface{}]interface{}

YAML is the parsed contents of ProjectRoot()/config.yml.

Types

type Project

type Project struct {
	Name           string                 `yaml:"name"`
	Pandoc         string                 `yaml:"pandoc,omitempty"`
	FilePrefix     string                 `yaml:"filePrefix"`
	Tickets        map[string]interface{} `yaml:"tickets"`
	ApprovedBranch string                 `yaml:"approvedBranch"`
}

func (*Project) TicketSystem

func (p *Project) TicketSystem() (string, error)

TicketSystem indicates the type of the configured ticket system

Jump to

Keyboard shortcuts

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