34 lines
471 B
Go
34 lines
471 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
type ServerSettings struct {
|
||
|
URL string
|
||
|
Username string
|
||
|
Password string
|
||
|
}
|
||
|
|
||
|
type Settings struct {
|
||
|
EWS ServerSettings
|
||
|
CalDAV ServerSettings
|
||
|
Anonymize struct {
|
||
|
Title string
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func LoadSettings() Settings {
|
||
|
f, err := os.Open("calanonsync.json")
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
settings := Settings{}
|
||
|
err = json.NewDecoder(f).Decode(&settings)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
return settings
|
||
|
}
|