mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-21 21:49:51 +01:00
37f7c8ec9a
* chore: add sentry to liveevents * Use `isProd` for `Debug` * Add a bunch of `CaptureException` calls * Properly bubble `getPGConn()` error * Fix `ParseIP` error handling * Remove unused `personFromDistinctId()` --------- Co-authored-by: Michael Matloka <dev@twixes.com> Co-authored-by: Michael Matloka <michal@matloka.com>
37 lines
848 B
Go
37 lines
848 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"strings"
|
|
|
|
"github.com/fsnotify/fsnotify"
|
|
"github.com/getsentry/sentry-go"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func loadConfigs() {
|
|
viper.SetConfigName("configs")
|
|
viper.AddConfigPath("configs/")
|
|
|
|
viper.SetDefault("kafka.group_id", "livestream")
|
|
viper.SetDefault("prod", false)
|
|
|
|
err := viper.ReadInConfig()
|
|
if err != nil {
|
|
sentry.CaptureException(err)
|
|
log.Fatalf("fatal error config file: %w", err)
|
|
}
|
|
|
|
viper.OnConfigChange(func(e fsnotify.Event) {
|
|
fmt.Println("Config file changed:", e.Name)
|
|
})
|
|
viper.WatchConfig()
|
|
|
|
viper.SetEnvPrefix("livestream") // will be uppercased automatically
|
|
replacer := strings.NewReplacer(".", "_")
|
|
viper.SetEnvKeyReplacer(replacer)
|
|
viper.BindEnv("jwt.secret") // read from LIVESTREAM_JWT_SECRET
|
|
viper.BindEnv("postgres.url") // read from LIVESTREAM_POSTGRES_URL
|
|
}
|