config

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package config defines the structure of the configuration for the `dev` tool. I expect it to be YAML, but am providing support for JSON via the struct tags to keep the options open.

There's a global configuration instance which should be populated by the controller and consumed from all other parts of the view or controller layers.

Index

Constants

This section is empty.

Variables

View Source
var Global = &Config{
	Dev:          Dev{},
	Includes:     Includes{},
	Links:        Links{},
	Networks:     Networks{},
	Platforms:    Platforms{},
	Softwares:    Softwares{},
	Repositories: Repositories{},
}

Global contains the global configuration usable by all CLI commands, all root properties are guaranteed to exist

View Source
var Loaded = map[string]Config{}

Loaded contains a dictionary of configurations where the key equals the file's absolute path and the value containing the loaded configuration

Functions

This section is empty.

Types

type Config added in v0.0.7

type Config struct {
	Dev          Dev          `json:"dev" yaml:"dev"`
	Includes     Includes     `json:"includes" yaml:"includes"`
	Links        Links        `json:"links" yaml:"links"`
	Networks     Networks     `json:"networks" yaml:"networks"`
	Platforms    Platforms    `json:"platforms" yaml:"platforms"`
	Softwares    Softwares    `json:"softwares" yaml:"softwares"`
	Repositories Repositories `json:"repositories" yaml:"repositories"`
}

func NewFromFile

func NewFromFile(filePath string) (*Config, error)

NewFromFile is a convenience function that reads the configuration in from a file at the provided :filePath

func (*Config) MergeWith added in v0.0.7

func (f *Config) MergeWith(other *Config)

MergeWith merges the current Config configuration instance with a second provided :other Config configuration instance, intention for this is to merge a local configuration with a global configuration

type Dev

type Dev struct {
	Client   DevClient   `json:"client" yaml:"client"`
	Defaults DevDefaults `json:"defaults" yaml:"defaults"`
}

Dev specifies the configurations available for the CLI tool itself

type DevClient

type DevClient struct {
	Database      DevClientDatabase      `json:"database" yaml:"database"`
	Notifications DevClientNotifications `json:"notifications" yaml:"notifications"`
}

DevClient holds configurations related to the CLI tool

type DevClientDatabase

type DevClientDatabase struct {
	Path string `json:"path" yaml:"path"`
}

DevClientDatabase holds configurations related to the data persistence mechanism of the CLI tool

type DevClientNotifications

type DevClientNotifications struct {
	Telegram DevClientNotificationsTelegram `json:"telegram" yaml:"telegram"`
}

DevClientNotifications holds configurations related to the notifications mechanisms of the CLI tool

type DevClientNotificationsTelegram

type DevClientNotificationsTelegram struct {
	Token string `json:"token" yaml:"token"`
	ID    string `json:"id" yaml:"id"`
}

DevClientNotificationsTelegram holds configurations related to the telegram integration for sending notifications

type DevDefaults

type DevDefaults struct {
	// Account defines the default platform to use for account
	Account string `json:"account" yaml:"account"`
	// Notifications defines the default platform to use for notifications
	Notifications string `json:"notifications" yaml:"notifications"`
	// Work defines the default platform to use for work
	Work string `json:"work" yaml:"work"`
}

DevDefaults specifies default selections when running `dev <verb> <noum> <this>` commands

type IncludePath added in v0.0.7

type IncludePath string

IncludePath represents a file path to a configuration file

func (IncludePath) GetConfig added in v0.0.7

func (i IncludePath) GetConfig() (*Config, error)

GetConfig returns the configuration read from the path specified by this instance of IncludePath

type Includes added in v0.0.7

type Includes []IncludePath

Includes is a list of paths to include

type Links []link.Link

Links represents a list of links which the uesr should be able to access

func (*Links) MergeWith added in v0.0.7

func (l *Links) MergeWith(o Links)

MergeWith merges the current Links instance with a provided Links instance. The merge strategy is add-only

type Networks

type Networks []network.Network

Networks represents a list of networks that the user's machine should be able to connect to

func (*Networks) MergeWith added in v0.0.7

func (n *Networks) MergeWith(o Networks)

MergeWith merges the current Networks instance with a provided Networks instance. The merge strategy is add-only

type Platforms

type Platforms struct {
	PivotalTracker pivotaltracker.Config `json:"pivotaltracker" yaml:"pivotaltracker"`
	Github         github.Config         `json:"github" yaml:"github"`
	Gitlab         gitlab.Config         `json:"gitlab" yaml:"gitlab"`
	Trello         trello.Config         `json:"trello" yaml:"trello"`
}

Platforms specifies the configurations available

func (Platforms) GetSanitized

func (p Platforms) GetSanitized() Platforms

GetSanitized returns a sanitised deep copy of the current Platforms instance

type Repositories

type Repositories []repository.Repository

Repositories represents a list of repositories a user should have access to on their machines

func (*Repositories) MergeWith added in v0.0.8

func (r *Repositories) MergeWith(o Repositories)

MergeWith merges the current Repositories instance with a provided Repositories instance. The merge strategy is add-only

type Softwares

type Softwares []software.Software

Softwares represents a list of software the user should have on their machine

func (*Softwares) MergeWith added in v0.0.8

func (s *Softwares) MergeWith(o Softwares)

MergeWith merges the current Softwares instance with a provided Softwares instance. The merge strategy is add-only

Jump to

Keyboard shortcuts

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