Documentation
¶
Overview ¶
This package defines the configuration file associated with LiveKit templates, which include instructions for package setup and development in both Playground mode and local dev.
Index ¶
- Constants
- func CleanupTemplate(dir string) error
- func CloneTemplate(url, dir string) (string, string, error)
- func CommandExists(cmd string) bool
- func CommandIsAlias(cmd string) bool
- func CreateSandbox(ctx context.Context, agentName, templateURL, token, serverURL string) (string, error)
- func InstantiateDotEnv(ctx context.Context, rootDir string, exampleFilePath string, ...) (map[string]string, error)
- func NewTask(ctx context.Context, tf *ast.Taskfile, dir, taskName string, verbose bool) (func() error, error)
- func NewTaskExecutor(dir string, verbose bool) *task.Executor
- func NewTaskWithExecutor(ctx context.Context, exe *task.Executor, taskName string, verbose bool) (func() error, error)
- func ParseTaskfile(rootPath string) (*ast.Taskfile, error)
- func PrintDotEnv(envMap map[string]string) error
- func ReadDotEnv(rootDir string, filePath string) (map[string]string, error)
- func WriteDotEnv(rootDir string, filePath string, envMap map[string]string, overwrite bool) error
- type KnownTask
- type PromptFunc
- type SandboxDetails
- type Template
- type WebPackageManager
Constants ¶
const ( TaskFile = "taskfile.yaml" TemplateIndexFile = "templates.yaml" TemplateIndexURL = "https://raw.githubusercontent.com/livekit-examples/index/main" TemplateBaseURL = "https://github.com/livekit-examples" SandboxDashboardURL = "https://cloud.livekit.io/projects/p_/sandbox" SandboxTemplateEndpoint = "/api/sandbox/template" SandboxCreateEndpoint = "/api/sandbox/create" )
Variables ¶
This section is empty.
Functions ¶
func CleanupTemplate ¶
func CommandExists ¶
Determine if `cmd` is a binary in PATH or a known alias
func CreateSandbox ¶ added in v2.6.1
func InstantiateDotEnv ¶
func InstantiateDotEnv(ctx context.Context, rootDir string, exampleFilePath string, substitutions map[string]string, verbose bool, prompt PromptFunc) (map[string]string, error)
Read .env.example file if present in rootDir, replacing all `substitutions`, prompting for others, and returning the result as a map.
func NewTaskWithExecutor ¶ added in v2.5.0
func PrintDotEnv ¶
func ReadDotEnv ¶ added in v2.16.4
ReadDotEnv reads filePath under rootDir as a dotenv file. Returns (nil, nil) if the file does not exist.
func WriteDotEnv ¶
WriteDotEnv writes envMap to filePath under rootDir. When overwrite is false and the file already exists, envMap is merged into the file in place: keys in envMap are updated (preserving any inline comments and the surrounding whitespace on those lines), keys not in envMap are preserved verbatim along with comments and blank lines, and any envMap keys not yet in the file are appended. When overwrite is true (or the file does not exist), the file is written fresh.
Types ¶
type SandboxDetails ¶
type SandboxDetails struct {
Name string `json:"name"`
Template Template `json:"template"`
ChildTemplates []Template `json:"childTemplates"`
}
func FetchSandboxDetails ¶
func FetchSandboxDetails(ctx context.Context, sid, token, serverURL string) (*SandboxDetails, error)
type Template ¶
type Template struct {
Name string `yaml:"name" json:"name"`
Desc string `yaml:"desc" json:"description,omitempty"`
URL string `yaml:"url" json:"url,omitempty"`
Docs string `yaml:"docs" json:"docs_url,omitempty"`
Image string `yaml:"image" json:"image_ref,omitempty"`
Tags []string `yaml:"tags" json:"tags,omitempty"`
Attrs map[string]string `yaml:"attrs" json:"attrs,omitempty"`
Requires []string `yaml:"requires" json:"requires,omitempty"`
IsSandbox bool `yaml:"is_sandbox" json:"is_sandbox,omitempty"`
IsHidden bool `yaml:"is_hidden" json:"is_hidden,omitempty"`
}
type WebPackageManager ¶
type WebPackageManager string
const ( NPM WebPackageManager = "npm" PNPM WebPackageManager = "pnpm" Yarn WebPackageManager = "yarn" )
func AutodetectWebPackageManagers ¶
func AutodetectWebPackageManagers() ([]WebPackageManager, error)