canasta

package
v1.207.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultImageRegistry is the container registry for Canasta images
	DefaultImageRegistry = "ghcr.io/canastawiki"
	// DefaultImageName is the name of the Canasta image
	DefaultImageName = "canasta"
	// DefaultImageTag is the default tag to use for the Canasta image.
	// This should match the current stable Canasta release. Update it
	// when cutting a new CLI release to pair with a new Canasta version.
	DefaultImageTag = "3.2.1"
)

Variables

This section is empty.

Functions

func CheckCanastaId

func CheckCanastaId(instance config.Installation) (config.Installation, error)

Checking Installation existence

func ContainsProfile added in v1.134.0

func ContainsProfile(profiles, target string) bool

ContainsProfile checks if a comma-separated profile string contains the given profile name.

func CopyComposerFile added in v1.106.0

func CopyComposerFile(installPath, sourceFilename, workingDir string) error

CopyComposerFile copies a user-provided composer.local.json to config/composer.local.json.

func CopyGlobalSettingFile added in v1.47.0

func CopyGlobalSettingFile(installPath, settingsFilePath, workingDir string) error

CopyGlobalSettingFile copies a user-provided settings file to config/settings/global/ directory The original filename is preserved

func CopyInstallationTemplate added in v1.135.0

func CopyInstallationTemplate(destPath string) error

CopyInstallationTemplate copies the embedded installation template files to the destination directory. These are shared files common to all orchestrators. Files are only written if they don't already exist (no-clobber), so orchestrator repos can provide their own versions of files if needed.

func CopySetting

func CopySetting(installPath, id string) error

func CopySettings

func CopySettings(installPath string) error

func CopyWikiSettingFile added in v1.47.0

func CopyWikiSettingFile(installPath, wikiID, settingsFilePath, workingDir string) error

CopyWikiSettingFile copies a user-provided Settings.php file to the wiki's config directory Used when importing a wiki with a custom Settings.php

func CopyYaml

func CopyYaml(yamlPath, installPath string) error

func CreateCaddyfileGlobal added in v1.89.0

func CreateCaddyfileGlobal(installPath string) error

CreateCaddyfileGlobal creates config/Caddyfile.global from the installation template. It only writes the file if it doesn't already exist (no-clobber).

func CreateCaddyfileSite added in v1.128.0

func CreateCaddyfileSite(installPath string) error

CreateCaddyfileSite creates config/Caddyfile.site from the installation template. It only writes the file if it doesn't already exist (no-clobber).

func DeleteEnvVariable added in v1.167.0

func DeleteEnvVariable(envPath, key string) error

DeleteEnvVariable removes a key from the .env file. Returns an error if the key is not found.

func EnsureObservabilityCredentials added in v1.134.0

func EnsureObservabilityCredentials(installPath string) (bool, error)

EnsureObservabilityCredentials checks if CANASTA_ENABLE_OBSERVABILITY=true in .env. If active, it ensures OS_USER, OS_PASSWORD, and OS_PASSWORD_HASH are set. Returns true if observability is enabled.

func GenerateAndSaveSecretKey added in v1.54.0

func GenerateAndSaveSecretKey(installPath string) error

GenerateAndSaveSecretKey generates a secret key and saves it to .env as MW_SECRET_KEY, unless MW_SECRET_KEY is already set (e.g. provided by the user via -e flag).

func GeneratePassword added in v1.39.0

func GeneratePassword() (string, error)

GeneratePassword generates a random password.

func GetDefaultImage added in v1.41.0

func GetDefaultImage() string

GetDefaultImage returns the full default Canasta image reference

func GetEnvVariable

func GetEnvVariable(envPath string) (map[string]string, error)

Get values saved inside the .env at the envPath

func IsElasticsearchEnabled added in v1.159.0

func IsElasticsearchEnabled(envVars map[string]string) bool

IsElasticsearchEnabled returns true when CANASTA_ENABLE_ELASTICSEARCH is set to "true" (case-insensitive) in the given env vars map.

func IsObservabilityEnabled added in v1.154.0

func IsObservabilityEnabled(envVars map[string]string) bool

IsObservabilityEnabled returns true when CANASTA_ENABLE_OBSERVABILITY is set to "true" (case-insensitive) in the given env vars map.

func MigrateToNewVersion

func MigrateToNewVersion(installPath string) error

func NormalizeWikiID added in v1.141.0

func NormalizeWikiID(id string) string

NormalizeWikiID converts a wiki ID to a filesystem-safe form by replacing spaces with underscores and stripping non-alphanumeric characters.

func RemoveImages

func RemoveImages(installPath, id string) error

func RemovePublicAssets added in v1.91.0

func RemovePublicAssets(installPath, id string) error

func RemoveSettings

func RemoveSettings(installPath, id string) error

func RewriteCaddy

func RewriteCaddy(installPath string) error

func SaveEnvVariable

func SaveEnvVariable(envPath, key, value string) error

Make changes to the .env file at the installation directory If the key exists, it updates the value; if not, it appends the key=value pair

func SavePasswordToFile added in v1.39.0

func SavePasswordToFile(directory, filename, password string) error

SavePasswordToFile saves a password to a file in the specified directory

func UpdateEnvFile added in v1.135.0

func UpdateEnvFile(customEnvPath, installPath, workingDir, rootDBpass, wikiDBpass string) error

UpdateEnvFile configures the .env file for a new Canasta installation. The base .env is provided by the installation template (CopyInstallationTemplate). This function merges any custom env file if provided, and then applies the DB passwords and domain configuration.

func UpdateInstallationTemplate added in v1.135.0

func UpdateInstallationTemplate(destPath string) error

UpdateInstallationTemplate re-applies the embedded template during upgrade. User-editable files are only created if missing (no-clobber). CLI-managed files (READMEs, etc.) are always updated to match the current CLI version.

func ValidateDatabasePath added in v1.47.0

func ValidateDatabasePath(path string) error

ValidateDatabasePath validates that the database file path has a valid extension (.sql or .sql.gz)

Types

type CanastaVariables

type CanastaVariables struct {
	Id             string
	AdminPassword  string
	AdminName      string
	RootDBPassword string
	WikiDBUsername string
	WikiDBPassword string
}

func GenerateAdminPassword added in v1.54.0

func GenerateAdminPassword(canastaInfo CanastaVariables) (CanastaVariables, error)

GenerateAdminPassword generates an admin password if not provided. This should only be called when NOT importing a database (i.e., running install.php).

func GenerateDBPasswords added in v1.54.0

func GenerateDBPasswords(canastaInfo CanastaVariables) (CanastaVariables, error)

GenerateDBPasswords generates database passwords (root and wiki DB). This should always be called, even when importing a database.

Jump to

Keyboard shortcuts

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