matrix-pretix/internal/config/config.go

31 lines
418 B
Go

package config
import (
"encoding/json"
"os"
)
type Config struct {
Matrix MatrixConfig
}
type MatrixConfig struct {
HomeserverURL string
UserIdentifier string
Password string
}
func ParseFromFile(path string) (config *Config, err error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, err
}
err = json.Unmarshal(data, config)
if err != nil {
return nil, err
}
return config, nil
}