Documentation
¶
Index ¶
- Constants
- func CheckCanastaId(instance config.Installation) (config.Installation, error)
- func ContainsProfile(profiles, target string) bool
- func CopyComposerFile(installPath, sourceFilename, workingDir string) error
- func CopyGlobalSettingFile(installPath, settingsFilePath, workingDir string) error
- func CopyInstallationTemplate(destPath string) error
- func CopySetting(installPath, id string) error
- func CopySettings(installPath string) error
- func CopyWikiSettingFile(installPath, wikiID, settingsFilePath, workingDir string) error
- func CopyYaml(yamlPath, installPath string) error
- func CreateCaddyfileGlobal(installPath string) error
- func CreateCaddyfileSite(installPath string) error
- func DeleteEnvVariable(envPath, key string) error
- func EnsureObservabilityCredentials(installPath string) (bool, error)
- func GenerateAndSaveSecretKey(installPath string) error
- func GeneratePassword() (string, error)
- func GetDefaultImage() string
- func GetEnvVariable(envPath string) (map[string]string, error)
- func IsElasticsearchEnabled(envVars map[string]string) bool
- func IsObservabilityEnabled(envVars map[string]string) bool
- func MigrateToNewVersion(installPath string) error
- func NormalizeWikiID(id string) string
- func RemoveImages(installPath, id string) error
- func RemovePublicAssets(installPath, id string) error
- func RemoveSettings(installPath, id string) error
- func RewriteCaddy(installPath string) error
- func SaveEnvVariable(envPath, key, value string) error
- func SavePasswordToFile(directory, filename, password string) error
- func UpdateEnvFile(customEnvPath, installPath, workingDir, rootDBpass, wikiDBpass string) error
- func UpdateInstallationTemplate(destPath string) error
- func ValidateDatabasePath(path string) error
- type CanastaVariables
Constants ¶
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
ContainsProfile checks if a comma-separated profile string contains the given profile name.
func CopyComposerFile ¶ added in v1.106.0
CopyComposerFile copies a user-provided composer.local.json to config/composer.local.json.
func CopyGlobalSettingFile ¶ added in v1.47.0
CopyGlobalSettingFile copies a user-provided settings file to config/settings/global/ directory The original filename is preserved
func CopyInstallationTemplate ¶ added in v1.135.0
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 CopySettings ¶
func CopyWikiSettingFile ¶ added in v1.47.0
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 CreateCaddyfileGlobal ¶ added in v1.89.0
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
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
DeleteEnvVariable removes a key from the .env file. Returns an error if the key is not found.
func EnsureObservabilityCredentials ¶ added in v1.134.0
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
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
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 ¶
Get values saved inside the .env at the envPath
func IsElasticsearchEnabled ¶ added in v1.159.0
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
IsObservabilityEnabled returns true when CANASTA_ENABLE_OBSERVABILITY is set to "true" (case-insensitive) in the given env vars map.
func MigrateToNewVersion ¶
func NormalizeWikiID ¶ added in v1.141.0
NormalizeWikiID converts a wiki ID to a filesystem-safe form by replacing spaces with underscores and stripping non-alphanumeric characters.
func RemoveImages ¶
func RemovePublicAssets ¶ added in v1.91.0
func RemoveSettings ¶
func RewriteCaddy ¶
func SaveEnvVariable ¶
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
SavePasswordToFile saves a password to a file in the specified directory
func UpdateEnvFile ¶ added in v1.135.0
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
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
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.