Skip to content

Commit

Permalink
fixed staging logic and test
Browse files Browse the repository at this point in the history
  • Loading branch information
myleshorton committed May 24, 2016
1 parent 4fe5efb commit 77e6498
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/github.com/getlantern/flashlight/config/config.go
Expand Up @@ -230,9 +230,15 @@ func (updated *Config) applyFlags(flags map[string]interface{}) error {
case "memprofile":
updated.MemProfile = value.(string)
case "staging":
log.Debug("Configuring for staging")
updated.CloudConfig = "http://config-staging.getiantem.org/cloud.yaml.gz"
updated.FrontedCloudConfig = "http://d33pfmbpauhmvd.cloudfront.net/cloud.yaml.gz"
log.Debugf("Staging variable: %v", value)
stage := value.(bool)
if stage {
log.Debug("Configuring for staging")
updated.CloudConfig = "http://config-staging.getiantem.org/cloud.yaml.gz"
updated.FrontedCloudConfig = "http://d33pfmbpauhmvd.cloudfront.net/cloud.yaml.gz"
} else {
log.Debug("Not configuring for staging")
}
}
}
if visitErr != nil {
Expand Down
11 changes: 10 additions & 1 deletion src/github.com/getlantern/flashlight/config/config_test.go
@@ -1,6 +1,8 @@
package config

import (
"io/ioutil"
"os"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -9,11 +11,18 @@ import (
// TestStagingSetup tests to make sure our staging config flag sets the
// appropriate URLs for staging servers.
func TestStagingSetup(t *testing.T) {
configDir, errr := ioutil.TempDir("", "config-testing")
if errr != nil {
log.Fatal(errr)
}

defer os.RemoveAll(configDir)

userConfig := &userConfig{}
version := "test-version"
flagsAsMap := make(map[string]interface{})
flagsAsMap["staging"] = false

configDir := ""
stickyConfig := false
var cfg *Config
var err error
Expand Down

0 comments on commit 77e6498

Please sign in to comment.