railpack

Configure and troubleshoot Railpack builds, with emphasis on RAILPACK_* environment variables, railpack.json overlays, build-plan inspection, local CLI installation and usage, and local BuildKit containers. Use for Railpack provider configuration, custom install/build/start commands, Mise or Apt packages, build or runtime variables and secrets, generated-plan debugging, BUILDKIT_HOST errors, or running Railpack from a release or source checkout.

Install
npx skills add 'https://github.com/railwayapp/railpack/tree/main/.'
Incomplete bundle · no download
main · 21a254fScanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

core/generate/template.go

core/generate/template.goBrowse 1970 files
View on GitHub
← Back to SKILL.md
package generate import (	"bytes"	"errors"	"fmt"	"text/template" 	"github.com/railwayapp/railpack/core/app") type TemplateFileResult struct {	Filename string	Contents string} // TemplateFiles will look the first file that exists in the list of potential files and render it with the given data// If no file is found, it will use the default contents and render it with the given datafunc (c *GenerateContext) TemplateFiles(potentialFiles []string, defaultContents string, data map[string]any) (*TemplateFileResult, error) {	filename, contents, err := c.App.ReadFirstFileOf(potentialFiles...)	if err != nil {		if !errors.Is(err, app.ErrNoFileFound) {			return nil, err		} 		contents = defaultContents	} 	tmpl, err := template.New(filename).Parse(contents)	if err != nil {		return nil, fmt.Errorf("failed to parse template: %w", err)	} 	var buf bytes.Buffer	if err := tmpl.Execute(&buf, data); err != nil {		return nil, fmt.Errorf("failed to execute template: %w", err)	} 	return &TemplateFileResult{		Filename: filename,		Contents: buf.String(),	}, nil}