DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

7f8bcd7e5424cd404e7d2627cb2422460f055793 — Jonni Liljamo 1 year, 10 months ago 0344717
feat(sdbapi): handle startup errors "gracefully"
1 files changed, 11 insertions(+), 2 deletions(-)

M sdbapi/main.go
M sdbapi/main.go => sdbapi/main.go +11 -2
@@ 20,14 20,23 @@ import (
)

func main() {
	err := setUlimits()
	// stores various errors during startup
	var err error

	err = setUlimits()
	if err != nil {
		log.Fatal("failed to set Ulimits")
	}

	dbConnectionString := os.Getenv("GORM_DB_STRING")
	if dbConnectionString == "" {
		log.Fatal("environment variable 'GORM_DB_STRING' is not set")
	}

	db.Connect(dbConnectionString)
	err = db.Connect(dbConnectionString)
	if err != nil {
		log.Fatal(err)
	}

	db.Migrate()