app

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 13 Imported by: 8 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoFileFound = errors.New("unable to find a matching file")

Functions

This section is empty.

Types

type App

type App struct {
	Source string
	// contains filtered or unexported fields
}

func NewApp

func NewApp(path string) (*App, error)

func (*App) FindAllFiles added in v0.40.0

func (a *App) FindAllFiles(pattern string) ([]string, error)

Same scan as FindFiles, ignoring any configured ignore patterns.

func (*App) FindDirectories

func (a *App) FindDirectories(pattern string) ([]string, error)

FindDirectories returns a list of directory paths matching a glob pattern

func (*App) FindFiles

func (a *App) FindFiles(pattern string) ([]string, error)

returns a list of file paths matching a glob pattern, respecting configured ignore patterns

func (*App) FindFilesWithContent added in v0.0.35

func (a *App) FindFilesWithContent(pattern string, regex *regexp.Regexp) []string

func (*App) HasFile added in v0.5.0

func (a *App) HasFile(path string) bool

Check if a relative file exists in the app's source directory

func (*App) HasMatch

func (a *App) HasMatch(pattern string) bool

HasMatch checks if a path matching a glob exists (files or directories)

func (*App) IsExcluded added in v0.40.0

func (a *App) IsExcluded(path string) bool

True when path will not be in the build context.

func (*App) IsFileExecutable

func (a *App) IsFileExecutable(name string) bool

checks if a path is an executable file

func (*App) ReadFile

func (a *App) ReadFile(name string) (string, error)

ReadFile reads the contents of a file within the application source directory

func (*App) ReadFirstFileOf added in v0.29.0

func (a *App) ReadFirstFileOf(names ...string) (string, string, error)

reads the contents of the first file that exists within the application source directory helpful for reading config from multiple possible locations (something.js, something.ts, etc)

func (*App) ReadJSON

func (a *App) ReadJSON(name string, v any) error

ReadJSON reads and parses a JSON file

func (*App) ReadTOML

func (a *App) ReadTOML(name string, v any) error

func (*App) ReadYAML

func (a *App) ReadYAML(name string, v any) error

ReadYAML reads and parses a YAML file

func (*App) SetExcludePatterns added in v0.40.0

func (a *App) SetExcludePatterns(patterns []string) error

SetExcludePatterns compiles the patterns that keep files out of the build context, so that path discovery cannot return a file BuildKit will never load.

The planner reads the source directory directly, while BuildKit only ever sees the filtered context. Without this, a provider can glob up a file that is excluded and emit a COPY for it; the build then fails late with "failed to compute cache key: ... not found".

Patterns come from .dockerignore and railpack.json's `exclude`. Negations are honoured, since this is the same matcher BuildKit builds the context with. Passing no patterns clears the filter.

type Environment

type Environment struct {
	Variables map[string]string
}

func FromEnvs

func FromEnvs(envs []string) (*Environment, error)

FromEnvs collects variables from the given environment variable names

func NewEnvironment

func NewEnvironment(variables *map[string]string) *Environment

func (*Environment) ConfigVariable

func (e *Environment) ConfigVariable(name string) string

ConfigVariable returns the RAILPACK_ prefixed version of a variable name

func (*Environment) GetConfigVariable

func (e *Environment) GetConfigVariable(name string) (string, string)

returns the value of a RAILPACK_ prefixed variable with newlines removed Returns both the value and the name of the config variable

func (*Environment) GetConfigVariableList added in v0.17.0

func (e *Environment) GetConfigVariableList(name string) ([]string, string)

GetConfigVariableList returns a space-separated config variable as a list Returns both the list and the name of the config variable

func (*Environment) GetSecretsWithPrefix added in v0.0.11

func (e *Environment) GetSecretsWithPrefix(prefix string) []string

GetSecretsWithPrefix returns all secrets that have the given prefix

func (*Environment) GetVariable

func (e *Environment) GetVariable(name string) string

GetVariable returns the value of the given variable name

func (*Environment) IsConfigVariableTruthy

func (e *Environment) IsConfigVariableTruthy(name string) bool

checks if a RAILPACK_ prefixed variable is set to "1" or "true"

func (*Environment) SetVariable

func (e *Environment) SetVariable(name, value string)

SetVariable stores a variable in the Environment

Jump to

Keyboard shortcuts

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