Skip to content

Commit

Permalink
依存関係のバージョンアップ && NewRelicの削除
Browse files Browse the repository at this point in the history
  • Loading branch information
murasame29 committed May 15, 2024
1 parent 215cd15 commit c40a448
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions cmd/config/config.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
package config

import (
"github.com/caarlos0/env"
"fmt"

"github.com/caarlos0/env/v11"
"github.com/joho/godotenv"
)

func LoadEnv(path ...string) {
if path != nil {
func LoadEnv(path ...string) error {
if len(path) > 0 {
if err := godotenv.Load(path...); err != nil {
panic(err)
return fmt.Errorf("failed to load env: %w", err)
}
}

config := &config{}

if err := env.Parse(&config.Server); err != nil {
panic(err)
}

if err := env.Parse(&config.NewRelic); err != nil {
panic(err)
return err
}

// ... configに構造体を追加したら env.Parseする
Config = config

return nil
}

0 comments on commit c40a448

Please sign in to comment.