config

package
v0.0.0-...-675a61e Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config manages global CLI configuration.

Index

Constants

View Source
const Filename = "config.toml"

Filename is the name of the application configuration file.

Variables

View Source
var Path = func() string {
	if dir, err := os.UserConfigDir(); err == nil {
		return filepath.Join(dir, "fastly", Filename)
	}
	if dir, err := os.UserHomeDir(); err == nil {
		return filepath.Join(dir, ".fastly", Filename)
	}
	panic("unable to deduce user config dir or user home dir")
}()

Path is the location of the application configuration file.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	Version string `toml:"version"`
}

CLI represents CLI specific configuration.

type Data

type Data struct {
	// ConfigVersion is the version of the configuration schema.
	ConfigVersion int `toml:"config_version"`
	// Fastly represents fastly specific configuration.
	Fastly Fastly `toml:"fastly"`
	// Language represents C@E language specific configuration.
	Language Language `toml:"language"`
	// Profiles represents multiple profile accounts.
	Profiles Profiles `toml:"profile"`
	// StarterKits represents language specific starter kits.
	StarterKits StarterKitLanguages `toml:"starter-kits"`
	// Viceroy represents viceroy specific configuration.
	Viceroy Viceroy `toml:"viceroy"`
}

Data represents our application toml configuration.

func (*Data) Read

func (c *Data) Read(path string) error

Read opens the file path and stores the content.

type Fastly

type Fastly struct {
	APIEndpoint string `toml:"api_endpoint"`
}

Fastly represents fastly specific configuration.

type Go

type Go struct {
	// TinyGoConstraint is the `tinygo` version that we support.
	TinyGoConstraint string `toml:"tinygo_constraint"`

	// ToolchainConstraint is the `go` version that we support.
	//
	// We aim for go versions that support go modules by default.
	// https://go.dev/blog/using-go-modules
	ToolchainConstraint string `toml:"toolchain_constraint"`
}

Go represents Go C@E language specific configuration.

type Language

type Language struct {
	Go   Go   `toml:"go"`
	Rust Rust `toml:"rust"`
}

Language represents C@E language specific configuration.

type Profile

type Profile struct {
	Default bool   `toml:"default" json:"default"`
	Email   string `toml:"email" json:"email"`
	Token   string `toml:"token" json:"token"`
}

Profile represents a specific profile account.

type Profiles

type Profiles map[string]*Profile

Profiles represents multiple profile accounts.

type Rust

type Rust struct {
	// ToolchainConstraint is the `rustup` toolchain constraint for the compiler
	// that we support (a range is expected, e.g. >= 1.49.0 < 2.0.0).
	ToolchainConstraint string `toml:"toolchain_constraint"`

	// WasmWasiTarget is the Rust compilation target for Wasi capable Wasm.
	WasmWasiTarget string `toml:"wasm_wasi_target"`
}

Rust represents Rust C@E language specific configuration.

type StarterKit

type StarterKit struct {
	Name        string `toml:"name"`
	Description string `toml:"description"`
	Path        string `toml:"path"`
	Tag         string `toml:"tag"`
	Branch      string `toml:"branch"`
}

StarterKit represents starter kit specific configuration.

type StarterKitLanguages

type StarterKitLanguages struct {
	AssemblyScript []StarterKit `toml:"assemblyscript"`
	Go             []StarterKit `toml:"go"`
	JavaScript     []StarterKit `toml:"javascript"`
	Rust           []StarterKit `toml:"rust"`
}

StarterKitLanguages represents language specific starter kits.

type Viceroy

type Viceroy struct {
	// LastChecked is when the version of Viceroy was last checked.
	LastChecked string `toml:"last_checked"`
	// LatestVersion is the latest Viceroy version at the time it is set.
	LatestVersion string `toml:"latest_version"`
	// TTL is how long the CLI waits before considering the version stale.
	TTL string `toml:"ttl"`
}

Viceroy represents viceroy specific configuration.

Jump to

Keyboard shortcuts

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