Skip to content

Commit

Permalink
refactor: config
Browse files Browse the repository at this point in the history
  • Loading branch information
acoshift committed Apr 12, 2019
1 parent 7e2eae3 commit 5a44624
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 7 additions & 0 deletions internal/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,10 @@ func RedisClient() *redis.Client {
func DBClient() *sql.DB {
return dbClient
}

func Close() {
dbClient.Close()
redisClient.Close()
storageClient.Close()
errorClient.Close()
}
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import (
)

func main() {
defer config.DBClient().Close()
defer config.RedisClient().Close()
defer config.Close()

app := app.New()

Expand Down

0 comments on commit 5a44624

Please sign in to comment.