func (c *Config) ConfigureSession(sn *session.Session, tkn *token.Token) {
	c.Session = sn
	c.Token = tkn.Jwt
}
ConfigureSession extracts the elements from the IssueResponse.
package config
import (
	"encoding/json"
	"errors"
	"io"
	"net/url"
	"os"
	"path/filepath"
	"strings"
	"syscall"
	"github.com/bobvawter/cacheroach/api/session"
	"github.com/bobvawter/cacheroach/api/tenant"
	"github.com/bobvawter/cacheroach/api/token"
	"golang.org/x/term"
	"google.golang.org/protobuf/proto"
)
type Config struct {
	DefaultTenant *tenant.ID
	Host          string
	Insecure      bool
	Session       *session.Session
	Token         string
}
func (c *Config) Clone() *Config {
	ret := &Config{
		Host:     c.Host,
		Insecure: c.Insecure,
		Token:    c.Token,
	}
	if c.DefaultTenant != nil {
		ret.DefaultTenant = proto.Clone(c.DefaultTenant).(*tenant.ID)
	}
	if c.Session != nil {
		ret.Session = proto.Clone(c.Session).(*session.Session)
	}
	return ret
}
func (c *Config) ConfigureHostname(urlString string, requirePassword bool) (*url.URL, error) {
	u, err := url.Parse(urlString)
	if err != nil {
		return nil, err
	}
	if u.User.Username() == "" {
		return nil, errors.New("must specify a username")
	}
	if requirePassword {
		password, _ := u.User.Password()
		if password == "" {
			print("Enter password: ")
			data, err := term.ReadPassword(syscall.Stdin)
			if err != nil {
				return nil, err
			}
			password = string(data)
			println()
			u.User = url.UserPassword(u.User.Username(), password)
		}
		if password == "" {
			return nil, errors.New("a password is required")
		}
	}
	c.Host = u.Host
	c.Token = ""
	switch strings.ToLower(u.Scheme) {
	case "http":
		c.Insecure = true
		if u.Port() == "" {
			c.Host += ":80"
		}
	case "https":
		c.Insecure = false
		if u.Port() == "" {
			c.Host += ":443"
		}
	}
	return u, nil
}