Documentation
¶
Index ¶
- func LoadUserExtensions(ctx *Context, buildDir string) error
- type Application
- type ConfigFileEditor
- type Context
- func (c *Context) FindServiceByName(name string) *Service
- func (c *Context) FindServicesByLabel(label string) []Service
- func (c *Context) Get(key string) (interface{}, bool)
- func (c *Context) GetString(key string) string
- func (c *Context) GetStringSlice(key string) []string
- func (c *Context) HasService(name string) bool
- func (c *Context) Set(key string, value interface{})
- type Extension
- type Installer
- type LibbuildpackInstaller
- type PHPConfigHelper
- type Registry
- func (r *Registry) CompileExtensions(ctx *Context, installer *Installer) error
- func (r *Registry) Extensions() []Extension
- func (r *Registry) GetPreprocessCommands(ctx *Context) ([]string, error)
- func (r *Registry) GetServiceCommands(ctx *Context) (map[string]string, error)
- func (r *Registry) GetServiceEnvironment(ctx *Context) (map[string]string, error)
- func (r *Registry) ProcessExtensions(ctx *Context, method string) error
- func (r *Registry) Register(ext Extension)
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadUserExtensions ¶
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 ¶
NewContext creates a new Context from the environment
func (*Context) FindServiceByName ¶
FindServiceByName searches for a service by name
func (*Context) FindServicesByLabel ¶
FindServicesByLabel searches for services by label
func (*Context) GetStringSlice ¶
GetStringSlice retrieves a string slice from the context data
func (*Context) HasService ¶
HasService checks if a service with the given name exists
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 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 ¶
InstallOnlyVersion installs the only available version of a dependency
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 (*Registry) CompileExtensions ¶
CompileExtensions runs the compile method on all extensions
func (*Registry) Extensions ¶
Extensions returns all registered extensions
func (*Registry) GetPreprocessCommands ¶
GetPreprocessCommands collects preprocess commands from all extensions
func (*Registry) GetServiceCommands ¶
GetServiceCommands collects service commands from all extensions
func (*Registry) GetServiceEnvironment ¶
GetServiceEnvironment collects service environment variables from all extensions
func (*Registry) ProcessExtensions ¶
ProcessExtensions runs the specified method on all extensions