Skip to content

Commit 6bd6b1a

Browse files
authored
Merge pull request #15 from goby-lang/deploy-to-heroku
Deploy to heroku
2 parents 90646b7 + e62b5ae commit 6bd6b1a

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ services:
1414
environment:
1515
- POSTGRES_DB=goby_test
1616
- POSTGRES_USER=postgres
17-
image: 'postgres:latest'
17+
image: 'postgres:9.3.17'
1818
ports:
1919
- '5432'
2020

plugin.gb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@ db_user = ENV["POSTGRES_USER"] || "postgres"
1212
db_name = ENV["POSTGRES_DB"] || "goby_test"
1313
db_host = ENV["POSTGRES_HOST"] || "0.0.0.0"
1414

15+
pg_host = ENV["DATABASE_URL"]
16+
17+
if pg_host.nil?
18+
pg_host = String.fmt("user=%s dbname=%s host=%s sslmode=disable", db_user, db_name, db_host)
19+
end
20+
1521
# Open PG connection using sqlx package's Open function
16-
conn, err = plugin.go_func("Open", "postgres", String.fmt("user=%s dbname=%s host=%s sslmode=disable", db_user, db_name, db_host))
22+
conn, err = plugin.go_func("Open", "postgres", pg_host)
1723

1824
if err
1925
puts(err.go_func("Error"))

server.gb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
require "net/simple_server"
22
require "json"
33
require_relative "model"
4-
server = Net::SimpleServer.new("3000")
4+
5+
server = Net::SimpleServer.new(ENV["PORT"] || "3000")
56

67
server.static("/icon/", "./public/icon/")
78
server.static("/js/", "./public/js/")

0 commit comments

Comments
 (0)