Files
accounting/config.go
2025-08-24 14:23:51 +02:00

37 lines
955 B
Go

package main
import (
"encoding/json"
"os"
"git.schreifuchs.ch/lou-taylor/accounting/mailer"
"git.schreifuchs.ch/lou-taylor/accounting/model"
)
type Config struct {
GiteaURL string `json:"gitea_url"`
GiteaToken string `json:"gitea_token"`
Repos []Repo `json:"repos"`
MinDuration Duration `json:"min_duration"`
Hourly float64 `json:"hourly"`
FromEntity model.Entity `json:"from_entity"`
ToEntity model.Entity `json:"to_entity"`
PdfGeneratorURL string `json:"pdf_generator_url"`
Mailer mailer.Config `json:"mailer"`
Mail mailer.Mail `json:"mail"`
MailBcc []string `json:"mail_bcc"`
}
func LoadConfig(path string) (Config, error) {
var cfg Config
file, err := os.Open(path)
if err != nil {
return cfg, err
}
defer file.Close()
decoder := json.NewDecoder(file)
err = decoder.Decode(&cfg)
return cfg, err
}