blob: 65d1a71ca8d567a3c3527f84a9862c19c99ac0f9 (
plain) (
tree)
|
|
package config
import (
"fmt"
"os"
"gopkg.in/yaml.v3"
)
type Config struct {
Git struct {
ScanPath string `yaml:"scanPath"`
Readme []string `yaml:"readme"`
} `yaml:"git"`
Template struct {
Dir string `yaml:"dir"`
} `yaml:"template"`
Meta struct {
Title string `yaml:"title"`
Description string `yaml:"description"`
} `yaml:"meta"`
}
func Read(f string) (*Config, error) {
b, err := os.ReadFile(f)
if err != nil {
return nil, fmt.Errorf("reading config: %w", err)
}
c := Config{}
if err := yaml.Unmarshal(b, &c); err != nil {
return nil, fmt.Errorf("parsing config: %w", err)
}
return &c, nil
}
|