fix: issues

This commit is contained in:
Rogee
2024-09-04 13:50:11 +08:00
parent 9b136810bc
commit 4c41d899ba
3 changed files with 9 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
package config
import (
"path/filepath"
"github.com/pkg/errors"
"github.com/spf13/viper"
)
@@ -28,6 +30,10 @@ func (c *Config) GetMaxSize() uint {
}
func Load(path string) error {
path, err := filepath.Abs(path)
if err != nil {
return errors.Wrapf(err, "failed to get the absolute path of the config file %s", path)
}
// Load the config file
viper.SetConfigFile(path)
viper.AutomaticEnv()