35 lines
657 B
Go
35 lines
657 B
Go
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
|
|
}
|