config

package
v0.0.0-...-1d32ed5 Latest Latest
Warning

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

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

Documentation

Overview

Package config handles the persistent daemon configuration stored in ~/.gsd-cloud/config.json.

Index

Constants

View Source
const DefaultLogLevel = "info"

DefaultLogLevel is the default slog level string.

View Source
const DefaultRelayURL = "wss://relay.gsd.build/ws/daemon"

DefaultRelayURL is the production relay WebSocket endpoint.

View Source
const DefaultServerURL = "https://app.gsd.build"

DefaultServerURL is the production web app host.

View Source
const DefaultTaskTimeoutMinutes = 30

DefaultTaskTimeoutMinutes is the default per-task timeout.

View Source
const DefaultWarmWorkerIdleCap = 4
View Source
const DefaultWarmWorkerIdleMinutes = 20
View Source
const MaxWarmWorkerIdleCap = 16
View Source
const MaxWarmWorkerIdleMinutes = 60
View Source
const MinWarmWorkerIdleCap = 0
View Source
const MinWarmWorkerIdleMinutes = 2

Variables

This section is empty.

Functions

func NewInstallationID

func NewInstallationID() (string, error)

func Path

func Path() (string, error)

Path returns the absolute path to the config file.

func Save

func Save(cfg *Config) error

Save writes the config to disk with 0600 permissions.

Types

type Config

type Config struct {
	MachineID             string `json:"machineId"`
	InstallationID        string `json:"installationId,omitempty"`
	AuthToken             string `json:"authToken"`
	TokenExpiresAt        string `json:"tokenExpiresAt,omitempty"`
	ServerURL             string `json:"serverUrl"`
	RelayURL              string `json:"relayUrl"`
	MaxConcurrentTasks    int    `json:"maxConcurrentTasks,omitempty"` // 0 means runtime.NumCPU
	TaskTimeoutMinutes    int    `json:"taskTimeoutMinutes,omitempty"`
	WarmWorkersEnabled    *bool  `json:"warmWorkersEnabled,omitempty"`
	WarmWorkerIdleMinutes int    `json:"warmWorkerIdleMinutes,omitempty"`
	WarmWorkerIdleCap     *int   `json:"warmWorkerIdleCap,omitempty"`
	LogLevel              string `json:"logLevel,omitempty"`
}

Config is the on-disk daemon state.

func Load

func Load() (*Config, error)

Load reads the config from disk.

func LoadFrom

func LoadFrom(path string) (*Config, error)

LoadFrom reads the config from the given file path.

func (*Config) EffectiveMaxConcurrentTasks

func (c *Config) EffectiveMaxConcurrentTasks() int

EffectiveMaxConcurrentTasks returns the configured limit or runtime.NumCPU() when the field is 0 (unset).

func (*Config) EffectiveTaskTimeout

func (c *Config) EffectiveTaskTimeout() time.Duration

EffectiveTaskTimeout returns the configured timeout duration or the 30-minute default when the field is 0 (unset).

func (*Config) EffectiveWarmWorkerIdle

func (c *Config) EffectiveWarmWorkerIdle() time.Duration

func (*Config) EffectiveWarmWorkerIdleCap

func (c *Config) EffectiveWarmWorkerIdleCap() int

func (*Config) EffectiveWarmWorkersEnabled

func (c *Config) EffectiveWarmWorkersEnabled() bool

func (*Config) EnsureInstallationID

func (cfg *Config) EnsureInstallationID() (string, error)

Jump to

Keyboard shortcuts

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