aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-11-09 18:42:52 +0100
committerTeddy Wing2018-11-09 18:42:52 +0100
commitf6f3c978630df1514e3eefc4f13492cb1d61f83e (patch)
tree70fb4e7b9ee4656718dd9954da8fc0a8021b93d4
parent51e3dd528919599c3d2beff56c59a4cb7fe24371 (diff)
downloaddome-key-web-f6f3c978630df1514e3eefc4f13492cb1d61f83e.tar.bz2
.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.
-rw-r--r--license-generator/.env.sample18
1 files 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
}