51 lines
1001 B
Go
51 lines
1001 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
const TaskQueueCallbackName = "task_queue_callback"
|
|
const TaskQueueName = "task_queue"
|
|
const AmqpServerURL = "amqp://guest:guest@localhost:5672/"
|
|
const AmqpServerKey = "AMQP_SERVER_URL"
|
|
|
|
type MessageCode struct {
|
|
IdUser string `json:"id_user"`
|
|
IdTask string `json:"id_task"`
|
|
Code string `json:"code"`
|
|
Unit_test string `json:"unit_test"`
|
|
Tp_lang string `json:"tp_lang"`
|
|
|
|
}
|
|
|
|
type SuccessResponse struct {
|
|
Success bool `json:"success"`
|
|
Message string `json:"message"`
|
|
Queue string `json:"queue"`
|
|
}
|
|
|
|
const (
|
|
dbHost = "localhost"
|
|
dbPort = 5432
|
|
dbUser = "code_ru"
|
|
dbPassword = "code_ru"
|
|
dbName = "code_ru"
|
|
)
|
|
|
|
const (
|
|
RedisHost = "localhost:6379"
|
|
RedisPass = "5432"
|
|
RedisDb = 0
|
|
)
|
|
|
|
var (
|
|
JWTSecretKey = "your-very-secret-key"
|
|
JWTExpiration = 24 * time.Hour
|
|
)
|
|
|
|
func GetDSN() string {
|
|
return fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable",
|
|
dbHost, dbPort, dbUser, dbPassword, dbName)
|
|
}
|