mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-21 21:49:51 +01:00
be5148915f
* feat: add api_token to livestream jwt claim this will allow us to drop the postgres dependency soon * add continuous deployment for livestream
34 lines
783 B
Go
34 lines
783 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/fsnotify/fsnotify"
|
|
"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 {
|
|
panic(fmt.Errorf("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
|
|
}
|