Refactor: split in several files

This commit is contained in:
2026-06-04 17:30:54 +02:00
parent 062787d86b
commit 5f59ecf415
7 changed files with 201 additions and 136 deletions
+34
View File
@@ -0,0 +1,34 @@
package main
import (
"os"
"path/filepath"
"github.com/BurntSushi/toml"
)
const defaultDoctolibLimit = 5
type DoctorConfig struct {
Name string `toml:"name"`
MotiveId string `toml:"motive_id"`
AgendaId string `toml:"agenda_id"`
PracticeId string `toml:"practice_id"`
}
type Config struct {
NtfyChannel string `toml:"ntfy_channel"`
Doctors []DoctorConfig `toml:"doctor"`
}
func loadConfig(path string) (Config, error) {
var cfg Config
_, err := toml.DecodeFile(path, &cfg)
return cfg, err
}
func defaultConfigFile() string {
cwd, _ := os.Getwd()
configPath := filepath.Join(cwd, "config.toml")
return configPath
}