types

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFileName = "config.yaml"
	ConfigDir      = ".config/gws"
)
View Source
const TokenFileName = "token.yaml"

Variables

This section is empty.

Functions

func DefaultConfigDir

func DefaultConfigDir() (newConfigPath, userHomeDir string)

func GetTokenFilePath

func GetTokenFilePath() (string, error)

func LoadToken

func LoadToken() (*oauth2.Token, error)

func ReadGWSFile

func ReadGWSFile(fileName string) (absoluteFile string, data []byte, err error)

func SaveToken

func SaveToken(token oauth2.Token) error

func SetToken

func SetToken(token oauth2.Token) error

Types

type Config

type Config struct {
	Contexts           map[string]*Context  `yaml:"contexts"`
	CurrentContextName string               `yaml:"currentContext"`
	FilePath           string               `yaml:"-"`
	TokenCheck         bool                 `yaml:"-"`
	FilePatches        map[string]FilePatch `yaml:"filePatches,omitempty"`
	SSHTimeoutSeconds  int                  `yaml:"sshTimeoutSeconds,omitempty"`

	Token *TokenStorage `yaml:"-"`
	// contains filtered or unexported fields
}

func (*Config) CurrentContext

func (c *Config) CurrentContext() *Context

func (*Config) Load

func (c *Config) Load(fileName string) error

func (*Config) SSHTimeout

func (c *Config) SSHTimeout() time.Duration

func (*Config) SetToken

func (c *Config) SetToken(token oauth2.Token) error

func (*Config) SwitchContext

func (c *Config) SwitchContext(newContext string, force bool) error

type Context

type Context struct {
	Host           string `yaml:"host"`
	Port           int    `yaml:"port"`
	User           string `yaml:"user"`
	PrivateKeyFile string `yaml:"privateKeyFile"`
	KnownHostsFile string `yaml:"knownHostsFile"`

	GCloud *GCloud `yaml:"gcloud"`

	Dirs  []Dir  `yaml:"dirs,omitempty"`
	Files []File `yaml:"files,omitempty"`
}

func (Context) HostAddr

func (c Context) HostAddr() string

type Dir

type Dir struct {
	Path        string `yaml:"path"`
	Permissions string `yaml:"permissions,omitempty"`
}

type File

type File struct {
	SourcePath  string `yaml:"sourcePath"`
	Path        string `yaml:"path"`
	Permissions string `yaml:"permissions"`
}

type FilePatch

type FilePatch struct {
	File     string `yaml:"file"`
	Indent   string `yaml:"indent,omitempty"`
	OldBlock string `yaml:"oldBlock,omitempty"`
	NewBlock string `yaml:"newBlock,omitempty"`
}

type GCloud

type GCloud struct {
	Project string `yaml:"project"`
	Region  string `yaml:"region"`
	Cluster string `yaml:"cluster"`
	Config  string `yaml:"config"`
	Name    string `yaml:"name"`
}

type TokenStorage

type TokenStorage struct {
	Token oauth2.Token `yaml:"token"`
}

Jump to

Keyboard shortcuts

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