start: rename config for split agent and futur intel

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2025-12-13 00:25:44 +01:00
commit c7bb3b353f
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
2 changed files with 7 additions and 6 deletions

View file

@ -0,0 +1,30 @@
package configuration
import (
"github.com/spf13/viper"
)
type Config struct {
Database struct {
Path string `mapstructure:"path"`
} `mapstructure:"database"`
}
func LoadConfig(path string) (*Config, error) {
v := viper.New()
v.SetConfigFile(path)
v.SetConfigType("yaml")
v.SetDefault("database.path", "./data/")
if err := v.ReadInConfig(); err != nil {
return nil, err
}
var cfg Config
if err := v.Unmarshal(&cfg); err != nil {
return nil, err
}
return &cfg, nil
}