[feature] migrate to monorepo
Some checks failed
Build Backend / Build Docker Image (push) Successful in 3m33s
Test Backend / test (push) Failing after 31s

This commit is contained in:
CDN 2025-02-21 00:49:20 +08:00
commit 05ddc1f783
Signed by: CDN
GPG key ID: 0C656827F9F80080
267 changed files with 75165 additions and 0 deletions

View file

@ -0,0 +1,44 @@
package config
import (
"os"
"gopkg.in/yaml.v3"
)
type Config struct {
Database struct {
Driver string `yaml:"driver"`
DSN string `yaml:"dsn"`
} `yaml:"database"`
Server struct {
Port int `yaml:"port"`
Host string `yaml:"host"`
} `yaml:"server"`
JWT struct {
Secret string `yaml:"secret"`
Expiration string `yaml:"expiration"`
} `yaml:"jwt"`
Logging struct {
Level string `yaml:"level"`
Format string `yaml:"format"`
} `yaml:"logging"`
}
// Load loads the configuration from the specified file
func Load(path string) (*Config, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, err
}
var cfg Config
if err := yaml.Unmarshal(data, &cfg); err != nil {
return nil, err
}
return &cfg, nil
}