Does confita support structured configuration? It would be useful to make configurations more clean/organized/structure, and for configurations of growing/large projects.
I have read the README.md, but there's no example for structure config,... And, I didn't find any TOML/YAML/JSON examples of structured configurations.
I would like to populate the following structure:
type Config struct {
// notifications configuration
Notifications struct {
// turns on user notifications for changes/updates/creations
Enabled bool
// from email address of emails
From string
// BCC addresses of every notification sent
BCC []string
}
// SMTP server/mail-sending configuration
SMTP struct {
// format server:port
ServerAddr string
// plain auth credentials
Username, Password string
// default email address to sent from
DefaultFrom string
}
}
For example, with TOML:
notifications.enabled = true
notifications.from = "info@mysite.com"
notifications.bcc = "notifications-bcc@mysite.com"
smtp.serveraddr = "smtp.gmail.com:587"
smtp.username = "info@mysite.com"
smtp.password = "secret"
smtp.defaultfrom = "contact@mysite.com"
Or, with YAML:
notifications:
- enabled: true
- from: "info@mysite.com"
- bcc: "notifications-bcc@mysite.com"
smtp:
- serveraddr: "smtp.gmail.com:587"
- username: "info@mysite.com"
- password: "secret"
- defaultfrom: "contact@mysite.com"
Does confita support structured configuration? It would be useful to make configurations more clean/organized/structure, and for configurations of growing/large projects.
I have read the README.md, but there's no example for structure config,... And, I didn't find any TOML/YAML/JSON examples of structured configurations.
I would like to populate the following structure:
For example, with TOML:
Or, with YAML: