DEV Community

Discussion on: How I Built an API with Mux, Go, PostgreSQL, and GORM

Collapse
 
axxa3000 profile image
axxa3000

When deploying to Heroku, how do you get the .env variables?

Working find in local.

Thanks.

Collapse
 
aspittel profile image
Ali Spittel

I did this!

Collapse
 
axxa3000 profile image
axxa3000

For fast deployment in Heroku, 2 minor changes.

Procfile:
web: helpful-coding-resources-api-master

rest-api:

db_url := os.Getenv("DATABASE_URL")
db, err = gorm.Open("postgres",db_url)

to connect to DB.

This is for the new people trying Go+Heroku, that work for me, hope
to save u some time.

great tut! thanxs Ali.