app

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 11 Imported by: 1

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) 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

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) 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

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