1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 22:32:14 +00:00

Refactor configuration to compose syntax

This commit is contained in:
Darren Shepherd
2015-03-29 02:57:15 -07:00
parent 38389b1f8e
commit c7ae14cc13
11 changed files with 535 additions and 344 deletions

View File

@@ -4,9 +4,12 @@ import (
"archive/tar"
"fmt"
"io"
"io/ioutil"
"math/rand"
"net/http"
"os"
"path"
"strings"
"syscall"
"github.com/docker/docker/pkg/mount"
@@ -182,3 +185,16 @@ func MergeMaps(left, right map[interface{}]interface{}) {
}
}
}
func LoadResource(location string) ([]byte, error) {
if strings.HasPrefix(location, "http:/") || strings.HasPrefix(location, "https:/") {
resp, err := http.Get(location)
if err != nil {
return nil, err
}
defer resp.Body.Close()
return ioutil.ReadAll(resp.Body)
} else {
return ioutil.ReadFile(location)
}
}