add logtr.sosf for sos straight to specific matrix
This commit is contained in:
@@ -10,10 +10,21 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Matrix struct {
|
||||
ReceiveEnabled bool
|
||||
Mock bool
|
||||
Homeserver string
|
||||
Username string
|
||||
Token string
|
||||
Device string
|
||||
Room string
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Log struct {
|
||||
Path string
|
||||
Level logtr.Level
|
||||
Path string
|
||||
Level logtr.Level
|
||||
SOSMatrix Matrix
|
||||
}
|
||||
Interval struct {
|
||||
Input Duration
|
||||
@@ -49,15 +60,7 @@ type Config struct {
|
||||
Clients map[string]Client
|
||||
Storage []string
|
||||
Message struct {
|
||||
Matrix struct {
|
||||
ReceiveEnabled bool
|
||||
Mock bool
|
||||
Homeserver string
|
||||
Username string
|
||||
Token string
|
||||
Device string
|
||||
Room string
|
||||
}
|
||||
Matrix Matrix
|
||||
}
|
||||
Once bool
|
||||
Brokers struct {
|
||||
@@ -117,7 +120,7 @@ func AllStates() []State {
|
||||
return states
|
||||
}
|
||||
|
||||
func Refresh() error {
|
||||
func Refresh(soser func() logtr.SOSer) error {
|
||||
b, err := ioutil.ReadFile(configPath())
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -132,6 +135,9 @@ func Refresh() error {
|
||||
live.db.Close()
|
||||
}
|
||||
live = c
|
||||
if soser != nil {
|
||||
logtr.SetSOSer(soser())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -145,7 +151,7 @@ func Set(other Config) {
|
||||
return
|
||||
}
|
||||
ioutil.WriteFile(configPath(), b, os.ModePerm)
|
||||
Refresh()
|
||||
Refresh(nil)
|
||||
}
|
||||
|
||||
func (c *Config) DB() storage.DB {
|
||||
|
||||
Reference in New Issue
Block a user