forked from Plemya-x/ALR
wip
This commit is contained in:
@ -28,6 +28,7 @@ import (
|
||||
"github.com/caarlos0/env"
|
||||
"github.com/pelletier/go-toml/v2"
|
||||
|
||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/constants"
|
||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
||||
)
|
||||
|
||||
@ -83,14 +84,9 @@ func mergeStructs(dst, src interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
systemConfigPath = "/etc/alr/alr.toml"
|
||||
systemCachePath = "/var/cache/alr"
|
||||
)
|
||||
|
||||
func (c *ALRConfig) Load() error {
|
||||
systemConfig, err := readConfig(
|
||||
systemConfigPath,
|
||||
constants.SystemConfigPath,
|
||||
)
|
||||
if err != nil {
|
||||
slog.Debug("Cannot read system config", "err", err)
|
||||
@ -108,8 +104,8 @@ func (c *ALRConfig) Load() error {
|
||||
c.cfg = config
|
||||
|
||||
c.paths = &Paths{}
|
||||
c.paths.UserConfigPath = systemConfigPath
|
||||
c.paths.CacheDir = systemCachePath
|
||||
c.paths.UserConfigPath = constants.SystemConfigPath
|
||||
c.paths.CacheDir = constants.SystemCachePath
|
||||
c.paths.RepoDir = filepath.Join(c.paths.CacheDir, "repo")
|
||||
c.paths.PkgsDir = filepath.Join(c.paths.CacheDir, "pkgs")
|
||||
c.paths.DBPath = filepath.Join(c.paths.CacheDir, "db")
|
||||
|
Reference in New Issue
Block a user