Created
September 13, 2014 23:46
-
-
Save tmlbl/c325c7c94c8af1a1446e to your computer and use it in GitHub Desktop.
Basic implementation of fig syntax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Implements fig syntax. | |
package main | |
import ( | |
"gopkg.in/yaml.v1" | |
"io/ioutil" | |
"log" | |
) | |
var metaConfig MetaConfig | |
type MetaConfig map[string]MetaService | |
type MetaService struct { | |
Image string `yaml:"image"` | |
Build string `yaml:"build"` | |
Command string `yaml:"command"` | |
Links []string `yaml:"links"` | |
Ports []string `yaml:"ports"` | |
Expose []string `yaml:"expose"` | |
Volumes []string `yaml:"volumes"` | |
VolumesFrom []string `yaml:"volumes_from"` | |
} | |
func (mc *MetaConfig) Load() { | |
data, err := ioutil.ReadFile("./fig.yml") | |
if err != nil { | |
logErr(err) | |
} | |
yaml.Unmarshal(data, mc) | |
for _, svc := range *mc { | |
log.Println(svc.Image) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment