initial commit
This commit is contained in:
33
app/modules/config/ledofile.go
Normal file
33
app/modules/config/ledofile.go
Normal file
@ -0,0 +1,33 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"gopkg.in/yaml.v3"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
type LedoFile struct {
|
||||
Docker DockerMap `yaml:"docker,omitempty"`
|
||||
Modes map[string]string `yaml:"modes,omitempty"`
|
||||
Project string `yaml:"project,omitempty"`
|
||||
}
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user