forked from docker-flow/docker-flow-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.go
43 lines (37 loc) · 969 Bytes
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"./registry"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"os/exec"
"strings"
)
var readPidFile = ioutil.ReadFile
var readConfigsDir = ioutil.ReadDir
var readConfigsFile = ioutil.ReadFile
var readTemplateFile = ioutil.ReadFile
var cmdRunHa = func(cmd *exec.Cmd) error {
return cmd.Run()
}
var writeFile = ioutil.WriteFile
var readFile = ioutil.ReadFile
var writeFeTemplate = ioutil.WriteFile
var writeBeTemplate = ioutil.WriteFile
var osRemove = os.Remove
var httpListenAndServe = http.ListenAndServe
var httpWriterSetContentType = func(w http.ResponseWriter, value string) {
w.Header().Set("Content-Type", value)
}
var httpGet = http.Get
var logPrintf = log.Printf
type Executable interface {
Execute(args []string) error
}
func isSwarm(mode string) bool {
return strings.EqualFold(mode, "service") || strings.EqualFold(mode, "swarm")
}
var lookupHost = net.LookupHost
var registryInstance registry.Registrarable = registry.Consul{}