You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
497 B
Go

package main
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
type AppConfig struct {
DataFolder string `yaml:"data_folder"`
UserAddress string `yaml:"user"`
}
type Config struct {
Deltachat map[string]string `yaml:"deltachat"`
App AppConfig `yaml:"app"`
}
func ConfigFromFile(filePath string) (*Config, error) {
fileContents, err := ioutil.ReadFile(filePath)
if err != nil {
return nil, err
}
config := &Config{}
return config, yaml.Unmarshal(fileContents, config)
}