From 1ed4e2cb54abe17c828ced066f764c7db13f91c4 Mon Sep 17 00:00:00 2001 From: Aditya Bisht Date: Sun, 30 Jul 2023 22:09:54 +0530 Subject: [PATCH] Minor fixes --- configs/parser.go | 2 -- lib/mongo/connection.go | 2 +- lib/mysql/connection.go | 2 +- lib/mysql/create.go | 6 +++--- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/configs/parser.go b/configs/parser.go index ce8681a5..d6db77db 100644 --- a/configs/parser.go +++ b/configs/parser.go @@ -27,8 +27,6 @@ var ( ClusterConfig = KatanaConfig.Cluster - ChallengeDeployerConfig = ServicesConfig.ChallengeDeployer - SSHProviderConfig = ServicesConfig.SSHProvider AdminConfig = KatanaConfig.AdminConfig diff --git a/lib/mongo/connection.go b/lib/mongo/connection.go index 7499aa63..5be5a6d8 100644 --- a/lib/mongo/connection.go +++ b/lib/mongo/connection.go @@ -15,7 +15,7 @@ import ( ) var ctx, _ = context.WithTimeout(context.Background(), time.Duration(g.KatanaConfig.TimeOut)*time.Second) -var client, err = mongo.Connect(ctx, options.Client().ApplyURI("mongodb://"+configs.MongoConfig.Username+":"+configs.MongoConfig.Password+"@"+configs.ServicesConfig.ChallengeDeployer.Host+":"+configs.MongoConfig.Port+"/?directConnection=true&appName=mongosh+"+configs.MongoConfig.Version)) +var client, err = mongo.Connect(ctx, options.Client().ApplyURI("mongodb://"+configs.MongoConfig.Username+":"+configs.MongoConfig.Password+"@mongo."+configs.KatanaConfig.IngressHost+":"+configs.MongoConfig.Port+"/?directConnection=true&appName=mongosh+"+configs.MongoConfig.Version)) var link = client.Database(projectDatabase) func setupAdmin() { diff --git a/lib/mysql/connection.go b/lib/mysql/connection.go index d59288e3..5e7ae210 100644 --- a/lib/mysql/connection.go +++ b/lib/mysql/connection.go @@ -13,7 +13,7 @@ import ( var db *sql.DB func setup() { - database, err := sql.Open("mysql", configs.MySQLConfig.Username+":"+configs.MySQLConfig.Password+"@tcp("+configs.ServicesConfig.ChallengeDeployer.Host+":"+configs.MySQLConfig.Port+")/mysql") + database, err := sql.Open("mysql", configs.MySQLConfig.Username+":"+configs.MySQLConfig.Password+"@tcp(mysql."+configs.KatanaConfig.IngressHost+":"+configs.MySQLConfig.Port+")/mysql") if err != nil { panic(err.Error()) } diff --git a/lib/mysql/create.go b/lib/mysql/create.go index 89c15c68..7c818464 100644 --- a/lib/mysql/create.go +++ b/lib/mysql/create.go @@ -23,7 +23,7 @@ func CreateDatabase(database string) error { func CreateGogsUser(username, password string) error { // Get time in unix format and convert it to string - gogs, err := sql.Open("mysql", configs.MySQLConfig.Username+":"+configs.MySQLConfig.Password+"@tcp("+configs.ServicesConfig.ChallengeDeployer.Host+":"+configs.MySQLConfig.Port+")/gogs") + gogs, err := sql.Open("mysql", configs.MySQLConfig.Username+":"+configs.MySQLConfig.Password+"@tcp(mysql."+configs.KatanaConfig.IngressHost+":"+configs.MySQLConfig.Port+")/gogs") if err != nil { return err } @@ -64,7 +64,7 @@ func CreateGogsUser(username, password string) error { func CreateGogsAdmin(username, password string) error { // Get time in unix format and convert it to string - gogs, err := sql.Open("mysql", configs.MySQLConfig.Username+":"+configs.MySQLConfig.Password+"@tcp("+configs.ServicesConfig.ChallengeDeployer.Host+":"+configs.MySQLConfig.Port+")/gogs") + gogs, err := sql.Open("mysql", configs.MySQLConfig.Username+":"+configs.MySQLConfig.Password+"@tcp(mysql."+configs.KatanaConfig.IngressHost+":"+configs.MySQLConfig.Port+")/gogs") if err != nil { return err } @@ -117,7 +117,7 @@ func CreateGogsAdmin(username, password string) error { } func CreateAccessToken(username, token string) error { - gogs, err := sql.Open("mysql", configs.MySQLConfig.Username+":"+configs.MySQLConfig.Password+"@tcp("+configs.ServicesConfig.ChallengeDeployer.Host+":"+configs.MySQLConfig.Port+")/gogs") + gogs, err := sql.Open("mysql", configs.MySQLConfig.Username+":"+configs.MySQLConfig.Password+"@tcp(mysql."+configs.KatanaConfig.IngressHost+":"+configs.MySQLConfig.Port+")/gogs") if err != nil { return err }