config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config provides server-side configuration loaded from environment variables and per-application manifests parsed from jumpgate.toml files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppManifest

type AppManifest struct {
	// Name is the unique identifier for this application (e.g., "api-service").
	Name string `toml:"name"`

	// Domain is the public domain that Traefik routes to this app (e.g., "api.example.com").
	Domain string `toml:"domain"`

	// Port is the container port the application listens on.
	Port int `toml:"port"`

	// BuildArgs are key=value pairs passed as --build-arg to docker build.
	BuildArgs []string `toml:"build_args"`

	// HealthCheckPath is the HTTP path to poll for health (default: "/").
	// An empty string means TCP port check only.
	HealthCheckPath string `toml:"health_check_path"`

	// EnvVars are key=value environment variables injected into the container.
	EnvVars []string `toml:"env_vars"`

	// Dockerfile is an optional relative path to the Dockerfile (default: "Dockerfile").
	Dockerfile string `toml:"dockerfile"`
}

AppManifest represents a parsed jumpgate.toml file found at the root of a user's repository. It declares how the application should be built and run.

func ParseManifest

func ParseManifest(repoPath string) (*AppManifest, error)

ParseManifest reads and parses a jumpgate.toml file from the given repository root directory. Returns the parsed manifest or an error if the file is missing or invalid.

func (*AppManifest) Validate

func (m *AppManifest) Validate() error

Validate checks that all required fields are present and have valid values.

type ServerConfig

type ServerConfig struct {
	// WebhookPort is the TCP port the webhook HTTP server listens on.
	WebhookPort int

	// WebhookSecret is the HMAC secret used to validate incoming webhook payloads.
	WebhookSecret string

	// TraefikNetwork is the Docker network name that Traefik and all app containers
	// are attached to for routing.
	TraefikNetwork string

	// DockerSocket is the path to the Docker Engine API socket.
	DockerSocket string

	// DataDir is the directory where JumpGate stores its SQLite database.
	DataDir string

	// BuildDir is the directory where git repositories are cloned for building.
	BuildDir string

	// HealthCheckTimeout is the maximum duration to wait for a new container
	// to become healthy before marking the deployment as failed.
	HealthCheckTimeout time.Duration

	// BuildTimeout is the maximum duration allowed for a single image build.
	BuildTimeout time.Duration

	// SocketPath is the path to the Unix domain socket for CLI communication.
	SocketPath string
}

ServerConfig holds all server-wide configuration values. All fields have sensible defaults, overridable via environment variables.

func DefaultServerConfig

func DefaultServerConfig() *ServerConfig

DefaultServerConfig returns a ServerConfig populated with sensible defaults.

func Load

func Load() (*ServerConfig, error)

Load reads configuration from environment variables, falling back to defaults when values are absent or invalid.

Jump to

Keyboard shortcuts

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