Skip to content

Commit

Permalink
add dependencies for db requirements (#79)
Browse files Browse the repository at this point in the history
Signed-off-by: Mirko Mollik <mirkomollik@gmail.com>
  • Loading branch information
cre8 authored Jul 8, 2024
1 parent 0235676 commit b5780a5
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/holder-backend/src/app/db/db.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as Joi from 'joi';
import { DatabaseType } from 'typeorm';

export const DB_VALIDATION_SCHEMA = {
DB_TYPE: Joi.string().default('postgres'),
DB_TYPE: Joi.string().valid('sqlite', 'postgres').default('postgres'),
DB_HOST: Joi.string().when('DB_TYPE', {
is: 'postgres',
then: Joi.required(),
Expand Down
1 change: 1 addition & 0 deletions apps/issuer-backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"dependencies": {
"sqlite3": "^5.1.7",
"pg": "^8.11.5",
"@sphereon/pex": "^3.3.3",
"@sphereon/oid4vci-issuer": "^0.12.0",
"@sphereon/ssi-express-support": "0.26.0"
Expand Down
4 changes: 3 additions & 1 deletion apps/verifier-backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"dependencies": {
"@sphereon/pex": "^3.3.3"
"@sphereon/pex": "^3.3.3",
"sqlite3": "^5.1.7",
"pg": "^8.11.5"
},
"pnpm": {
"patchedDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions deploys/issuer/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ ISSUER_BASE_URL=http://localhost:3001
CREDENTIALS_FOLDER=templates
KM_FOLDER=data

DB_TYPE=sqlite
DB_NAME=data/db.sqlite

# Frontend
FRONTEND_OIDC_CLIENT_ID=relying-party
FRONTEND_OIDC_CLIENT_SECRET=hA0mbfpKl8wdMrUxr2EjKtL5SGsKFW5D
Expand Down
5 changes: 3 additions & 2 deletions deploys/issuer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ services:
- OIDC_AUTH_URL=$OIDC_AUTH_URL
- OIDC_REALM=$OIDC_REALM
- OIDC_CLIENT_ID=$OIDC_CLIENT_ID
- OIDC_CLIENT_SECRET=$OIDC_CLIENT_SECRET
- VERIFIER_BASE_URL=$VERIFIER_BASE_URL
- KM_FOLDER=$KM_FOLDER
- ISSUER_BASE_URL=$ISSUER_BASE_URL
- CREDENTIALS_FOLDER=$CREDENTIALS_FOLDER
- DB_TYPE=sqlite
- DB_NAME=data/db.sqlite
- DB_TYPE=$DB_TYPE
- DB_NAME=$DB_NAME
volumes:
- issuer:/home/node/app/data:rw
- ./config/issuer-backend:/home/node/app/templates
Expand Down
3 changes: 3 additions & 0 deletions deploys/verifier/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ VERIFIER_BASE_URL=http://localhost:3002
CREDENTIALS_FOLDER=templates
KM_FOLDER=data

DB_TYPE=sqlite
DB_NAME=data/db.sqlite

# Frontend
FRONTEND_OIDC_CLIENT_ID=relying-party
FRONTEND_OIDC_CLIENT_SECRET=hA0mbfpKl8wdMrUxr2EjKtL5SGsKFW5D
Expand Down
3 changes: 3 additions & 0 deletions deploys/verifier/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ services:
- OIDC_AUTH_URL=$OIDC_AUTH_URL
- OIDC_REALM=$OIDC_REALM
- OIDC_CLIENT_ID=$OIDC_CLIENT_ID
- OIDC_CLIENT_SECRET=$OIDC_CLIENT_SECRET
- VERIFIER_BASE_URL=$VERIFIER_BASE_URL
- CREDENTIALS_FOLDER=$CREDENTIALS_FOLDER
- KM_FOLDER=$KM_FOLDER
- DB_TYPE=$DB_TYPE
- DB_NAME=$DB_NAME
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health']
interval: 30s
Expand Down
10 changes: 6 additions & 4 deletions libs/relying-party-shared/src/lib/db/db.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { TypeOrmModule } from '@nestjs/typeorm';
import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm';
import * as Joi from 'joi';
import { DatabaseType } from 'typeorm';

export const DB_VALIDATION_SCHEMA = {
DB_TYPE: Joi.string().default('postgres'),
DB_TYPE: Joi.string().valid('sqlite', 'postgres').default('sqlite'),
DB_HOST: Joi.string().when('DB_TYPE', {
is: 'postgres',
then: Joi.required(),
Expand Down Expand Up @@ -42,7 +42,7 @@ export const DB_VALIDATION_SCHEMA = {
database: configService.get('DB_NAME'),
synchronize: true,
autoLoadEntities: true,
};
} as TypeOrmModuleOptions;
case 'postgres':
return {
type: 'postgres',
Expand All @@ -53,7 +53,9 @@ export const DB_VALIDATION_SCHEMA = {
database: configService.get('DB_NAME'),
synchronize: true,
autoLoadEntities: true,
};
} as TypeOrmModuleOptions;
default:
throw new Error('Invalid DB_TYPE');
}
},
}),
Expand Down

0 comments on commit b5780a5

Please sign in to comment.