Documentation
¶
Overview ¶
Package config reads and writes the configuration file of the CLI, config.json in the configuration folder. The file holds no secret.
Index ¶
Constants ¶
const ( DefaultInstance = "mai" DefaultPort = 8765 ImageRepository = "ghcr.io/monorithm/mai" )
Default values of the fields.
const FileName = "config.json"
FileName is the name of the configuration file in the configuration folder.
Variables ¶
This section is empty.
Functions ¶
func PinImage ¶
PinImage writes the image field of the file. An empty image removes the pin, so that the CLI uses the image of its version.
func Update ¶
Update applies o to the fields of the file in dir and writes the file. A field that the file does not hold stays out of the file, so that its default can change with the CLI. When o names a different instance, the port, the image, and the data folder of the file are of the instance before it. Thus these fields go, and only the values of o stay.
Types ¶
type Config ¶
type Config struct {
Instance string `json:"instance"`
Port int `json:"port"`
Image string `json:"image"`
DataDir string `json:"data_dir"`
}
Config is the content of config.json.
func Defaults ¶
func Defaults() Config
Defaults returns a Config with the default value in each field.