ledo/app/modules/config/ledofile.go

35 lines
790 B
Go
Raw Normal View History

2021-10-21 00:51:32 +00:00
package config
import (
"gopkg.in/yaml.v3"
"io/ioutil"
)
type LedoFile struct {
2021-11-28 00:04:20 +00:00
Docker DockerMap `yaml:"docker,omitempty"`
Modes map[string]string `yaml:"modes,omitempty"`
Project string `yaml:"project,omitempty"`
2021-10-21 00:51:32 +00:00
}
type DockerMap struct {
Registry string `yaml:"registry,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Name string `yaml:"name,omitempty"`
MainService string `yaml:"main_service,omitempty"`
Shell string `yaml:"shell,omitempty"`
Username string `yaml:"username,omitempty"`
2021-10-21 00:51:32 +00:00
}
func NewLedoFile(s string) (*LedoFile, error) {
yamlFile, err := ioutil.ReadFile(s)
if err != nil {
return nil, err
}
t := &LedoFile{}
err = yaml.Unmarshal(yamlFile, t)
if err != nil {
return nil, err
}
return t, nil
}