2017-11-02 22:37:27 +00:00
|
|
|
package config_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
2018-02-13 16:31:57 +00:00
|
|
|
"github.com/spf13/viper"
|
2017-11-02 22:37:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("Loading the config", func() {
|
|
|
|
|
|
|
|
It("reads the private config using the environment", func() {
|
2018-02-13 16:31:57 +00:00
|
|
|
testConfig := viper.New()
|
|
|
|
testConfig.SetConfigName("private")
|
|
|
|
testConfig.AddConfigPath("$GOPATH/src/github.com/vulcanize/vulcanizedb/environments/")
|
|
|
|
err := testConfig.ReadInConfig()
|
|
|
|
Expect(viper.Get("client.ipcpath")).To(BeNil())
|
2017-12-11 21:08:00 +00:00
|
|
|
Expect(err).To(BeNil())
|
2018-02-13 16:31:57 +00:00
|
|
|
Expect(testConfig.Get("database.hostname")).To(Equal("localhost"))
|
|
|
|
Expect(testConfig.Get("database.name")).To(Equal("vulcanize_private"))
|
|
|
|
Expect(testConfig.Get("database.port")).To(Equal(int64(5432)))
|
|
|
|
Expect(testConfig.Get("client.ipcpath")).To(Equal("test_data_dir/geth.ipc"))
|
2017-12-11 21:08:00 +00:00
|
|
|
})
|
|
|
|
|
2017-11-02 22:37:27 +00:00
|
|
|
})
|