Cập nhật cấu hình môi trường production và development
- Thêm file .env.prod với cấu hình chi tiết cho môi trường production - Cập nhật docker-compose.dev.yml và docker-compose.prod.yml - Tạo Dockerfile.prod với cấu hình chi tiết cho production - Bổ sung cấu hình nginx, prometheus, grafana - Thêm cấu hình backup và monitoring - Cập nhật README với hướng dẫn chi tiết
This commit is contained in:
@@ -3,11 +3,9 @@ package initialize
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/dungnt11/senflow_app/global"
|
||||
"github.com/fatih/color"
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
@@ -63,57 +61,5 @@ func LoadConfig() error {
|
||||
global.Config.Logger.Compress = strings.ToLower(compress) == "true"
|
||||
}
|
||||
|
||||
printConfig()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func printConfig() {
|
||||
// Tạo các đối tượng màu sắc
|
||||
titleColor := color.New(color.FgHiCyan, color.Bold)
|
||||
sectionColor := color.New(color.FgHiYellow, color.Bold)
|
||||
keyColor := color.New(color.FgHiGreen)
|
||||
valueColor := color.New(color.FgHiWhite)
|
||||
|
||||
fmt.Println() // Thêm dòng trống ở đầu
|
||||
|
||||
// In tiêu đề
|
||||
titleColor.Println("✨✨✨ CẤU HÌNH ỨNG DỤNG ✨✨✨")
|
||||
fmt.Println()
|
||||
|
||||
// Sử dụng reflection để tự động in tất cả các cấu hình
|
||||
configValue := reflect.ValueOf(global.Config)
|
||||
configType := configValue.Type()
|
||||
|
||||
// Duyệt qua tất cả các trường của cấu hình
|
||||
for i := 0; i < configValue.NumField(); i++ {
|
||||
sectionName := configType.Field(i).Name
|
||||
sectionValue := configValue.Field(i)
|
||||
sectionType := sectionValue.Type()
|
||||
|
||||
// In tên section
|
||||
sectionColor.Printf("[%s]\n", strings.ToUpper(sectionName))
|
||||
|
||||
// Duyệt qua tất cả các trường của section
|
||||
for j := 0; j < sectionValue.NumField(); j++ {
|
||||
fieldName := sectionType.Field(j).Name
|
||||
fieldValue := sectionValue.Field(j).Interface()
|
||||
|
||||
// Ẩn mật khẩu
|
||||
displayValue := fmt.Sprintf("%v", fieldValue)
|
||||
if strings.Contains(strings.ToLower(fieldName), "password") {
|
||||
displayValue = "******** (ẩn)"
|
||||
}
|
||||
|
||||
// In tên trường và giá trị
|
||||
keyColor.Printf(" %-15s: ", fieldName)
|
||||
valueColor.Printf("%s\n", displayValue)
|
||||
}
|
||||
|
||||
fmt.Println() // Thêm dòng trống giữa các section
|
||||
}
|
||||
|
||||
// In thông báo thành công
|
||||
titleColor.Println("✅ Cấu hình đã được tải thành công!")
|
||||
fmt.Println() // Thêm dòng trống ở cuối
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user