config

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2019 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package config wraps a conch shell config. Typically this is either coming from and/or becoming JSON on disk.

Index

Constants

This section is empty.

Variables

View Source
var ErrConfigNoPath = errors.New("no path found in config data")

ErrConfigNoPath is issued when a file operation is attempted on a ConchConfig that lacks a path

Functions

This section is empty.

Types

type ConchConfig

type ConchConfig struct {
	Path             string                   `json:"path"`
	SkipVersionCheck bool                     `json:"skip_version_check"`
	Profiles         map[string]*ConchProfile `json:"profiles"`
}

ConchConfig represents the configuration information for the shell, mostly just a profile list

func New

func New() (c *ConchConfig)

New provides an initialized struct with default values geared towards a dev environment. For instance, the default Api value is "http://localhost:5001".

func NewFromJSON

func NewFromJSON(j string) (c *ConchConfig, err error)

NewFromJSON unmarshals a JSON blob into a ConchConfig struct

func NewFromJSONFile

func NewFromJSONFile(path string) (c *ConchConfig, err error)

NewFromJSONFile reads a file off disk and unmarshals it into ConchConfig struct.

func (*ConchConfig) Serialize

func (c *ConchConfig) Serialize() (s string, err error)

Serialize marshals a ConchConfig struct into a JSON string

func (*ConchConfig) SerializeToFile

func (c *ConchConfig) SerializeToFile(path string) (err error)

SerializeToFile marshals a ConchConfig struct into a JSON string and writes it out to the provided path

type ConchProfile

type ConchProfile struct {
	Name          string         `json:"name"`
	User          string         `json:"user"`
	WorkspaceUUID uuid.UUID      `json:"workspace_id"`
	WorkspaceName string         `json:"workspace_name"`
	BaseURL       string         `json:"api_url"`
	Active        bool           `json:"active"`
	JWT           conch.ConchJWT `json:"jwt"`
	Expires       time.Time      `json:"expires,omitempty"`
}

ConchProfile is an individual environment, consisting of login data, API settings, and an optional default workspace

Notes

Bugs

  • This transition code is a mess but necessary for compatbility. Need to give it a release or two in production before removing this grossness.

  • entirely for config backcompat

  • entirely for config backcompat

Jump to

Keyboard shortcuts

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