diff --git a/.dockerignore b/.dockerignore index 4524703..635b5bc 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,2 @@ -.branches -.temp \ No newline at end of file +.supabase +.github \ No newline at end of file diff --git a/.gitignore b/.gitignore index c0811e5..34a8c65 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ config.yaml # coverage report coverage.out -coverage.html \ No newline at end of file +coverage.html + +/cert \ No newline at end of file diff --git a/src/config/config.go b/src/config/config.go index adfeb93..180a92f 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -13,6 +13,7 @@ type SupabaseConfig struct { DBName string `mapstructure:"dbname"` Port string `mapstructure:"port"` SSLMode string `mapstructure:"sslmode"` + SSLRoot string `mapstructure:"sslroot"` Schema string `mapstructure:"schema"` } diff --git a/src/server/databases.go b/src/server/databases.go index f19cdcb..f064266 100644 --- a/src/server/databases.go +++ b/src/server/databases.go @@ -19,6 +19,10 @@ func LoadSupabase(config config.SupabaseConfig) *gorm.DB { config.SSLMode, ) + if config.SSLMode != "disable" { + dsn += fmt.Sprintf(" sslrootcert=%s", config.SSLRoot) + } + db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{TranslateError: true}) if err != nil { fmt.Printf("Error connecting to the database: %v\n", err) diff --git a/src/server/routes.go b/src/server/routes.go index de1b8e4..f720637 100644 --- a/src/server/routes.go +++ b/src/server/routes.go @@ -19,6 +19,11 @@ func loadRoutes(db *gorm.DB, cfg config.GoogleConfig) *gin.Engine { corsConfig.AllowCredentials = true corsConfig.AllowAllOrigins = true g.Use(cors.New(corsConfig)) + g.GET("/", func(ctx *gin.Context) { + ctx.JSON(200, gin.H{ + "message": "test", + }) + }) userRoutes := g.Group("/user") userRoutes.Use(Validation(cfg)) loadUserRoutes(userRoutes, db)