Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server   ServerConfig   `yaml:"server"`
	Database DatabaseConfig `yaml:"database"`
}

Config 服务配置(仅保留启动必需项,其余动态配置存储在数据库 sora_settings 表)

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig 返回默认配置

func Load

func Load(path string) *Config

Load 从 YAML 文件加载配置

type DatabaseConfig

type DatabaseConfig struct {
	URL         string `yaml:"url"`          // PostgreSQL 连接串
	LogLevel    string `yaml:"log_level"`    // silent/error/warn/info
	AutoMigrate *bool  `yaml:"auto_migrate"` // 是否自动迁移表结构(默认 true)
}

DatabaseConfig 数据库配置

type ServerConfig

type ServerConfig struct {
	Host          string `yaml:"host"`
	Port          int    `yaml:"port"`
	AdminUser     string `yaml:"admin_user"`     // 管理员用户名
	AdminPassword string `yaml:"admin_password"` // 管理员密码
	JWTSecret     string `yaml:"jwt_secret"`     // JWT 签名密钥(可选,默认自动生成)
}

ServerConfig 服务端配置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL