devconfig

package
v0.0.0-...-2fd5d2c Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRuntimeImageVersion = "0.8.1"

DefaultRuntimeImageVersion is used when the SDK version cannot be detected from the project's dependency file.

View Source
const (
	// DevHandlersPath is where a dev session's handlers executable is built,
	// relative to the application directory.
	//
	// Under .celerity because the application directory is already bind
	// mounted into the container, so an executable written there needs no
	// mount of its own, and .celerity is the directory the CLI already owns
	// and projects already ignore.
	DevHandlersPath = ".celerity/dev/handlers"
)

Variables

This section is empty.

Functions

func BuildDevHandlers

func BuildDevHandlers(
	ctx context.Context,
	cfg *ResolvedConfig,
	arch string,
) error

BuildDevHandlers builds the handlers executable a dev session runs.

arch is the architecture the container runs at, which is the Docker daemon's rather than the CLI's: the two differ on a remote context or a Linux VM, and an executable built for the wrong one is refused by the kernel with nothing to say why.

func ContainerHandlersExecutable

func ContainerHandlersExecutable() string

ContainerHandlersExecutable is the path the core runtime starts, as seen from inside the container.

func FindDeployConfig

func FindDeployConfig(appDir string) string

FindDeployConfig looks for a deploy config file in the given directory. Returns the path if found, empty string if not.

func FindEnvDeployConfig

func FindEnvDeployConfig(appDir, envName string) string

FindEnvDeployConfig returns the path of the deploy config for a named environment, or an empty string where the environment has no file of its own.

func PatchJWTIssuer

func PatchJWTIssuer(bp *schema.Blueprint, portOffset int)

PatchJWTIssuer rewrites the issuer in every JWT auth guard of every celerity/api resource to point to the local dev auth sidecar. The merged blueprint (not the original source file) is modified in-place so the runtime performs OIDC discovery against the sidecar.

func ReadDeployTarget

func ReadDeployTarget(path string) (string, error)

ReadDeployTarget reads the deploy target name from a deploy config file. Supports JSONC (strips comments before parsing).

func ReadHandlerBuild

func ReadHandlerBuild(path string) (*handlertoolchain.Config, error)

ReadHandlerBuild reads the handlerBuild block from a deploy config file, returning nil where the file declares none.

How a community SDK's handlers executable is built, which for an OS-only runtime is the only thing that says what language the application is in.

Types

type DeployConfigResult

type DeployConfigResult struct {
	DeployTarget string
	AppEnv       string
	// Config is deployTarget.config with its values rendered as strings.
	Config map[string]string
}

DeployConfigResult is what a deploy config file says about its environment.

func ReadDeployConfig

func ReadDeployConfig(path string) (*DeployConfigResult, error)

ReadDeployConfig reads the deploy target settings from a deploy config file.

type EnvironmentInfo

type EnvironmentInfo struct {
	// Name is the environment's name, which is the one in the file name, or
	// "default" for the base config.
	Name string
	// FilePath is the deploy config the environment was read from.
	FilePath string
	// DeployTarget is deployTarget.name.
	DeployTarget string
	// AppEnv is deployTarget.appEnv, which the deploy engine prefixes config
	// store names with. Falls back to Name where the file does not set one.
	AppEnv string
	// Region and Profile are the cloud settings worth showing next to an
	// environment when choosing between them, pulled from deployTarget.config.
	Region  string
	Profile string
}

EnvironmentInfo describes one deployed environment the CLI can target.

An environment is a deploy config file rather than anything the CLI tracks of its own: app.deploy.jsonc is the default one, and app.deploy.<name>.jsonc adds another. Nothing has to be registered, so adding an environment is adding a file.

func DiscoverEnvironments

func DiscoverEnvironments(appDir string) ([]EnvironmentInfo, error)

DiscoverEnvironments returns every environment the application declares, in name order with the base config first.

The base config is listed as "default" rather than left out. It is the one an application starts with and often the only one, so an application with no per-environment files would otherwise have nothing to choose from.

type ResolveOpts

type ResolveOpts struct {
	BlueprintFile string
	DeployConfig  string
	Port          string
	AppDir        string
	ModulePath    string
	Image         string
	ServiceName   string
	Mode          string // "run" or "test"
	Verbose       bool
	LocalAuth     bool // true (default) = patch issuer to dev auth sidecar; false = --no-local-auth
	// Tracing runs a collector in the session and exports the application's
	// spans to it, so a dispatch can be read as a timeline rather than
	// reconstructed from log lines.
	Tracing bool
}

ResolveOpts holds the CLI flag values for config resolution.

type ResolvedConfig

type ResolvedConfig struct {
	Blueprint           *schema.Blueprint
	SpecFormat          schema.SpecFormat
	MergedBlueprintPath string
	DeployTarget        string
	RuntimeImage        string
	Runtime             string
	HandlerInfos        []blueprint.HandlerInfo
	Manifest            *preprocess.HandlerManifest
	ContainerConfig     *docker.ContainerConfig
	ComposeConfig       *compose.ComposeConfig
	SeedDir             string
	ConfigDir           string
	SecretsDir          string
	Mode                string
	AppDir              string
	ModulePath          string
	Port                string
	ServiceName         string
	// Toolchain builds the handlers executable, and is nil for a runtime that
	// hosts the language itself.
	Toolchain handlertoolchain.Toolchain
	// HandlersExecutable is where the built executable must be written on the
	// host for the container to find it. Empty when there is no Toolchain.
	HandlersExecutable string
	// Telemetry names what traces are exported with, or is empty for none.
	Telemetry string
}

ResolvedConfig is the fully resolved configuration for a dev run.

func Resolve

func Resolve(ctx context.Context, opts ResolveOpts, logger *zap.Logger) (*ResolvedConfig, error)

Resolve assembles the complete configuration by loading the blueprint, extracting handlers, merging, resolving the image, and generating compose config.

type ToolchainExtractor

type ToolchainExtractor struct {
	// contains filtered or unexported fields
}

ToolchainExtractor reports an application's handlers through its toolchain.

A thin adapter so a dev session's watcher can re-extract the same way it first did, without holding the resolved config or knowing which toolchain answered.

func NewToolchainExtractor

func NewToolchainExtractor(cfg *ResolvedConfig) *ToolchainExtractor

NewToolchainExtractor returns an extractor for a resolved dev session.

func (*ToolchainExtractor) Extract

Extract reports the handlers the application serves.

func (*ToolchainExtractor) WithLogger

func (e *ToolchainExtractor) WithLogger(logger *zap.Logger) *ToolchainExtractor

WithLogger returns the extractor reporting through the given logger.

Directories

Path Synopsis
Package resolve provides pure path-resolution and config-parsing helpers extracted from devconfig so they can be unit-tested without side effects.
Package resolve provides pure path-resolution and config-parsing helpers extracted from devconfig so they can be unit-tested without side effects.

Jump to

Keyboard shortcuts

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