Merge pull request #882 from yuce/fix-dot-in-env

Fix dot in env
This commit is contained in:
Yuce Tekol 2017-10-12 15:02:15 +03:00 committed by GitHub
commit 2efec8e860
3 changed files with 14 additions and 14 deletions

View file

@ -91,7 +91,7 @@ func setAllConfig(v *viper.Viper, flags *pflag.FlagSet, envPrefix string) error
// add env to viper
v.SetEnvPrefix(envPrefix)
v.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
v.SetEnvKeyReplacer(strings.NewReplacer("-", "_", ".", "_"))
v.AutomaticEnv()
c := v.GetString("config")

View file

@ -45,7 +45,7 @@ func TestServerConfig(t *testing.T) {
// TEST 0
{
args: []string{"server", "--data-dir", actualDataDir, "--cluster.hosts", "example.com:10111,example.com:10110", "--bind", "example.com:10111"},
env: map[string]string{"PILOSA_DATA_DIR": "/tmp/myEnvDatadir", "PILOSA_CLUSTER.POLL_INTERVAL": "3m2s"},
env: map[string]string{"PILOSA_DATA_DIR": "/tmp/myEnvDatadir", "PILOSA_CLUSTER_POLL_INTERVAL": "3m2s"},
cfgFileContent: `
data-dir = "/tmp/myFileDatadir"
bind = "localhost:0"
@ -71,7 +71,7 @@ func TestServerConfig(t *testing.T) {
// TEST 1
{
args: []string{"server", "--anti-entropy.interval", "9m0s"},
env: map[string]string{"PILOSA_CLUSTER.HOSTS": "example.com:1110,example.com:1111", "PILOSA_BIND": "example.com:1110"},
env: map[string]string{"PILOSA_CLUSTER_HOSTS": "example.com:1110,example.com:1111", "PILOSA_BIND": "example.com:1110"},
cfgFileContent: `
bind = "localhost:0"
data-dir = "` + actualDataDir + `"
@ -94,7 +94,7 @@ func TestServerConfig(t *testing.T) {
// TEST 2
{
args: []string{"server", "--log-path", logFile.Name(), "--cluster.type", "static"},
env: map[string]string{"PILOSA_PROFILE.CPU_TIME": "1m"},
env: map[string]string{"PILOSA_PROFILE_CPU_TIME": "1m"},
cfgFileContent: `
bind = "localhost:19444"
data-dir = "` + actualDataDir + `"

View file

@ -46,7 +46,7 @@ Any flag that has a value that is a comma separated list on the command line bec
* Description: Interval at which the cluster will run its anti-entropy routine which makes sure that all replicas of each fragment are in sync.
* Flag: `--anti-entropy.interval="10m0s"`
* Env: `PILOSA_ANTI_ENTROPY.INTERVAL="10m0s"`
* Env: `PILOSA_ANTI_ENTROPY_INTERVAL="10m0s"`
* Config:
```toml
@ -102,7 +102,7 @@ Any flag that has a value that is a comma separated list on the command line bec
* Description: List of hosts in the cluster. Multiple hosts should be comma separated in the flag and env forms.
* Flag: `--cluster.hosts="localhost:10101"`
* Env: `PILOSA_CLUSTER.HOSTS="localhost:10101"`
* Env: `PILOSA_CLUSTER_HOSTS="localhost:10101"`
* Config:
```toml
@ -114,7 +114,7 @@ Any flag that has a value that is a comma separated list on the command line bec
* Description: Polling interval for cluster.
* Flag: `cluster.poll-interval="1m0s"`
* Env: `PILOSA_CLUSTER.POLL_INTERVAL="1m0s"`
* Env: `PILOSA_CLUSTER_POLL_INTERVAL="1m0s"`
* Config:
```toml
@ -126,7 +126,7 @@ Any flag that has a value that is a comma separated list on the command line bec
* Description: Number of hosts each piece of data should be stored on.
* Flag: `cluster.replicas=1`
* Env: `PILOSA_CLUSTER.REPLICAS=1`
* Env: `PILOSA_CLUSTER_REPLICAS=1`
* Config:
```toml
@ -141,7 +141,7 @@ Any flag that has a value that is a comma separated list on the command line bec
* http - Messages are transmitted over HTTP.
* gossip - Messages are transmitted over TCP. Cluster status and node state are kept in sync via internode gossip.
* Flag: `cluster.type="gossip"`
* Env: `PILOSA_CLUSTER.TYPE="gossip"`
* Env: `PILOSA_CLUSTER_TYPE="gossip"`
* Config:
```toml
@ -153,7 +153,7 @@ Any flag that has a value that is a comma separated list on the command line bec
* Description: If this is set to a path, collect a cpu profile and store it there.
* Flag: `--profile.cpu="/path/to/somewhere"`
* Env: `PILOSA_PROFILE.CPU="/path/to/somewhere"`
* Env: `PILOSA_PROFILE_CPU="/path/to/somewhere"`
* Config:
```toml
@ -165,7 +165,7 @@ Any flag that has a value that is a comma separated list on the command line bec
* Description: Amount of time to collect cpu profiling data if `profile.cpu` is set.
* Flag: `--profile.cpu-time="30s"`
* Env: `PILOSA_PROFILE.CPU_TIME="30s"
* Env: `PILOSA_PROFILE_CPU_TIME="30s"
* Config:
```toml
@ -175,7 +175,7 @@ Any flag that has a value that is a comma separated list on the command line bec
##### Metric Service
* Description: Which stats service to use (StatsD or ExpVar).
* Flag: `--metric.service=statsd`
* Env: `PILOSA_METRIC.SERVICE=statsd'
* Env: `PILOSA_METRIC_SERVICE=statsd'
* Config:
```toml
@ -186,7 +186,7 @@ Any flag that has a value that is a comma separated list on the command line bec
##### Metric Host
* Description: Address of the StatsD service host.
* Flag: `--metric.host=localhost:8125`
* Env: `PILOSA_METRIC.HOST=localhost:8125'
* Env: `PILOSA_METRIC_HOST=localhost:8125'
* Config:
```toml
@ -198,7 +198,7 @@ Any flag that has a value that is a comma separated list on the command line bec
* Description: Polling interval for runtime metrics.
* Flag: `metric.poll-interval=”0m15s”`
* Env: `PILOSA_METRIC.POLL_INTERVAL=0m15s`
* Env: `PILOSA_METRIC_POLL_INTERVAL=0m15s`
* Config:
```toml