You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
439 B
31 lines
439 B
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"))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
cfg := Config{}
|
|
err = yaml.NewDecoder(f).Decode(&cfg)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &cfg, nil
|
|
}
|