store

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDirName = ".cas"

DefaultDirName is the name of the store working directory.

View Source
const DirPerm os.FileMode = 0700

DirPerm holds permission bits that are used for all directories that store creates.

View Source
const FilePerm os.FileMode = 0600

FilePerm holds permission bits that are used for all files that store creates.

Variables

This section is empty.

Functions

func ConfigFile

func ConfigFile() string

ConfigFile returns the config file path

func ConfigLockFile added in v1.0.3

func ConfigLockFile() string

ConfigLockFile returns the config lock file path (e.g. ~/.cas/config.lock)

func CurrentConfigFilePath

func CurrentConfigFilePath() string

CurrentConfigFilePath returns the current config file path

func LoadConfig

func LoadConfig() error

LoadConfig loads the global configuration from file

func ManifestFilepath

func ManifestFilepath(kind string, target string) (string, error)

func ReadManifest

func ReadManifest(kind string, target string) (*bundle.Manifest, error)

func SaveConfig

func SaveConfig() error

SaveConfig stores the current configuration to file

func SaveManifest

func SaveManifest(kind string, target string, manifest bundle.Manifest) error

func SetConfigFile

func SetConfigFile(filepath string)

SetConfigFile sets the config file path

func SetDefaultDir

func SetDefaultDir() error

SetDefaultDir sets the default store working directory

func SetDir

func SetDir(p string)

SetDir sets the store working directory

func SetVersionCheckTime

func SetVersionCheckTime()

SetVersionCheckTime set the latest version check to now.

func VersionCheckTime

func VersionCheckTime() *time.Time

VersionCheckTime returns the time of latest version check, if any.

Types

type ConfigRoot

type ConfigRoot struct {
	SchemaVersion  uint           `json:"schemaVersion"`
	Users          []*User        `json:"users"`
	CurrentContext CurrentContext `json:"currentContext"`
}

ConfigRoot holds root fields of the configuration file.

func Config

func Config() *ConfigRoot

Config returns the global config instance

func (*ConfigRoot) ClearContext

func (c *ConfigRoot) ClearContext()

ClearContext clean up all auth token for all users and set an empty context.

func (*ConfigRoot) NewLcUser

func (c *ConfigRoot) NewLcUser(host, port, lcCert string, lcSkipTlsVerify, lcNoTls bool) (u *CurrentContext)

User returns an User from the global config matching the given email. User returns nil when an empty email is given or c is nil.

type ConfigRootV2

type ConfigRootV2 struct {
	SchemaVersion  uint      `json:"schemaVersion"`
	Users          []*UserV2 `json:"users"`
	CurrentContext string    `json:"currentContext"`
}

ConfigRoot holds root fields of the configuration file.

type CurrentContext

type CurrentContext struct {
	LcHost          string `json:"LcHost,omitempty"`
	LcPort          string `json:"LcPort,omitempty"`
	LcCert          string `json:"LcCert,omitempty"`
	LcSkipTlsVerify bool   `json:"LcSkipTlsVerify,omitempty"`
	LcNoTls         bool   `json:"LcNoTls,omitempty"`
}

func (*CurrentContext) Clear

func (cc *CurrentContext) Clear()

type User

type User struct {
	Token    string `json:"token,omitempty"`
	KeyStore string `json:"keystore,omitempty"`
	LcCert   string `json:"lcCert,omitempty"`
}

User holds user's configuration.

type UserV2

type UserV2 struct {
	Email    string `json:"email"`
	Token    string `json:"token,omitempty"`
	KeyStore string `json:"keystore,omitempty"`
}

User holds user's configuration.

Jump to

Keyboard shortcuts

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