file config, avator, header image. (#18)

This commit is contained in:
Naoki Kosaka
2019-04-10 17:23:25 +09:00
committed by GitHub
parent d3d03544fa
commit 97f4655e9c
8 changed files with 85 additions and 19 deletions

View File

@ -1,6 +1,7 @@
package state
import (
"fmt"
"os"
"testing"
@ -11,7 +12,13 @@ import (
var redisClient *redis.Client
func TestMain(m *testing.M) {
viper.BindEnv("redis_url")
viper.SetConfigName("config")
viper.AddConfigPath(".")
err := viper.ReadInConfig()
if err != nil {
fmt.Println("Config file is not exists. Use environment variables.")
viper.BindEnv("redis_url")
}
redisOption, err := redis.ParseURL(viper.GetString("redis_url"))
if err != nil {
panic(err)