Documentation
¶
Overview ¶
Package inithooks provides support for running user-defined scripts on Gopherstack startup. Scripts are executed sequentially in the order they are listed, using the system shell. Any script that exits with a non-zero status is logged as an error but does not abort startup.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLegacyReadyDirs ¶
func DefaultLegacyReadyDirs() []string
DefaultLegacyReadyDirs are LocalStack's deprecated flat READY-stage script directories.
func DefaultRoots ¶
func DefaultRoots() []string
DefaultRoots are the stage-directory roots scanned when present.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager discovers and runs <root>/<stage>.d scripts and tracks their status.
func NewManager ¶
func NewManager(cfg ManagerConfig) *Manager
NewManager creates a Manager; a zero Timeout defaults to 30 s.
func (*Manager) Run ¶
Run executes the stage's scripts sequentially, then marks the stage completed. Script failures are recorded and logged but never abort the stage.
func (*Manager) Status ¶
func (m *Manager) Status() []ScriptStatus
Status returns every script seen so far, in stage then execution order.
type ManagerConfig ¶
type ManagerConfig struct {
Log *slog.Logger
// Env is appended to the process environment for every script.
Env []string
Roots []string
// LegacyReadyDirs are flat script dirs run in READY after the ready.d scripts.
LegacyReadyDirs []string
Timeout time.Duration
}
ManagerConfig configures a Manager.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner executes a list of init scripts on startup.
type ScriptStatus ¶
ScriptStatus is the status of one discovered script.