feat: 添加rabbitMQ

This commit is contained in:
Leon
2025-12-29 04:13:13 +08:00
parent 7daa95821d
commit 4225b026d7
5 changed files with 230 additions and 7 deletions

View File

@@ -9,6 +9,8 @@ import (
type Config struct {
Server ServerConfig `yaml:"server"`
Database DatabaseConfig `yaml:"database"`
Redis RedisConfig `yaml:"redis"`
RabbitMQ RabbitMQConfig `yaml:"rabbitmq"`
}
type ServerConfig struct {
@@ -23,6 +25,20 @@ type DatabaseConfig struct {
DBName string `yaml:"dbname"`
}
type RedisConfig struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
Password string `yaml:"password"`
DB int `yaml:"db"`
}
type RabbitMQConfig struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
Username string `yaml:"username"`
Password string `yaml:"password"`
}
func Load(filename string) (Config, error) {
data, err := ioutil.ReadFile(filename)
if err != nil {