Add cursor rules and initial configuration for Tender Management Go Backend

This commit is contained in:
n.nakhostin
2025-08-02 10:43:47 +03:30
parent ad9db7bcce
commit 5a1ceb0bd6
35 changed files with 4123 additions and 4550 deletions
+33
View File
@@ -0,0 +1,33 @@
package main
import (
"fmt"
"tm/infra"
"tm/pkg/logger"
)
// Init Application Configuration
func intiConfig() infra.Config {
config, err := infra.LoadConfig("./")
if err != nil {
panic(fmt.Sprintf("Failed to load config: %v", err))
}
return *config
}
// Init Logger Service
func initLogger(conf infra.LoggingConfig) logger.Logger {
return logger.NewLogger(&logger.Config{
Level: conf.Level,
Format: conf.Format,
Output: conf.Output,
File: logger.FileConfig{
Path: conf.File.Path,
MaxSize: conf.File.MaxSize,
MaxBackups: conf.File.MaxBackups,
MaxAge: conf.File.MaxAge,
Compress: conf.File.Compress,
},
})
}
+70
View File
@@ -0,0 +1,70 @@
server:
host: "0.0.0.0"
port: 8080
timeout: 30s
read_timeout: 10s
write_timeout: 10s
database:
mongodb:
uri: "mongodb://localhost:27017"
name: "tender_management"
timeout: 10s
max_pool_size: 100
cache:
redis:
host: "localhost"
port: 6379
password: ""
db: 0
pool_size: 10
queue:
rabbitmq:
url: "amqp://guest:guest@localhost:5672/"
exchange: "tender_exchange"
queues:
scraping: "scraping_queue"
processing: "processing_queue"
notifications: "notifications_queue"
search:
elasticsearch:
urls: ["http://localhost:9200"]
username: ""
password: ""
index_prefix: "tender_"
auth:
jwt:
secret: "your-super-secret-key"
access_token_duration: "24h"
refresh_token_duration: "168h" # 7 days
ai:
openai:
api_key: ""
model: "gpt-3.5-turbo"
max_tokens: 1000
scraping:
user_agent: "TenderBot/1.0"
timeout: 30s
max_retries: 3
delay_between_requests: 1s
logging:
level: "info"
format: "json"
output: "file" # stdout, stderr, file
file:
path: "./logs/app.log"
max_size: 100 # Max size in MB before rotation
max_backups: 5 # Number of backup files to keep
max_age: 30 # Max age in days to keep log files
compress: true # Compress rotated files
rate_limiting:
requests_per_minute: 100
burst: 20
+16
View File
@@ -0,0 +1,16 @@
package main
func main() {
conf := intiConfig()
logger := initLogger(conf.Logging)
defer logger.Sync()
logger.Info(
"Starting Tender Management API Server",
map[string]interface{}{
"version": "1.0.0",
"host": conf.Server.Host,
"port": conf.Server.Port,
})
}