launcherconfig

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FileName is the launcher-specific settings file name.
	FileName = "launcher-config.json"
	// DefaultPort is the default port for the web launcher.
	DefaultPort = 18800
	// EnvLauncherHost overrides launcher listen host.
	EnvLauncherHost = "COMPA_LAUNCHER_HOST"
)

Variables

This section is empty.

Functions

func NormalizeCIDRs

func NormalizeCIDRs(cidrs []string) []string

NormalizeCIDRs trims entries, removes empty values, and deduplicates CIDRs.

func PathForAppConfig

func PathForAppConfig(appConfigPath string) string

PathForAppConfig returns launcher-config path near the app config file.

func Save

func Save(path string, cfg Config) error

Save writes launcher settings to disk.

func Validate

func Validate(cfg Config) error

Validate checks if launcher settings are valid.

Types

type BoolFieldSource

type BoolFieldSource uint8

BoolFieldSource tracks whether a JSON boolean field was omitted, explicitly provided, or explicitly set to null. This is only used for diagnostics.

const (
	BoolFieldAbsent BoolFieldSource = iota
	BoolFieldPresent
	BoolFieldNull
)

type Config

type Config struct {
	Port                       int             `json:"port"`
	Public                     bool            `json:"public"`
	AllowedCIDRs               []string        `json:"allowed_cidrs,omitempty"`
	AllowLocalhostBypass       bool            `json:"allow_localhost_bypass"`
	AllowLocalhostBypassSource BoolFieldSource `json:"-"`
	TrustedProxyCIDRs          []string        `json:"trusted_proxy_cidrs,omitempty"`
	DashboardPasswordHash      string          `json:"dashboard_password_hash,omitempty"`
}

Config stores launch parameters for the web backend service.

func Default

func Default() Config

Default returns default launcher settings.

func Load

func Load(path string, fallback Config) (Config, error)

Load reads launcher settings; fallback is returned when file does not exist.

type PasswordStore

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

PasswordStore keeps the dashboard bcrypt hash in launcher-config.json. It is used on platforms where the SQLite-backed dashboard auth store is not available.

func NewPasswordStore

func NewPasswordStore(path string, fallback Config) *PasswordStore

NewPasswordStore returns a config-backed password store.

func (*PasswordStore) IsInitialized

func (s *PasswordStore) IsInitialized(ctx context.Context) (bool, error)

IsInitialized reports whether a dashboard password hash exists in config.

func (*PasswordStore) SetPassword

func (s *PasswordStore) SetPassword(ctx context.Context, plain string) error

SetPassword hashes plain with bcrypt and writes it to launcher-config.json.

func (*PasswordStore) VerifyPassword

func (s *PasswordStore) VerifyPassword(ctx context.Context, plain string) (bool, error)

VerifyPassword returns true iff plain matches the stored bcrypt hash.

Jump to

Keyboard shortcuts

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