cliconfig

package
v1.4.2-0...-b1053a7 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigFileName is the name of config file
	ConfigFileName = "config.json"
)

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

ConfigDir returns the directory the configuration file is stored in

func DecodeAuth

func DecodeAuth(authStr string) (string, string, error)

DecodeAuth decodes a base64 encoded string and returns username and password

func EncodeAuth

func EncodeAuth(authConfig *AuthConfig) string

EncodeAuth creates a base64 encoded string to containing authorization information

func SetConfigDir

func SetConfigDir(dir string)

SetConfigDir sets the directory the configuration file is stored in

Types

type AuthConfig

type AuthConfig struct {
	Username      string `json:"username,omitempty"`
	Password      string `json:"password,omitempty"`
	Auth          string `json:"auth"`
	Email         string `json:"email"`
	ServerAddress string `json:"serveraddress,omitempty"`
}

AuthConfig contains authorization information for connecting to a Registry

type ConfigFile

type ConfigFile struct {
	AuthConfigs map[string]AuthConfig `json:"auths"`
	HTTPHeaders map[string]string     `json:"HttpHeaders,omitempty"`
	PsFormat    string                `json:"psFormat,omitempty"`
	// contains filtered or unexported fields
}

ConfigFile ~/.docker/config.json file info

func LegacyLoadFromReader

func LegacyLoadFromReader(configData io.Reader) (*ConfigFile, error)

LegacyLoadFromReader is a convenience function that creates a ConfigFile object from a non-nested reader

func Load

func Load(configDir string) (*ConfigFile, error)

Load reads the configuration files in the given directory, and sets up the auth config information and return values. FIXME: use the internal golang config parser

func LoadFromReader

func LoadFromReader(configData io.Reader) (*ConfigFile, error)

LoadFromReader is a convenience function that creates a ConfigFile object from a reader

func NewConfigFile

func NewConfigFile(fn string) *ConfigFile

NewConfigFile initilizes an empty configuration file for the given filename 'fn'

func (*ConfigFile) Filename

func (configFile *ConfigFile) Filename() string

Filename returns the name of the configuration file

func (*ConfigFile) LegacyLoadFromReader

func (configFile *ConfigFile) LegacyLoadFromReader(configData io.Reader) error

LegacyLoadFromReader reads the non-nested configuration data given and sets up the auth config information with given directory and populates the receiver object

func (*ConfigFile) LoadFromReader

func (configFile *ConfigFile) LoadFromReader(configData io.Reader) error

LoadFromReader reads the configuration data given and sets up the auth config information with given directory and populates the receiver object

func (*ConfigFile) Save

func (configFile *ConfigFile) Save() error

Save encodes and writes out all the authorization information

func (*ConfigFile) SaveToWriter

func (configFile *ConfigFile) SaveToWriter(writer io.Writer) error

SaveToWriter encodes and writes out all the authorization information to the given writer

Jump to

Keyboard shortcuts

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