Skip to content

Commit

Permalink
Merge pull request #95 from 0x2142/main
Browse files Browse the repository at this point in the history
update from main
  • Loading branch information
0x2142 committed Jun 13, 2024
2 parents 33c14d7 + 9fe0d35 commit a78ac1e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git*
docs
screenshots
example-config.yml
docker-compose.yml
mkdocs.yml
README.md
6 changes: 3 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3.3.0
uses: sigstore/cosign-installer@v3.3.0
with:
cosign-release: 'v2.2.3'

Expand All @@ -42,13 +42,13 @@ jobs:

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand Down
25 changes: 18 additions & 7 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package config

import (
"encoding/json"
"errors"
"fmt"
"html/template"
"os"
Expand Down Expand Up @@ -149,7 +150,7 @@ type Ntfy struct {
Server string `fig:"server" default:""`
Topic string `fig:"topic" default:""`
Insecure bool `fig:"ignoressl" default:false`
Headers []map[string]string `fig:"headers"`
Headers []map[string]string `fig:"headers" default:[]`
Template string `fig:"template" default:""`
}

Expand Down Expand Up @@ -182,15 +183,25 @@ func LoadConfig(configFile string) {
}

// Load Config file
log.Debug().Msgf("Loading config file: %v", configFile)
log.Debug().Msgf("Attempting to load config file: %v", configFile)

err := fig.Load(&ConfigData, fig.File(filepath.Base(configFile)), fig.Dirs(filepath.Dir(configFile)), fig.UseEnv("FN"))
if err != nil {
log.Fatal().
Err(err).
Msg("Failed to load config file!")
if errors.Is(err, fig.ErrFileNotFound) {
log.Warn().Msg("Config file could not be read, attempting to load config from environment")
err = fig.Load(&ConfigData, fig.IgnoreFile(), fig.UseEnv("FN"))
if err != nil {
log.Fatal().
Err(err).
Msg("Failed to load config from environment!")
}
} else {
log.Fatal().
Err(err).
Msg("Failed to load config from file!")
}
}
log.Info().Msg("Config file loaded.")
log.Info().Msg("Config loaded.")

// Send config file to validation before completing
validateConfig()
Expand Down Expand Up @@ -238,7 +249,7 @@ func validateConfig() {
ConfigData.Frigate.StartupCheck.Interval = 30
}
for current_attempt < ConfigData.Frigate.StartupCheck.Attempts {
response, err = util.HTTPGet(statsAPI, ConfigData.Frigate.Insecure)
response, err = util.HTTPGet(statsAPI, ConfigData.Frigate.Insecure, ConfigData.Frigate.Headers...)
if err != nil {
log.Warn().
Err(err).
Expand Down

0 comments on commit a78ac1e

Please sign in to comment.