Documentation
¶
Overview ¶
Package configmigrate provides a way to upgrade the YAML configuration file.
Index ¶
Constants ¶
View Source
const LastSchemaVersion uint = 31
LastSchemaVersion is the most recent schema version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Logger is used to log the operation of configuration migrator. It must
// not be nil.
Logger *slog.Logger
// WorkingDir is the absolute path to the working directory of AdGuardHome.
WorkingDir string
// DataDir is the absolute path to the data directory of AdGuardHome.
DataDir string
}
Config is a the configuration for initializing a Migrator.
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator performs the YAML configuration file migrations.
func (*Migrator) Migrate ¶
func (m *Migrator) Migrate( ctx context.Context, body []byte, target uint, ) (newBody []byte, upgraded bool, err error)
Migrate preforms necessary upgrade operations to upgrade file to target schema version, if needed. It returns the body of the upgraded config file, whether the file was upgraded, and an error, if any. If upgraded is false, the body is the same as the input.
Click to show internal directories.
Click to hide internal directories.