Skip to content

Commit

Permalink
feat: load env from file
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Dec 14, 2024
1 parent 1f8c521 commit 8bfa0b1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions node/cmd/dal/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,33 @@ package main

import (
"context"
"flag"

"bisonai.com/miko/node/pkg/dal"
"bisonai.com/miko/node/pkg/logscribeconsumer"
"github.com/joho/godotenv"
"github.com/rs/zerolog/log"
)

func LoadEnvFromFile() {
envFile := flag.String("env", "", "env file")
flag.Parse()

if *envFile != "" {
log.Info().Msgf("loading env file: %s", *envFile)
err := godotenv.Load(*envFile)
if err != nil {
panic(err)
}
}
}

func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

LoadEnvFromFile()

err := logscribeconsumer.Start(ctx, logscribeconsumer.WithStoreService("dal"))
if err != nil {
log.Error().Err(err).Msg("Failed to start logscribe consumer")
Expand Down

0 comments on commit 8bfa0b1

Please sign in to comment.