Browse Source

etcd: export SetFlagsFromEnv

Brian Waldon 11 years ago
parent
commit
f7c353a703
2 changed files with 4 additions and 4 deletions
  1. 3 3
      main.go
  2. 1 1
      main_test.go

+ 3 - 3
main.go

@@ -95,7 +95,7 @@ func main() {
 	flag.Usage = pkg.UsageWithIgnoredFlagsFunc(flag.CommandLine, deprecated)
 	flag.Parse()
 
-	setFlagsFromEnv(flag.CommandLine)
+	SetFlagsFromEnv(flag.CommandLine)
 
 	if string(*proxyFlag) == proxyFlagValueOff {
 		startEtcd()
@@ -329,12 +329,12 @@ func (pf *ProxyFlag) String() string {
 	return string(*pf)
 }
 
-// setFlagsFromEnv parses all registered flags in the given flagset,
+// SetFlagsFromEnv parses all registered flags in the given flagset,
 // and if they are not already set it attempts to set their values from
 // environment variables. Environment variables take the name of the flag but
 // are UPPERCASE, have the prefix "ETCD_", and any dashes are replaced by
 // underscores - for example: some-flag => ETCD_SOME_FLAG
-func setFlagsFromEnv(fs *flag.FlagSet) {
+func SetFlagsFromEnv(fs *flag.FlagSet) {
 	alreadySet := make(map[string]bool)
 	fs.Visit(func(f *flag.Flag) {
 		alreadySet[f.Name] = true

+ 1 - 1
main_test.go

@@ -30,7 +30,7 @@ func TestSetFlagsFromEnv(t *testing.T) {
 	}
 
 	// now read the env and verify flags were updated as expected
-	setFlagsFromEnv(flag.CommandLine)
+	SetFlagsFromEnv(flag.CommandLine)
 	for f, want := range map[string]string{
 		"data-dir":       "/foo/bar",
 		"peer-bind-addr": "1.2.3.4",