diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d344ba6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.json diff --git a/config.example.json b/config.example.json new file mode 100644 index 0000000..42d411d --- /dev/null +++ b/config.example.json @@ -0,0 +1,60 @@ +{ + "gitea_url": "https://git.schreifuchs.ch", + "gitea_token": "", + "repos": [ + { + "owner": "lou-taylor", + "repo": "lou-taylor-web" + }, + { + "owner": "lou-taylor", + "repo": "lou-taylor-api" + }, + { + "owner": "lou-taylor", + "repo": "accounting" + } + ], + "min_duration": "15m", + "hourly": 16, + "from_entity": { + "name": "schreifuchs.ch", + "iban": "", + "address": { + "street": "", + "number": "", + "zip_code": "", + "place": "", + "country": "" + }, + "contact": "" + }, + "to_entity": { + "name": "", + "address": { + "street": "", + "number": "", + "zip_code": "", + "place": "", + "country": "" + }, + "contact": "Loana Groux" + }, + "pdf_generator_url": "http://localhost:3030", + "mailer": { + "smtp": { + "host": "mail.your-server.de", + "port": "465", + "user": "", + "password": "" + }, + "from": "" + }, + "mail": { + "to": "", + "subject": "", + "body": "" + }, + "mail_bcc": [""] +} + diff --git a/config.go b/config.go new file mode 100644 index 0000000..dd0dabc --- /dev/null +++ b/config.go @@ -0,0 +1,36 @@ +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 +} + diff --git a/go.mod b/go.mod index ed621c4..5755f58 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( code.gitea.io/sdk/gitea v0.21.0 github.com/gomarkdown/markdown v0.0.0-20250810172220-2e2c11897d1a github.com/jedib0t/go-pretty/v6 v6.6.8 + github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/starwalkn/gotenberg-go-client/v8 v8.11.0 ) @@ -15,11 +16,9 @@ require ( github.com/davidmz/go-pageant v1.0.2 // indirect github.com/go-fed/httpsig v1.1.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect - github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/rivo/uniseg v0.4.7 // indirect golang.org/x/crypto v0.41.0 // indirect golang.org/x/sys v0.35.0 // indirect golang.org/x/text v0.28.0 // indirect - gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect ) diff --git a/go.sum b/go.sum index fb3b102..d254de0 100644 --- a/go.sum +++ b/go.sum @@ -49,9 +49,5 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= -gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= -gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE= -gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/index.html b/index.html index a492e7c..3d3a366 100644 --- a/index.html +++ b/index.html @@ -216,7 +216,7 @@ article {
Kilchbergerweg 1
- 3052 Zollikofen
+ Zollikofen
Niklas Breitenstein
- Rechnung: 20 25082 41057 10271 08692 82635
+ Rechnung: 20 25082 41117 00284 67114 43342
Datum: 24.08.2025
Lou Taylor
Alpenstrasse 22
- 4950 Huttwil
+ Huttwil
Loana Groux
20 25082 41057 10271 08692 82635
+20 25082 41117 00284 67114 43342
Lou Taylor
Alpenstrasse 22
- 4950 Huttwil
+ Huttwil
20 25082 41057 10271 08692 82635
+20 25082 41117 00284 67114 43342
Lou Taylor
Alpenstrasse 22
- 4950 Huttwil
+ Huttwil