@ -0,0 +1,31 @@
package main
import (
"gopkg.in/yaml.v2"
"os"
"path"
)
type Config struct {
Remote string `yaml:"remote"`
}
func loadConfig() (*Config, error) {
homedir, err := os.UserHomeDir()
if err != nil {
return nil, err
f, err := os.Open(path.Join(homedir, ".config/lucy.yaml"))
cfg := Config{}
err = yaml.NewDecoder(f).Decode(&cfg)
return &cfg, nil
@ -11,7 +11,13 @@ import (
func main() {
c := client.Client{APIRoot: "http://10.24.4.1:8000"}
cfg, err := loadConfig()
log.Println("Config at $HOME/.config/lucy.yaml failed:", err)
cfg = &Config{Remote: "http://localhost:8000"}
c := client.Client{APIRoot: cfg.Remote}
cmd := parseCommand(os.Args[1:])
switch cmd.Name {
@ -15,4 +15,5 @@ require (
github.com/pressly/goose v2.7.0+incompatible
golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
gopkg.in/yaml.v2 v2.2.8