Skip to content

Commit

Permalink
feat: added send text event env
Browse files Browse the repository at this point in the history
  • Loading branch information
OldTyT committed Dec 8, 2023
1 parent c6fd222 commit b140c9f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ docker compose up -d
| `TIME_WAIT_SAVE` | `30` | Wait for fully video event created(in seconds) |
| `WATCH_DOG_SLEEP_TIME` | `3` | Sleep watch dog goroutine seconds |
| `EVENT_BEFORE_SECONDS` | `300` | Send event before seconds |
| `SEND_TEXT_EVENT` | 'False' | Send text event without media |
2 changes: 2 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Config struct {
RedisTTL int
WatchDogSleepTime int
EventBeforeSeconds int
SendTextEvent bool
}

// New returns a new Config struct
Expand All @@ -42,6 +43,7 @@ func New() *Config {
RedisProtocol: getEnvAsInt("REDIS_PROTOCOL", 3),
RedisTTL: getEnvAsInt("REDIS_TTL", 1209600), // 7 days
EventBeforeSeconds: getEnvAsInt("EVENT_BEFORE_SECONDS", 300),
SendTextEvent: getEnvAsBool("SEND_TEXT_EVENT", false),
}
}

Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ func main() {

FrigateEventsURL := conf.FrigateURL + "/api/events"

go frigate.NotifyEvents(bot, FrigateEventsURL)
if conf.SendTextEvent {
go frigate.NotifyEvents(bot, FrigateEventsURL)
}
// Starting loop for getting events from Frigate
for true {

Check failure on line 90 in main.go

View workflow job for this annotation

GitHub Actions / Lint check

S1006: should use for {} instead of for true {} (gosimple)
FrigateEvents := frigate.GetEvents(FrigateEventsURL, bot, true)
Expand Down

0 comments on commit b140c9f

Please sign in to comment.