Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed May 13, 2020
1 parent bcc1f69 commit 8afc282
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/service/database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package database
import (
"fmt"
"log"
"os"

"github.com/axetroy/go-server/internal/library/config"
"github.com/axetroy/go-server/internal/library/util"
Expand All @@ -24,6 +25,12 @@ func Dispose() {
}
}

func init() {
if os.Getenv("GO_TESTING") != "" {
Connect()
}
}

func Connect() {
DataSourceName := fmt.Sprintf("%s://%s:%s@%s:%s/%s?sslmode=disable", Config.Driver, Config.Username, Config.Password, Config.Host, Config.Port, Config.DatabaseName)

Expand Down
7 changes: 7 additions & 0 deletions internal/service/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package redis
import (
"github.com/axetroy/go-server/internal/library/config"
"github.com/go-redis/redis"
"os"
)

var (
Expand All @@ -16,6 +17,12 @@ var (
Config = config.Redis
)

func init() {
if os.Getenv("GO_TESTING") != "" {
Connect()
}
}

func Dispose() {
if Client != nil {
_ = Client.Close()
Expand Down

0 comments on commit 8afc282

Please sign in to comment.