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 ¶
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"` 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"` Session string `json:"session,omitempty"` WorkspaceUUID uuid.UUID `json:"workspace_id"` WorkspaceName string `json:"workspace_name"` BaseURL string `json:"api_url"` Active bool `json:"active"` JWToken string `json:"jwt,omitempty"` Expires int `json:"expires,omitempty"` SkipVersionCheck bool `json:"skip_version_check"` }
ConchProfile is an individual environment, consisting of login data, API settings, and an optional default workspace