-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework to not assume schema, usernames
- Loading branch information
Showing
13 changed files
with
49 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
DB Migrations for Postgres. | ||
|
||
|
||
/dev contains migrations suitable for testing; it creates a database, user(s) with default weak passwords (again, for testing), schema etc. | ||
|
||
/prod creates our main tables & functions, implies database, schema & users exist already. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,7 @@ | ||
package database | ||
|
||
const ( | ||
defaultPasswordEnvVar = "DATABASE_PASSWORD" | ||
defaultUsernameEnvVar = "DATABASE_USER" | ||
) | ||
|
||
// Options are options for the database. | ||
type Options struct { | ||
// URL encodes how we'll connect to the database. | ||
URL string | ||
|
||
// PasswordEnvVar is the environment variable that contains the password for the database. | ||
// This value is substituted into the URL (ie. "postgres://username:$PASS@localhost:5432" will have "PASS" subbed in). | ||
// Defaults to "DATABASE_PASSWORD". | ||
PasswordEnvVar string | ||
|
||
// UsernameEnvVar is the environment variable that contains the username for the database. | ||
// This value is substituted into the URL (ie. "postgres://$USER:password@localhost:5432" will have "USER" subbed in). | ||
// Defaults to "DATABASE_USER". | ||
UsernameEnvVar string | ||
} | ||
|
||
func (o *Options) SetDefaults() { | ||
if o.PasswordEnvVar == "" { | ||
o.PasswordEnvVar = defaultPasswordEnvVar | ||
} | ||
if o.UsernameEnvVar == "" { | ||
o.UsernameEnvVar = defaultUsernameEnvVar | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters