I want to add version info for the current config file, thus I can determine to use which config from different source, e.g. from file or some distributed config center, what I think first if it’s proper to add such info in caddy.Config if it is common for others, if it is not so common then I will extend the caddy to support this in a custom module.
type Info struct {
Version string `json:"version,omitempty"`
// ...
}
type Config struct {
Info *Info `json:"info,omitempty"`
Admin *AdminConfig `json:"admin,omitempty"`
Logging *Logging `json:"logging,omitempty"`
// StorageRaw is a storage module that defines how/where Caddy
// stores assets (such as TLS certificates). The default storage
// module is `caddy.storage.file_system` (the local file system),
// and the default path
// [depends on the OS and environment](/docs/conventions#data-directory).
StorageRaw json.RawMessage `json:"storage,omitempty" caddy:"namespace=caddy.storage inline_key=module"`
// AppsRaw are the apps that Caddy will load and run. The
// app module name is the key, and the app's config is the
// associated value.
AppsRaw ModuleMap `json:"apps,omitempty" caddy:"namespace="`
apps map[string]App
storage certmagic.Storage
cancelFunc context.CancelFunc
}