Closed frereit closed 9 months ago
Yes, I can reproduce this bug. The existing Trace logs also show this issue, both for the config and for the dbRule.
time="2024-02-13T12:46:01Z" level=info msg="calendar view request" client="172.18.0.1:38090" profile=TINF21CS1
time="2024-02-13T12:46:01Z" level=debug msg="Exec'dSELECT EXISTS (SELECT * FROM profile WHERE name = TINF21CS1)"
time="2024-02-13T12:46:01Z" level=trace msg="true\n"
time="2024-02-13T12:46:01Z" level=trace msg="[]main.dbRule{main.dbRule{Id:1, Operator:\"\", ActionType:\"delete\", ActionParameters:\"{}\", Expiry:<nil>}}\n"
time="2024-02-13T12:46:01Z" level=trace msg="[]main.Rule{main.Rule{Filters:[]map[string]string{map[string]string{\"regex\":\"testentry\", \"target\":\"summary\", \"type\":\"regex\"}}, Operator:\"\", Action:map[string]string{\"type\":\"delete\"}, Expiry:\"\"}}\n"
In the initial unmarshal of the config file, its seems to be represented correctly:
Rules:[
{Filters:[map[regex:testentry target:summary type:regex]
map[regex:testentry2 target:description type:regex]
]
Operator: Action:map[type:delete] Expiry:}]}
Maybe the import to the db is faulty? It does seem to throw an error
time="2024-02-13T12:45:30Z" level=debug msg="Connecting to db using postgresql://dbuser:password@postgres/ical_relay?sslmode=disable"
time="2024-02-13T12:45:30Z" level=debug msg="Connected to db"
time="2024-02-13T12:45:30Z" level=info msg="Initially creating tables..."
time="2024-02-13T12:45:30Z" level=info msg="DB is now at version 4"
time="2024-02-13T12:45:30Z" level=trace msg="sqlx.DB{DB:(*sql.DB)(0xc00007f380), driverName:\"postgres\", unsafe:false, Mapper:(*reflectx.Mapper)(0xc000025f50)}"
time="2024-02-13T12:45:30Z" level=debug msg="Importing profile TINF21CS1"
time="2024-02-13T12:45:30Z" level=trace msg="rule not found with pN:'TINF21CS1' rOp:' 'aT:'delete' aP:{} rE:''"
time="2024-02-13T12:45:30Z" level=debug msg="Adding rule delete"
@robske110 do you have an idea where this could come from?
The import code looks fine to me.
issue also persists in #230 and #235 branches
Das scheint schon in der Datenbank anzukommen und auch der regel zugeordnet zu sein
This might be a user error but I am trying to create a simple profile with a single rule with multiple filters:
I added the following debug logging to the
calendarViewHandler
inhandlers.go
L192:Starting the server and accessing the calender gives the following log:
It seems like only the first filter was loaded into the Rules struct? I started the binary with a clean database and ran
./relay --import-data
.