From c78b36f35eac0639312805e956c707ac7dead24d Mon Sep 17 00:00:00 2001 From: Sergio Somma Date: Fri, 24 Jun 2022 17:31:54 -0700 Subject: [PATCH 1/2] making things work for cloud run --- Dockerfile | 2 +- database/database.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index bcf6bfe..1a58967 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/reposit # Set up gin development tool WORKDIR $GOPATH/src -RUN go get -v github.com/codegangsta/gin +#RUN go get -v github.com/codegangsta/gin ENV GIN_BIN=/../../../tmp/gin-bin ENV GIN_PORT=8080 ENV BIN_APP_PORT=8081 diff --git a/database/database.go b/database/database.go index 7f29f92..7cdb3d1 100644 --- a/database/database.go +++ b/database/database.go @@ -5,6 +5,7 @@ import ( "github.com/jmoiron/sqlx" "os" "time" + "fmt" ) var persistentDb *sqlx.DB @@ -41,8 +42,9 @@ func ClearTestingDb() { } func openConnection(databaseName string) (*sqlx.DB, error) { + connection := os.Getenv("DB_CONNECTION") password := os.Getenv("DB_PASSWORD") - connStr := "root:" + password + "@tcp(mysql:3306)/" + databaseName + "?parseTime=true" + connStr := fmt.Sprintf("root:%s@%s/%s?parseTime=true", password, connection, databaseName) connection, err := sqlx.Connect("mysql", connStr) From 3be235252232d5b1fdb2a5436b7feaceeeba48fe Mon Sep 17 00:00:00 2001 From: Sergio Somma Date: Mon, 4 Jul 2022 10:41:00 -0700 Subject: [PATCH 2/2] undo comment --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1a58967..bcf6bfe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/reposit # Set up gin development tool WORKDIR $GOPATH/src -#RUN go get -v github.com/codegangsta/gin +RUN go get -v github.com/codegangsta/gin ENV GIN_BIN=/../../../tmp/gin-bin ENV GIN_PORT=8080 ENV BIN_APP_PORT=8081