0x2142 / frigate-notify

Event notifications for a standalone Frigate NVR instance
https://frigate-notify.0x2142.com/
MIT License
107 stars 9 forks source link

yaml: line 23: did not find expected key #106

Closed zombiehoffa closed 3 months ago

zombiehoffa commented 4 months ago

Describe the bug I followed the instructions for the config but no matter what I try I can't get it to load the config file with my ntfy server enabled. I kind of expect the problem to be me doing something boneheaded but I can't figure it out so I am posting here.

Expected behavior yaml doesn't fail to load config on a did not find expected key error and the software starts up and runs

To Reproduce start up frigate-notify with my config.yml

Versions:

Frigate-Notify Config:

frigate:
  server: http://frigatestable:5000
  ignoressl: true

  startup_check:
    attempts: 5
    interval: 30
  webapi:
    enabled: true
    interval: 30
alerts:
  general:
    title: Frigate Alert
    timeformat: Mon, 02 Jan 2006 15:04:05 MST
    nosnap: allow
  zones:
    unzoned: drop
    allow:
      - frontdoorpeops
  ntfy:
    enabled: true
    server: https://ntfy.mahserver.com
    topic: frigateyyc
    ignoressl: false
    headers:
      - Authorization: Bearer tk_ihwgccyeaqpe086fzra0ymg9z7ffe
    template: {{ .Camera }} spotted {{ .Label }}

This works if I comment out ntfy: and everything below.

Frigate-Notify Logs:

2024/07/14 08:33:15 -0600 DBG main.go:48 > Debug logging enabled
2024/07/14 08:33:15 -0600 INF main.go:51 > Frigate Notify - v0.3.2
2024/07/14 08:33:15 -0600 INF main.go:52 > Starting...
2024/07/14 08:33:15 -0600 DBG config/config.go:186 > Attempting to load config file: /app/config/config.yml
2024/07/14 08:33:15 -0600 FTL config/config.go:201 > Failed to load config from file! error="yaml: line 20: did not find expected key"

Additional context If I disable ntfy: and below it works. line 20 is ntfy: according to nano. I really do think I am just doing something wrong here but I've tried a whole bunch of stuff and I can't figure out what I am doing wrong so I am posting as a bug in case it is a bug with the ntfy code. Screenshots If applicable, add screenshots to help explain your problem.

zombiehoffa commented 4 months ago

This does appear to be a bug. template: can't appear to start with { otherwise it errors out and the error message was pretty useless because the problem wasn't line 23, it was serveral lines down.

freefd commented 4 months ago

Dear @zombiehoffa, could you try to define the pattern in the following notation?

alerts:
  ...
  ntfy:
    ...
    template: |
      {{ .Camera }} spotted {{ .Label }}
0x2142 commented 3 months ago

Just released v0.3.3, and I included a note in the docs to mention this. Using the multi-line format above works, or alternatively just quote the single-line template and that should be fine too