Skip to content

Commit

Permalink
roll back tls nonsense and configure template path
Browse files Browse the repository at this point in the history
  • Loading branch information
waisbrot committed Dec 27, 2023
1 parent 0e66f56 commit 793427b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
10 changes: 2 additions & 8 deletions email/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import (
"bytes"
"html/template"
"io"
"os"
"path"
"time"

"github.com/spf13/viper"
"github.com/waisbrot/birdweather_daily_email/birdweather"
)

Expand All @@ -23,12 +22,7 @@ type StationTemplate struct {
}

func readTemplate() *template.Template {
exePath, err := os.Executable()
if err != nil {
panic(err)
}
execDir := path.Dir(exePath)
templateFile := path.Join(execDir, "countEmail.tmpl")
templateFile := viper.GetString("email.template")
template, err := template.New("countEmail.tmpl").ParseFiles(templateFile)
if err != nil {
panic(err)
Expand Down
1 change: 1 addition & 0 deletions example_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ email:
port: 123
user: [email protected]
pass: setecastronomy
template: /path/to/template
stations:
- 123
- 456
Expand Down
12 changes: 1 addition & 11 deletions metrics/influx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package metrics

import (
"context"
"crypto/tls"
"crypto/x509"
"time"

influxdb "github.com/influxdata/influxdb-client-go/v2"
Expand All @@ -17,16 +15,8 @@ var writeAPI influxapi.WriteAPIBlocking
var invokeTime time.Time

func initInflux() {
influxdb.DefaultOptions().AddDefaultTag("application", "birdweather_digest")
influxClient = influxdb.NewClient(viper.GetString("influx.url"), viper.GetString("influx.token"))
rootCas, err := x509.SystemCertPool()
if err != nil {
panic(err)
}
config := &tls.Config{
RootCAs: rootCas,
InsecureSkipVerify: true,
}
influxdb.DefaultOptions().AddDefaultTag("application", "birdweather_digest").SetTLSConfig(config)
writeAPI = influxClient.WriteAPIBlocking(viper.GetString("influx.org"), viper.GetString("influx.bucket"))
produceMetrics = true
}
Expand Down

0 comments on commit 793427b

Please sign in to comment.