fixed
This commit is contained in:
1 parent
4194cef934
commit
363127fe9e
3350 files changed
+1284220
-1
No files matched your search
Executable
+73
@@ -0,0 +1,73 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "bankline/docs"
|
||||
"bankline/internal/admin/auth"
|
||||
"bankline/internal/config"
|
||||
handlermanager "bankline/internal/handlers/manager"
|
||||
"bankline/pkg/client/postgresql"
|
||||
"bankline/pkg/logging"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
swaggerFiles "github.com/swaggo/files"
|
||||
ginSwagger "github.com/swaggo/gin-swagger"
|
||||
)
|
||||
|
||||
// @title Bank Service APIs
|
||||
// @version 1.0
|
||||
// @description Testing Swagger APIs.
|
||||
// @termsOfService http://swagger.io/terms/
|
||||
|
||||
// @contact.name API Support
|
||||
// @contact.url http://www.swagger.io/support
|
||||
|
||||
// @contact.email support@swagger.io
|
||||
// @license.name Apache 2.0
|
||||
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
// @host localhost:5050
|
||||
// @BasePath /v1
|
||||
|
||||
// @securityDefinitions.apikey BearerAuth
|
||||
// @in header
|
||||
// @name Authorization
|
||||
|
||||
// @tag.name auth
|
||||
// @tag.name admin
|
||||
// @tag.name categories
|
||||
// @tag.name sub-categories
|
||||
// @tag.name settings
|
||||
|
||||
// @Success 200 {object} appresult.AppSuccess "Success Code"
|
||||
// @Failure 400 {object} appresult.AppError "Error Code"
|
||||
// @schemes http
|
||||
func main() {
|
||||
|
||||
cfg := config.GetConfig()
|
||||
logger := logging.GetLogger()
|
||||
|
||||
postgresSQLClient := startPostgresql(cfg, logger)
|
||||
start(handlermanager.Manager(postgresSQLClient, logger), cfg)
|
||||
}
|
||||
|
||||
func startPostgresql(cfg *config.Config, logger *logging.Logger) *pgxpool.Pool {
|
||||
postgresSQLClient, err := postgresql.NewClient(context.TODO(), 3, cfg.Storage)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return postgresSQLClient
|
||||
}
|
||||
|
||||
func start(router *gin.Engine, cfg *config.Config) {
|
||||
logger := logging.GetLogger()
|
||||
logger.Info("start application")
|
||||
|
||||
ginSwagger.WrapHandler(swaggerFiles.Handler,
|
||||
ginSwagger.DefaultModelsExpandDepth(-1))
|
||||
router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||
router.GET("/images/:id", auth.GetObject)
|
||||
|
||||
router.Run(`:` + cfg.Listen.Port)
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user