correct var

pull/99/head v0.79.84
Hunter Long 2018-11-17 16:09:39 -08:00
parent 8f04ebee7f
commit aca967caab
5 changed files with 19 additions and 20 deletions

1
Gopkg.lock generated
View File

@ -258,7 +258,6 @@
analyzer-version = 1
input-imports = [
"github.com/GeertJohan/go.rice",
"github.com/GeertJohan/go.rice/embedded",
"github.com/ararog/timeago",
"github.com/go-mail/mail",
"github.com/go-yaml/yaml",

View File

@ -264,10 +264,6 @@ compress:
publish-dev:
curl -H "Content-Type: application/json" --data '{"docker_tag": "dev"}' -X POST $(DOCKER)
# push the :latest docker tag using curl
publish-latest:
curl -H "Content-Type: application/json" --data '{"docker_tag": "latest"}' -X POST $(DOCKER)
# update the homebrew application to latest for mac
publish-homebrew:
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $(TRAVIS_API)" -d $(PUBLISH_BODY) https://api.travis-ci.com/repo/hunterlong%2Fhomebrew-statup/requests
@ -283,10 +279,11 @@ cypress-test: clean cypress-install
# build Statup using a travis ci trigger
travis-build:
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $(TRAVIS_API)" -d $(TRAVIS_BUILD_CMD) https://api.travis-ci.com/repo/hunterlong%2Fstatup/requests
curl -H "Content-Type: application/json" --data '{"docker_tag": "latest"}' -X POST $(DOCKER)
# install xgo and pull the xgo docker image
xgo-install: clean
go get github.com/karalabe/xgo
docker pull karalabe/xgo-latest
.PHONY: all build build-all build-alpine test-all test
.PHONY: all build build-all build-alpine test-all test test-api

View File

@ -89,6 +89,7 @@ func TestRunAll(t *testing.T) {
assert.Nil(t, err)
})
t.Run(dbt+" Drop Database", func(t *testing.T) {
assert.NotNil(t, core.Configs)
RunDropDatabase(t)
})
t.Run(dbt+" Connect to Database Again", func(t *testing.T) {

View File

@ -55,17 +55,19 @@ func LoadUsingEnv() (*DbConfig, error) {
if os.Getenv("DB_CONN") == "" {
return nil, errors.New("Missing DB_CONN environment variable")
}
if os.Getenv("DB_HOST") == "" {
return nil, errors.New("Missing DB_HOST environment variable")
}
if os.Getenv("DB_USER") == "" {
return nil, errors.New("Missing DB_USER environment variable")
}
if os.Getenv("DB_PASS") == "" {
return nil, errors.New("Missing DB_PASS environment variable")
}
if os.Getenv("DB_DATABASE") == "" {
return nil, errors.New("Missing DB_DATABASE environment variable")
if os.Getenv("DB_CONN") != "sqlite" {
if os.Getenv("DB_HOST") == "" {
return nil, errors.New("Missing DB_HOST environment variable")
}
if os.Getenv("DB_USER") == "" {
return nil, errors.New("Missing DB_USER environment variable")
}
if os.Getenv("DB_PASS") == "" {
return nil, errors.New("Missing DB_PASS environment variable")
}
if os.Getenv("DB_DATABASE") == "" {
return nil, errors.New("Missing DB_DATABASE environment variable")
}
}
Configs = EnvToConfig()
CoreApp.Name = os.Getenv("NAME")

View File

@ -232,7 +232,7 @@ func (db *DbConfig) Connect(retry bool, location string) error {
host := fmt.Sprintf("%v:%v", Configs.DbHost, Configs.DbPort)
conn = fmt.Sprintf("%v:%v@tcp(%v)/%v?charset=utf8&parseTime=True&loc=UTC", Configs.DbUser, Configs.DbPass, host, Configs.DbData)
case "postgres":
conn = fmt.Sprintf("host=%v port=%v User=%v dbname=%v password=%v sslmode=disable", Configs.DbHost, Configs.DbPort, Configs.DbUser, Configs.DbData, Configs.DbPass)
conn = fmt.Sprintf("host=%v port=%v user=%v dbname=%v password=%v sslmode=disable", Configs.DbHost, Configs.DbPort, Configs.DbUser, Configs.DbData, Configs.DbPass)
case "mssql":
host := fmt.Sprintf("%v:%v", Configs.DbHost, Configs.DbPort)
conn = fmt.Sprintf("sqlserver://%v:%v@%v?database=%v", Configs.DbUser, Configs.DbPass, host, Configs.DbData)
@ -343,8 +343,8 @@ func (c *DbConfig) CreateCore() *Core {
// DropDatabase will DROP each table Statup created
func (db *DbConfig) DropDatabase() error {
utils.Log(1, "Dropping Database Tables...")
err := DbSession.DropTableIfExists("checkins")
err = DbSession.DropTableIfExists("checkin_hits")
//err := DbSession.DropTableIfExists("checkins")
err := DbSession.DropTableIfExists("checkin_hits")
err = DbSession.DropTableIfExists("notifications")
err = DbSession.DropTableIfExists("core")
err = DbSession.DropTableIfExists("failures")