From f6f3c978630df1514e3eefc4f13492cb1d61f83e Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 9 Nov 2018 18:42:52 +0100 Subject: .env.sample: Add `DATABASE_URL` variable Add a new variable for the regular database URL, and move the existing one, which includes the `tcp(hostname)` format to `GO_DATABASE_URL`. We need to keep the existing one for use with the 'migrate' command, but I want a regular database URL to be able to use inside the main web program. --- license-generator/.env.sample | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/license-generator/.env.sample b/license-generator/.env.sample index 14866f0..e9e0bd7 100644 --- a/license-generator/.env.sample +++ b/license-generator/.env.sample @@ -2,7 +2,9 @@ export DATABASE_NAME="" export DATABASE_USER="" export DATABASE_PASSWORD="" -export DATABASE_URL="mysql://tcp(localhost:3306)/dome_key" +export DATABASE_URL="mysql://localhost:3306/dome_key" + +export GO_DATABASE_URL="mysql://tcp(localhost:3306)/dome_key" function migrate-create () { @@ -10,7 +12,7 @@ function migrate-create () { migrate \ -path migrations \ - -database "$DATABASE_URL" \ + -database "$GO_DATABASE_URL" \ create \ -ext sql \ -format '20060102150405' \ @@ -24,7 +26,7 @@ function migrate-goto () { migrate \ -path migrations \ - -database "$DATABASE_URL" \ + -database "$GO_DATABASE_URL" \ goto \ "$version" } @@ -34,7 +36,7 @@ function migrate-up () { migrate \ -path migrations \ - -database "$DATABASE_URL" \ + -database "$GO_DATABASE_URL" \ up \ "$count" } @@ -44,7 +46,7 @@ function migrate-down () { migrate \ -path migrations \ - -database "$DATABASE_URL" \ + -database "$GO_DATABASE_URL" \ down \ "$count" } @@ -52,7 +54,7 @@ function migrate-down () { function migrate-drop () { migrate \ -path migrations \ - -database "$DATABASE_URL" \ + -database "$GO_DATABASE_URL" \ drop } @@ -61,7 +63,7 @@ function migrate-force () { migrate \ -path migrations \ - -database "$DATABASE_URL" \ + -database "$GO_DATABASE_URL" \ force \ "$version" } @@ -69,6 +71,6 @@ function migrate-force () { function migrate-version () { migrate \ -path migrations \ - -database "$DATABASE_URL" \ + -database "$GO_DATABASE_URL" \ version } -- cgit v1.2.3