config

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// YamlFilename is where dirprefs are stored
	YamlFilename = ".manifold.yml"
)

Variables

View Source
var ErrExpectedFile = errors.New("Expected ~/.manifoldrc to be a file; found a directory")

ErrExpectedFile represents an error where the manifoldrc file was a directory instead of a file.

View Source
var ErrMissingHomeDir = errors.New("Could not find Home Directory")

ErrMissingHomeDir represents an error when a home directory could not be found

View Source
var ErrPluginNotFound = errors.New("Plugin not found")

ErrPluginNotFound is returned if a particular plugin doesn't exist in the yaml when requested

View Source
var ErrWrongConfigPermissions = errors.New(
	"~/.manifoldrc must be only readable and writable to the current user (0600)")

ErrWrongConfigPermissions represents an error when the config permissions are incorrect.

View Source
var GitHubCallback = "https://dashboard.manifold.co/login/oauth/github"
View Source
var GitHubClientID = "40ff4213256c4b253c7f"

GitHubClientID facilitates logins with GitHub

View Source
var StripePublishableKey = "pk_live_A6qSWh1v4SrNnrWSftgDcKFQ"

StripePublishableKey facilitates secure transmission of payment values

View Source
var Version = "dev"

Version represents the version of the cli. This variable is updated at build time.

Functions

func RCPath

func RCPath() (string, error)

RCPath returns the absolute path to the ~/.manifoldrc file

func UserHome added in v0.10.1

func UserHome() (string, error)

Types

type Config

type Config struct {
	Hostname        string `ini:"hostname"`
	AuthToken       string `ini:"auth_token"`
	TransportScheme string `ini:"scheme"`
	Analytics       bool   `ini:"analytics"`
	LegacyTeam      string `ini:"team,omitempty"`
	TeamTitle       string `ini:"team_title,omitempty"`
	TeamName        string `ini:"team_name,omitempty"`
	TeamID          string `ini:"team_id,omitempty"`
	GitHubCallback  string `ini:"github_callback,omitempty"`
}

Config represents the configuration which is stored inside a ~/.manifoldrc file in ini format.

func Load

func Load() (*Config, error)

Load checks if ~/.manifoldrc exists, if it does, it reads it from disk.

If it doesn't an empty config with the default values is returned.

If the file cannot be read, or it has the incorrect permissions an error is returned.

func LoadIgnoreLegacy added in v0.8.1

func LoadIgnoreLegacy() (*Config, error)

LoadIgnoreLegacy checks if ~/.manifoldrc exists, if it does, it reads it from disk. This func ignores the legacy check.

If it doesn't an empty config with the default values is returned.

If the file cannot be read, or it has the incorrect permissions an error is returned.

func (*Config) IdentifyLegacyValues added in v0.8.1

func (c *Config) IdentifyLegacyValues() error

IdentifyLegacyValues identifies if a user's config file is out of date aiding migration, or suggesting a fix

func (*Config) Write

func (c *Config) Write() error

Write writes the contents of the Config struct to ~/.manifoldrc and sets the appropriate permissions.

type ManifoldYaml

type ManifoldYaml struct {
	Project string                 `yaml:"project,omitempty" flag:"project,omitempty"`
	Team    string                 `yaml:"team,omitempty" flag:"team,omitempty"`
	Plugins map[string]interface{} `yaml:"plugins,omitempty"`
	Path    string                 `yaml:"-" json:"-"`
}

ManifoldYaml represents the standard project config object

func LoadYaml

func LoadYaml(recurse bool) (*ManifoldYaml, error)

LoadYaml loads ManifoldYaml. It starts in the current working directory, looking for a readable '.manifold.yml' file, and walks up the directory hierarchy until it finds one, or reaches the root of the fs.

It returns an empty ManifoldYaml is no '.manifold.yml' files are found. It returns an error if a malformed file is found, or if any errors occur during file system access.

func (ManifoldYaml) GetPlugin

func (m ManifoldYaml) GetPlugin(name string, conf interface{}) error

GetPlugin retrieves plugins config for the given plugin name

func (*ManifoldYaml) Remove

func (m *ManifoldYaml) Remove() error

Remove removes the backing file for this ManifoldYaml

func (*ManifoldYaml) Save

func (m *ManifoldYaml) Save() error

Save writes the ManifoldYaml values to the file in the struct's Path field

func (*ManifoldYaml) SavePlugin

func (m *ManifoldYaml) SavePlugin(name string, conf interface{}) error

SavePlugin writes the ManifoldYaml values for a specific plugin name

Jump to

Keyboard shortcuts

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