project

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package project defines the luanti.toml project manifest format.

Index

Constants

View Source
const Filename = "luanti.toml"

Filename is the standard project manifest file name.

Variables

View Source
var ErrNotFound = errors.New("no luanti.toml found in current directory — run: luctl project init")

ErrNotFound is returned when no luanti.toml exists in the current directory.

Functions

func AddPackage

func AddPackage(p *Project, id, pkgType string) bool

AddPackage appends a package to the appropriate list if not already declared. Returns true if the entry was added, false if a duplicate was found.

func Save

func Save(p *Project, path string) error

Save writes the project to path as TOML. Mods and games lists are each sorted alphabetically before writing. String arrays with more than one element are written one item per line.

func SetModEnabled

func SetModEnabled(worldDir, modName string, enabled bool) error

SetModEnabled writes load_mod_<modName> = <enabled> into world.mt, updating an existing line in-place or appending if no entry exists yet.

func SyncConfig

func SyncConfig(confPath string, config map[string]any) error

SyncConfig applies every key in config to confPath (a minetest.conf file), updating existing lines in-place and appending unknown keys at the end. Lines that begin with # are left untouched.

Types

type BackupConfig added in v0.3.0

type BackupConfig struct {
	Bucket   string `toml:"bucket"`
	Endpoint string `toml:"endpoint"`
	Region   string `toml:"region"`
	Prefix   string `toml:"prefix"`
}

BackupConfig holds S3-compatible storage settings for server backups. Credentials are NOT stored here — set LUCTL_S3_ACCESS_KEY and LUCTL_S3_SECRET_KEY env vars.

type PackageEntry

type PackageEntry struct {
	ID   string
	Type string
}

PackageEntry is a resolved (id, type) pair produced by AllEntries.

type PackagesConfig

type PackagesConfig struct {
	Mods  []string `toml:"mods"`
	Games []string `toml:"games"`
}

PackagesConfig holds the declared package dependencies, split by type. IDs use ContentDB "author/name" format.

func (*PackagesConfig) AllEntries

func (pc *PackagesConfig) AllEntries() []PackageEntry

AllEntries returns every declared package as (id, type) pairs, convenient for iteration in install/status commands.

type PathsConfig

type PathsConfig struct {
	ModsDir  string `toml:"mods_dir"`
	GamesDir string `toml:"games_dir"`
	WorldDir string `toml:"world_dir"`
	ConfFile string `toml:"conf_file"`
}

PathsConfig holds filesystem paths used by luctl commands.

type Project

type Project struct {
	Server   ServerConfig   `toml:"server"`
	World    WorldConfig    `toml:"world"`
	Paths    PathsConfig    `toml:"paths"`
	Packages PackagesConfig `toml:"packages"`
	Config   map[string]any `toml:"config"`
	Backup   BackupConfig   `toml:"backup"`
}

Project is the top-level structure of a luanti.toml manifest.

func Default

func Default() *Project

Default returns a Project populated with sensible defaults.

func Load

func Load(path string) (*Project, error)

Load reads and parses a luanti.toml file from path.

func LoadCurrent

func LoadCurrent() (*Project, error)

LoadCurrent loads luanti.toml from the current working directory.

type ServerConfig

type ServerConfig struct {
	Name        string   `toml:"name"`
	Description string   `toml:"description"`
	Port        int      `toml:"port"`
	Admins      []string `toml:"admins"`
}

ServerConfig holds server identity and network settings.

type WorldConfig

type WorldConfig struct {
	Game   string `toml:"game"`
	Mapgen string `toml:"mapgen"`
}

WorldConfig holds world generation settings.

Jump to

Keyboard shortcuts

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