Skip to content

Commit

Permalink
update dsn connection
Browse files Browse the repository at this point in the history
  • Loading branch information
tcampbPPU committed Dec 21, 2023
1 parent 68afddc commit 3412c03
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"context"
"crypto/tls"
"fmt"
"log"
"net/http"

awsconfig "github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/credentials"
"github.com/fumeapp/tonic/setting"
Expand All @@ -12,19 +15,18 @@ import (
"gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"log"
"net/http"
)

var Db *gorm.DB
var Os *opensearch.Client

func DSN() string {
return fmt.Sprintf(
"%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local",
"%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=Local",
setting.Database.Username,
setting.Database.Password,
setting.Database.Host,
setting.Database.Port,
setting.Database.Database,
)
}
Expand Down

0 comments on commit 3412c03

Please sign in to comment.