config

package
v1.12.5 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2019 License: MPL-2.0 Imports: 10 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

View Source
const (
	ProductionURL = "https://conch.joyent.us"
	StagingURL    = "https://staging.conch.joyent.us"
)

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

View Source
var (
	// For the love of Eris, override this default via the Makefile
	ObfuscationKey = "shies9rohz1beigheyoish1viovohWachohw7aithee9apheez"
)

Functions

This section is empty.

Types

type ConchConfig

type ConchConfig struct {
	Path     string                   `json:"path"`
	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"`               // TODO(sungo): DEPRECATED
	Expires       time.Time      `json:"expires,omitempty"` // TODO(sungo): DEPRECATED
	Token         Token          `json:"token"`
}

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

type Token added in v1.12.0

type Token string

We're going to obfuscate the token itself. I'm aware this is krypto and not even remotely secure. But it will prevent the tokens from being just c&p'd out of the configs on a remote box.

func (Token) MarshalJSON added in v1.12.0

func (t Token) MarshalJSON() ([]byte, error)

func (Token) String added in v1.12.0

func (t Token) String() string

func (*Token) UnmarshalJSON added in v1.12.0

func (t *Token) UnmarshalJSON(b []byte) error

Notes

Bugs

  • entirely for config backcompat

  • entirely for config backcompat

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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