init project

This commit is contained in:
koh
2025-03-02 14:59:34 +07:00
commit e2a219cacd
35 changed files with 2269 additions and 0 deletions

48
global/global.go Normal file
View File

@@ -0,0 +1,48 @@
package global
import (
"go.uber.org/zap"
"gorm.io/gorm"
)
var (
Config Configuration
Logger *zap.Logger
Mdb *gorm.DB
)
// Configuration là cấu trúc chứa tất cả cấu hình ứng dụng
type Configuration struct {
Server ServerConfig
Database DatabaseConfig
Logger LoggerConfig
}
// ServerConfig chứa cấu hình liên quan đến server
type ServerConfig struct {
Port string
AppEnv string
}
// DatabaseConfig chứa cấu hình liên quan đến database
type DatabaseConfig struct {
Host string
Port string
Database string
Username string
Password string
RootPassword string
MaxIdleConns int
MaxOpenConns int
ConnMaxLifetime int
}
// LoggerConfig chứa cấu hình liên quan đến logger
type LoggerConfig struct {
LogLevel string
FileLogName string
MaxSize int
MaxBackups int
MaxAge int
Compress bool
}