heetch / heetch/confita

Structured configuration support (path/dots)

Open
#82 0 comments 6 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
507
Forks
49
PR merge metrics
No merged PRs in 30d

Description

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:

```golang

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:

```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:

```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"
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with README.md and the existing configuration-loading behavior described there, then compare it with the nested Go Config example and the TOML/YAML samples in this issue. Done should mean the requested structured configuration can populate the shown fields, with a clear documented example for the supported formats.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.