Skip to content

Commit

Permalink
Merge dev to main #10
Browse files Browse the repository at this point in the history
  • Loading branch information
xappyyy authored Jan 7, 2024
2 parents 17960f7 + bee70dd commit 1b21353
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.branches
.temp
.supabase
.github
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ config.yaml

# coverage report
coverage.out
coverage.html
coverage.html

/cert
1 change: 1 addition & 0 deletions src/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
4 changes: 4 additions & 0 deletions src/server/databases.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/server/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1b21353

Please sign in to comment.