1
0

feat: support changing dotdir

This commit is contained in:
dump_stack() 2023-05-13 15:45:21 +00:00
parent 804b6b56ba
commit 9d1bbcc288
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -7,7 +7,6 @@ package config
import (
"errors"
"os"
"os/user"
"time"
"github.com/alecthomas/kong"
@ -21,6 +20,9 @@ type DockerCommand struct {
}
type OutOfTree struct {
// Directory for all files if not explicitly specified
Directory string
Kernels string
UserKernels string
@ -77,21 +79,20 @@ func ReadOutOfTreeConf(path string) (c OutOfTree, err error) {
err = nil
}
usr, err := user.Current()
if err != nil {
return
if c.Directory != "" {
Directory = c.Directory
}
if c.Kernels == "" {
c.Kernels = usr.HomeDir + "/.out-of-tree/kernels.toml"
c.Kernels = File("kernels.toml")
}
if c.UserKernels == "" {
c.UserKernels = usr.HomeDir + "/.out-of-tree/kernels.user.toml"
c.Kernels = File("kernels.user.toml")
}
if c.Database == "" {
c.Database = usr.HomeDir + "/.out-of-tree/db.sqlite"
c.Kernels = File("db.sqlite")
}
if c.Qemu.Timeout.Duration == 0 {