Help us shape the future of Go! Take the 2026 Go Developer Survey

extensions

package
v0.0.0-...-3d357ff Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadUserExtensions

func LoadUserExtensions(ctx *Context, buildDir string) error

LoadUserExtensions loads user-requested PHP extensions from .bp-config/php/php.ini.d/*.ini files and updates the context with the parsed extension lists

Types

type Application

type Application struct {
	ApplicationID    string   `json:"application_id"`
	ApplicationName  string   `json:"application_name"`
	ApplicationURIs  []string `json:"application_uris"`
	Name             string   `json:"name"`
	SpaceName        string   `json:"space_name"`
	SpaceID          string   `json:"space_id"`
	OrganizationID   string   `json:"organization_id"`
	OrganizationName string   `json:"organization_name"`
}

Application represents the Cloud Foundry application metadata

type ConfigFileEditor

type ConfigFileEditor struct {
	// contains filtered or unexported fields
}

ConfigFileEditor provides methods for editing configuration files This is the Go equivalent of Python's utils.ConfigFileEditor

func NewConfigFileEditor

func NewConfigFileEditor(path string) (*ConfigFileEditor, error)

NewConfigFileEditor creates a new config file editor

func (*ConfigFileEditor) AppendLines

func (e *ConfigFileEditor) AppendLines(newLines []string)

AppendLines appends lines to the file

func (*ConfigFileEditor) Save

func (e *ConfigFileEditor) Save(path string) error

Save writes the modified content back to the file

func (*ConfigFileEditor) UpdateLines

func (e *ConfigFileEditor) UpdateLines(pattern, replacement string) error

UpdateLines replaces lines matching a regex pattern with a new line

type Context

type Context struct {
	// Core directories
	BuildDir string
	CacheDir string
	DepsDir  string
	DepsIdx  string
	BPDir    string // Buildpack directory

	// Environment
	Env map[string]string

	// Cloud Foundry VCAP data
	VcapServices    map[string][]Service
	VcapApplication Application

	// Additional context data (configuration options, etc.)
	Data map[string]interface{}
}

Context contains the buildpack context (environment, paths, VCAP data, etc.) This is the Go equivalent of Python's ctx dict.

func NewContext

func NewContext() (*Context, error)

NewContext creates a new Context from the environment

func (*Context) FindServiceByName

func (c *Context) FindServiceByName(name string) *Service

FindServiceByName searches for a service by name

func (*Context) FindServicesByLabel

func (c *Context) FindServicesByLabel(label string) []Service

FindServicesByLabel searches for services by label

func (*Context) Get

func (c *Context) Get(key string) (interface{}, bool)

Get retrieves a value from the context data

func (*Context) GetString

func (c *Context) GetString(key string) string

GetString retrieves a string value from the context data

func (*Context) GetStringSlice

func (c *Context) GetStringSlice(key string) []string

GetStringSlice retrieves a string slice from the context data

func (*Context) HasService

func (c *Context) HasService(name string) bool

HasService checks if a service with the given name exists

func (*Context) Set

func (c *Context) Set(key string, value interface{})

Set stores a value in the context data

type Extension

type Extension interface {
	// Name returns the unique name of the extension
	Name() string

	// ShouldCompile determines if the extension should install its payload
	ShouldCompile(ctx *Context) bool

	// Configure configures the extension (called early in build)
	Configure(ctx *Context) error

	// Compile installs/compiles the extension payload
	Compile(ctx *Context, installer *Installer) error

	// PreprocessCommands returns list of commands to run once before app starts
	PreprocessCommands(ctx *Context) ([]string, error)

	// ServiceCommands returns map of long-running service commands (name -> command)
	ServiceCommands(ctx *Context) (map[string]string, error)

	// ServiceEnvironment returns map of environment variables for services
	ServiceEnvironment(ctx *Context) (map[string]string, error)
}

Extension defines the interface that all buildpack extensions must implement. This is the Go equivalent of Python's ExtensionHelper class.

type Installer

type Installer struct {
	// contains filtered or unexported fields
}

Installer provides methods for downloading and installing dependencies. This is the Go equivalent of Python's install object.

func NewInstaller

func NewInstaller(ctx *Context) *Installer

NewInstaller creates a new Installer

func NewInstallerWithLibbuildpack

func NewInstallerWithLibbuildpack(ctx *Context, libbuildpackInst LibbuildpackInstaller) *Installer

NewInstallerWithLibbuildpack creates an Installer with a libbuildpack installer

func (*Installer) InstallDependency

func (i *Installer) InstallDependency(dep libbuildpack.Dependency, outputDir string) error

InstallDependency installs a dependency using the libbuildpack installer

func (*Installer) InstallOnlyVersion

func (i *Installer) InstallOnlyVersion(depName, installDir string) error

InstallOnlyVersion installs the only available version of a dependency

func (*Installer) Package

func (i *Installer) Package(packageKey string) error

Package downloads and installs a package based on a key in the context This mimics Python's install.package('PACKAGENAME') method

type LibbuildpackInstaller

type LibbuildpackInstaller interface {
	InstallDependency(dep libbuildpack.Dependency, outputDir string) error
	InstallOnlyVersion(depName, installDir string) error
}

LibbuildpackInstaller interface for libbuildpack dependency installation

type PHPConfigHelper

type PHPConfigHelper struct {
	// contains filtered or unexported fields
}

PHPConfigHelper provides PHP-specific configuration helpers

func NewPHPConfigHelper

func NewPHPConfigHelper(ctx *Context) *PHPConfigHelper

NewPHPConfigHelper creates a new PHP config helper

func (*PHPConfigHelper) LoadConfig

func (h *PHPConfigHelper) LoadConfig() error

LoadConfig loads the PHP configuration files

func (*PHPConfigHelper) PHPFpm

func (h *PHPConfigHelper) PHPFpm() *ConfigFileEditor

PHPFpm returns the php-fpm.conf config editor

func (*PHPConfigHelper) PHPIni

func (h *PHPConfigHelper) PHPIni() *ConfigFileEditor

PHPIni returns the php.ini config editor

func (*PHPConfigHelper) PHPIniPath

func (h *PHPConfigHelper) PHPIniPath() string

PHPIniPath returns the path to php.ini

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages all registered extensions

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new extension registry

func (*Registry) CompileExtensions

func (r *Registry) CompileExtensions(ctx *Context, installer *Installer) error

CompileExtensions runs the compile method on all extensions

func (*Registry) Extensions

func (r *Registry) Extensions() []Extension

Extensions returns all registered extensions

func (*Registry) GetPreprocessCommands

func (r *Registry) GetPreprocessCommands(ctx *Context) ([]string, error)

GetPreprocessCommands collects preprocess commands from all extensions

func (*Registry) GetServiceCommands

func (r *Registry) GetServiceCommands(ctx *Context) (map[string]string, error)

GetServiceCommands collects service commands from all extensions

func (*Registry) GetServiceEnvironment

func (r *Registry) GetServiceEnvironment(ctx *Context) (map[string]string, error)

GetServiceEnvironment collects service environment variables from all extensions

func (*Registry) ProcessExtensions

func (r *Registry) ProcessExtensions(ctx *Context, method string) error

ProcessExtensions runs the specified method on all extensions

func (*Registry) Register

func (r *Registry) Register(ext Extension)

Register adds an extension to the registry

type Service

type Service struct {
	Name        string                 `json:"name"`
	Label       string                 `json:"label"`
	Tags        []string               `json:"tags"`
	Plan        string                 `json:"plan"`
	Credentials map[string]interface{} `json:"credentials"`
}

Service represents a Cloud Foundry bound service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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