config

package
v0.1.40 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalConfigDirName  = ".unweave_global"
	ProjectConfigDirName = ".unweave"
	UnweaveSSHKeysDir    = ".unweave_global/.ssh"
)
View Source
const DefaultVolumeSize = 4
View Source
const UnweaveHostDir = "/home/unweave"

UnweaveHostDir is the filesystem location where your code gets stored on the host. Adjust this as you need.

Variables

View Source
var (
	// Version is added at build time
	Version = "dev"

	Config = &config{
		Unweave: &unweave{
			ApiURL: "https://api.unweave.io",
			AppURL: "https://app.unweave.io",
			User:   &user{},
		},
		Project: &Project{
			Env:       &Secrets{},
			Providers: map[string]provider{},
		},
	}
)
View Source
var All = false

All can be used across multiple commands. Example: unweave ls --all to list all projects

View Source
var AuthToken = ""

AuthToken is used to authenticate with the Unweave API. It is loaded from the saved config file and can be overridden with runtime flags.

View Source
var BuildID = ""

BuildID is the ID of the build to use when running commands that require a build.

View Source
var CPUs int

CPUs is the number of VCPUs to allocate.

View Source
var Command string

Command is the user supplied command that should be run in the exec.

View Source
var CreateExec = true

CreateExec is used to denote whether to create a new exec when running commands that require a exec.

View Source
var DefaultNodeTypes = []string{}
View Source
var EndpointName string

EndpointName is the name of the endpoint we operate on when calling deploy or create if it doesn't exist.

View Source
var ExecAttach = false

ExecAttach is used to determine if the exec command should stay attached to the exec after starting the command.

View Source
var FollowLogs = false

FollowLogs denotes if the logs command should stay attached and print logs as they come in. Default false, which means print only the logs received so far.

View Source
var GPUMemory int

GPUMemory is the memory of GPU if applicable for a gpuType.

View Source
var GPUType string

GPUType is the type of GPU to use.

View Source
var GPUs int

GPUs is the number of GPUs to allocate for a gpuType.

View Source
var HDD int

HDD is the amount of storage to allocate in GB.

View Source
var InternalPort int32

InternalPort is the port that should be exposed as https

View Source
var Memory int

Memory is the amount of RAM to allocate in GB.

View Source
var NoCopySource = true

NoCopySource is a bool to denote whether to copy the source code to the session

View Source
var NodeRegion = ""

NodeRegion is the region to use when creating a new session

View Source
var ProjectURI = ""

ProjectURI is the project slug with syntax `<owner>/<project` of the project to run commands on. It is loaded from the saved config file and can be overridden with runtime flags.

View Source
var Provider = ""

Provider is the provider to use when executing a request

View Source
var SSHConnectionOptions []string

SSHConnectionOptions is the arguments you want to include when opening an SSH session.

View Source
var SSHKeyName = ""

SSHKeyName is the name of the SSH Key already configured in Unweave to use for a new or existing Exec.

View Source
var SSHPrivateKeyPath = ""

SSHPrivateKeyPath is the path to the SSH public key to use to connect to a new or existing Exec.

View Source
var SSHPublicKeyPath = ""

SSHPublicKeyPath is the path to the SSH public key to use to connect to a new or existing Exec.

View Source
var SpecName string

SpecName is the name of the spec from config to use.

View Source
var Volumes []string

Volumes is a list of volumes to mount to the session

Functions

func GetActiveProjectPath added in v0.1.8

func GetActiveProjectPath() (string, error)

GetActiveProjectPath returns the active project directory by recursively going up the directory tree until it finds a directory that's contains the .unweave/config.toml file

func GetGlobalConfigPath added in v0.1.24

func GetGlobalConfigPath() string

func GetProjectOwnerAndName added in v0.1.9

func GetProjectOwnerAndName() (owner string, name string)

func GetUnweaveSSHKeysFolder added in v0.1.28

func GetUnweaveSSHKeysFolder() string

func GetVolumeAttachParams added in v0.1.36

func GetVolumeAttachParams() ([]types.VolumeAttachParams, error)

GetVolumeAttachParams reads the existing config and

func Init added in v0.0.5

func Init()

func InitProjectConfigFrom added in v0.1.40

func InitProjectConfigFrom(projectConfigPath, envConfigPath string) (*Secrets, *Project)

func InitUnweaveClient added in v0.1.28

func InitUnweaveClient() *client.Client

func IsProjectLinked added in v0.0.5

func IsProjectLinked() bool

func ProjectHostDir added in v0.1.34

func ProjectHostDir() string

ProjectHostDir is the location where project files get copied to

func WriteEnvConfig added in v0.0.5

func WriteEnvConfig() error

func WriteGitignore added in v0.0.5

func WriteGitignore() error

func WriteProjectConfig added in v0.0.5

func WriteProjectConfig(projectURI string, providers []string) error

Types

type Project added in v0.1.40

type Project struct {
	URI             string              `toml:"project_uri"`
	Env             *Secrets            `toml:"env"`
	Providers       map[string]provider `toml:"provider"`
	Specs           []Spec              `toml:"specs"`
	DefaultProvider string              `toml:"default_provider"`
}

func (*Project) Save added in v0.1.40

func (c *Project) Save() error

func (*Project) String added in v0.1.40

func (c *Project) String() string

type Secrets added in v0.1.40

type Secrets struct {
	ProjectToken string `env:"UNWEAVE_PROJECT_TOKEN"`
	SSHKeyPath   string `env:"UNWEAVE_SSH_KEY_PATH"`
	SSHKeyName   string `env:"UNWEAVE_SSH_KEY_NAME"`
}

type Spec added in v0.1.40

type Spec struct {
	Name string        `toml:"name"`
	CPU  specResources `toml:"cpu"`
	GPU  specResources `toml:"gpu"`
	HDD  specHDD       `toml:"hdd"`
}

Jump to

Keyboard shortcuts

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