diff --git a/.gitignore b/.gitignore index e59baa1..88b8525 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules dist .env .idea -.nyc_output \ No newline at end of file +.nyc_output +.dockerignore diff --git a/README.md b/README.md index 682dd5f..cd25810 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,6 @@ POSTGRES_CONNECTION_URL=postgres://username:password@host:port/database_name ``` - __RPC_HOST__ is used for the connection with the [flotte-user-management server](https://github.com/fLotte-meets-HWR-DB/flotte-user-management). - __NODE_ENV__ will not check authentication if set to development -- __POSTGRES_CONNECTION_URL__ for connection with the postgres database +- __DATABASE_URL__ for connection with the postgres database If the API server cannot connect to the [flotte-user-management server](https://github.com/fLotte-meets-HWR-DB/flotte-user-management) or the postgres data base. It will try to reconnect in an endless loop. diff --git a/package-lock.json b/package-lock.json index ef34644..a5668ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1220,6 +1220,7 @@ "integrity": "sha512-HUcP3TlgRsuGgeTOn8QMbkdx0hLPXyEJehZIPrcof0ATz7j7aTPA4at7gaiFHCo8gk07DaWYGB3PFgjboXRcWQ==", "requires": { "lru-cache": "^5.0.0" + }, "dependencies": { "lru-cache": { diff --git a/src/app.ts b/src/app.ts index 4eaceb4..9e5d13f 100644 --- a/src/app.ts +++ b/src/app.ts @@ -62,9 +62,8 @@ require('dotenv').config(); export const userAPI = new UserServerAPI(process.env.RPC_HOST); export function getConnectionOptions (): ConnectionOptions { - return { - // @ts-ignore - type: process.env.DATABASE_TYPE, + const ret = { + type: (!process.env.DATABASE_TYPE) ? 'postgres' : process.env.DATABASE_TYPE, url: process.env.DATABASE_URL, database: process.env.DATABASE_NAME, entities: [ @@ -89,6 +88,11 @@ export function getConnectionOptions (): ConnectionOptions { synchronize: true, logging: false }; + if (ret.database === undefined) { + delete ret.database; + } + // @ts-ignore + return ret; } export async function getApp (connOptions: ConnectionOptions) { diff --git a/src/schema/type-defs.ts b/src/schema/type-defs.ts index a8cd2be..ef743d4 100644 --- a/src/schema/type-defs.ts +++ b/src/schema/type-defs.ts @@ -828,7 +828,6 @@ export default gql` registeredAt: String provider: Provider contactInformation: ContactInformation - otherData: String isLocked: Boolean! isLockedByMe: Boolean! "null if not locked by other user" @@ -844,7 +843,6 @@ export default gql` "If Club, at what court registered" registeredAt: String contactInformationId: ID - otherData: String } input OrganisationUpdateInput { @@ -856,7 +854,6 @@ export default gql` "If Club, at what court registered" registeredAt: String contactInformationId: ID - otherData: String keepLock: Boolean }