configfile

package
v0.3.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package configfile applies an egg's config.files before each start, following Wings: parsers file, properties, ini, json, yaml and xml, {{...}} placeholders, dotted paths with [n] indexes and "*" wildcards, and {"old": "new"} replacement maps.

All file access goes through an os.Root on the service's data directory, so a symlink planted by the server owner cannot make the (root) agent write outside it.

Index

Constants

View Source
const MaxSize = 4 << 20

MaxSize is the largest config file the agent rewrites.

Variables

This section is empty.

Functions

func Apply

func Apply(dataDir string, files []File, uid int, v Values) []error

Apply rewrites every file inside dataDir. It returns one error per file that failed; a failing file never stops the others or the server start.

func Resolve

func Resolve(s string, v Values) string

Resolve substitutes placeholders; unknown ones are left as they are.

Types

type File

type File struct {
	Path   string
	Parser string
	Find   json.RawMessage
}

File is one config file rewrite from the egg.

type Values

type Values struct {
	Env         map[string]string
	IP          string
	Port        int
	MemoryMB    int
	DockerIface string // gateway of the Docker bridge, for {{config.docker.interface}}
}

Values feed the placeholders.

Jump to

Keyboard shortcuts

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