Files
scroll/coordinator/internal/controller/api/controller.go
2023-08-05 08:27:07 +02:00

33 lines
720 B
Go

package api
import (
"sync"
"gorm.io/gorm"
"scroll-tech/coordinator/internal/config"
)
var (
// GetTask the prover task controller
GetTask *GetTaskController
// SubmitProof the submit proof controller
SubmitProof *SubmitProofController
// HealthCheck the health check controller
HealthCheck *HealthCheckController
// Auth the auth controller
Auth *AuthController
initControllerOnce sync.Once
)
// InitController inits Controller with database
func InitController(cfg *config.Config, db *gorm.DB) {
initControllerOnce.Do(func() {
Auth = NewAuthController(db)
HealthCheck = NewHealthCheckController()
GetTask = NewGetTaskController(cfg, db)
SubmitProof = NewSubmitProofController(cfg, db)
})
}