add project first skeleton

This commit is contained in:
2025-11-28 20:12:45 +02:00
parent 9d8918558d
commit f1ed3c977a
8 changed files with 109 additions and 8 deletions

26
internal/config/config.go Normal file
View File

@@ -0,0 +1,26 @@
package config
import (
"github.com/akyaiy/GSfass/core/config"
)
type ServerConfig struct {
Port int `mapstructure:"port"`
Addr string `mapstructure:"address"`
}
type Config struct {
Server ServerConfig `mapstructure:"server"`
}
func LoadConfig(path string) (*Config, error) {
var cfg Config
err := config.Read().Config().FilePath(path).SetBy(&cfg).SetDefaults(map[string]any{
"server.port": 8080,
"server.address": "127.0.0.0",
}).End()
if err != nil {
return nil, err
}
return &cfg, nil
}