feat($ip): Substitute $[public|private]_ipv4 in whole user-data

This commit is contained in:
Brian Waldon
2014-03-21 10:35:18 -07:00
parent 568714cadb
commit ddd035aaa7
8 changed files with 67 additions and 57 deletions

View File

@@ -3,7 +3,6 @@ package initialize
import (
"errors"
"fmt"
"os"
"path"
"strings"
@@ -32,20 +31,9 @@ func (ec EtcdEnvironment) String() (out string) {
}
}
public := os.Getenv("COREOS_PUBLIC_IPV4")
private := os.Getenv("COREOS_PRIVATE_IPV4")
out += "[Service]\n"
for key, val := range norm {
if public != "" {
val = strings.Replace(val, "$public_ipv4", public, -1)
}
if private != "" {
val = strings.Replace(val, "$private_ipv4", private, -1)
}
out += fmt.Sprintf("Environment=\"ETCD_%s=%s\"\n", key, val)
}