generate

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package generate creates a workspace (init) and writes its files again from openarch.yaml (render).

Index

Constants

View Source
const (
	Create    = "create"
	Update    = "update"
	Unchanged = "unchanged"
	Delete    = "delete"
)

File actions.

View Source
const DefaultAdminUser = "admin"

DefaultAdminUser is the OpenArch admin user name.

View Source
const UpstreamAdminPassword = "password"

UpstreamAdminPassword is the password of the users bundled in the OpenArch image.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	// HostMemory returns the memory available to Docker, in bytes.
	HostMemory func(ctx context.Context) (int64, error)
	Now        func() time.Time
}

Env is the access to the system. Tests replace it with fakes.

func SystemEnv

func SystemEnv() Env

SystemEnv returns an Env backed by the real system.

type FileResult

type FileResult struct {
	Path   string `json:"path"`
	Action string `json:"action"`
	// Diff is set by render --dry-run for updated files that hold no secrets.
	Diff string `json:"diff,omitempty"`
}

FileResult is what happened, or would happen, to one file.

type InitOptions

type InitOptions struct {
	Dir    string
	Config workspace.Config
	// AdminPassword is the new admin password. Empty keeps the password of an
	// existing .env.local (with Force) or generates one.
	AdminPassword string
	Force         bool
	DryRun        bool
}

InitOptions are the inputs of Init.

type MigrateResult added in v0.4.0

type MigrateResult struct {
	Workspace string `json:"workspace"`
	DryRun    bool   `json:"dryRun"`
	From      int    `json:"from"`
	To        int    `json:"to"`
	// Action is Update, or Unchanged when the file already has the current schema.
	Action string `json:"action"`
	// Diff is set with dry run when the file changes.
	Diff string `json:"diff,omitempty"`
}

MigrateResult is the outcome of Migrate.

func Migrate added in v0.4.0

func Migrate(dir string, dryRun bool) (MigrateResult, error)

Migrate rewrites openarch.yaml in dir with the current schemaVersion. The other workspace files do not depend on the schema, so they stay as they are.

func (MigrateResult) WriteText added in v0.4.0

func (r MigrateResult) WriteText(w io.Writer) error

WriteText writes the human-readable form.

type RenderOptions

type RenderOptions struct {
	Dir    string
	DryRun bool
}

RenderOptions are the inputs of Render.

type Result

type Result struct {
	Command      string           `json:"-"`
	Workspace    string           `json:"workspace"`
	DryRun       bool             `json:"dryRun"`
	URL          string           `json:"url"`
	AdminUser    string           `json:"adminUser"`
	PasswordFile string           `json:"passwordFile"`
	Config       workspace.Config `json:"config"`
	Sizing       workspace.Sizing `json:"sizing"`
	Files        []FileResult     `json:"files"`
	Folders      []string         `json:"folders,omitempty"`
	// Context is the name of the CLI context that points to the workspace. init sets it.
	Context string `json:"context,omitempty"`
	// Warnings go to stderr, never to stdout.
	Warnings []string `json:"-"`
}

Result is the outcome of Init or Render.

func Init

func Init(ctx context.Context, env Env, opts InitOptions) (Result, error)

Init creates a workspace in opts.Dir.

func Render

func Render(ctx context.Context, env Env, opts RenderOptions) (Result, error)

Render writes the workspace files again from openarch.yaml and .env.local.

func (Result) WriteText

func (r Result) WriteText(w io.Writer) error

WriteText writes the human-readable form.

Jump to

Keyboard shortcuts

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