update

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package update implements a new command to replace the current PocketBase executable with the one from the latest BugStage releases.

Note that it expects the fetched release to have file(s) in the following formats:

  • "*_linux_amd64.zip"
  • "*_linux_arm64.zip"
  • "*_linux_armv7.zip"
  • "*_darwin_amd64.zip"
  • "*_darwin_arm64.zip"
  • "*_windows_amd64.zip"
  • "*_windows_arm64.zip"

The appropriate file is auto downloaded based on the user platform. If there is no file matching the user platform then an error is returned.

Example plugin registration:

update.MustRegister(app, app.RootCmd, update.Config{
	BaseURL:    "https://ganigeorgiev.com",
	Project:    "pocketbase",
	Repository: "pocketbase",
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustRegister

func MustRegister(app core.App, rootCmd *cobra.Command, config Config)

MustRegister registers the update plugin to the provided app instance and panic if it fails.

func Register

func Register(app core.App, rootCmd *cobra.Command, config Config) error

Register registers the update plugin to the provided app instance.

Types

type Config

type Config struct {
	// BaseURL is the base URL of the BugStage host (or similar compatible)
	// used to fetch the latest releases information.
	//
	// This field is required!
	BaseURL string

	// Project specifies the project name of the repository.
	//
	// This field is required!
	Project string

	// Repository specifies the name of the repository.
	//
	// This field is required!
	Repository string

	// Channel specifies the name of the release channel to check.
	//
	// If not set uses the system "default" channel.
	Channel string

	// ArchiveExecutable specifies the name of the executable file in the release archive
	// (default to the same value as in [Config.Repository]; an additional ".exe" check is also performed as a fallback).
	ArchiveExecutable string

	// Optional context to use when fetching and downloading the latest release.
	Context context.Context

	// The HTTP client to use when fetching and downloading the latest release.
	// Defaults to [http.DefaultClient].
	HttpClient HttpClient
}

Config defines the config options of the update plugin.

type HttpClient

type HttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HttpClient is a base HTTP client interface (usually used for test purposes).

Jump to

Keyboard shortcuts

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