-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: migrate ormconfig/connection to datasource
TODO: test setup is still broken
- Loading branch information
Showing
25 changed files
with
149 additions
and
152 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
BASE_URL=${POM_BASE_URL} | ||
|
||
DB_PASSWORD=${DB_PASSWORD} | ||
|
||
GOOGLE_CLIENT_ID=changeme | ||
GOOGLE_CLIENT_SECRET=changeme | ||
|
||
|
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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { DataSourceOptions, DataSource } from "typeorm"; | ||
import * as dotenv from "dotenv"; | ||
|
||
dotenv.config(); | ||
|
||
const postgresConnectionOptions: DataSourceOptions = { | ||
type: "postgres", | ||
host: "db", | ||
port: 5432, | ||
username: "marsmadness", | ||
password: process.env.DB_PASSWORD, | ||
synchronize: false, | ||
logging: false, | ||
entities: ["src/entity/**/*.{js,ts}"], | ||
migrations: ["src/migration/**/*.{js,ts}"], | ||
}; | ||
|
||
const appDataSource = new DataSource({ | ||
...postgresConnectionOptions, | ||
database: "port_of_mars", | ||
}); | ||
|
||
const testDataSource = new DataSource({ | ||
...postgresConnectionOptions, | ||
database: "pom_testing", | ||
}); | ||
|
||
const dataSource = process.env.NODE_ENV === "test" ? testDataSource : appDataSource; | ||
export default dataSource; |
Oops, something went wrong.