Skip to content

Commit

Permalink
fix(authentication-service): fixed env defaults issues in migrations (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
akshatdubeysf authored May 6, 2021
1 parent dd7bea2 commit 6f1ef17
Show file tree
Hide file tree
Showing 21 changed files with 78 additions and 22 deletions.
2 changes: 1 addition & 1 deletion services/audit-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class AuditDbDataSource extends juggler.DataSource

### Migrations

The migrations required for this service are processed during the installation automatically if you set the `AUDIT_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `AUDIT_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.
The migrations required for this service are processed during the installation automatically if you set the `AUDIT_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. The migrations use (`db-migrate`)[https://www.npmjs.com/package/db-migrate] with (`db-migrate-pg`)[https://www.npmjs.com/package/db-migrate-pg] driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `AUDIT_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.

### API Documentation

Expand Down
8 changes: 6 additions & 2 deletions services/audit-service/migration.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
const dotenv = require('dotenv');
const dotenvExt = require('dotenv-extended');
const fs = require('fs');
const DBMigrate = require('db-migrate');
const path = require('path');
let isLocal = false;
dotenv.config({path: path.join(process.env.INIT_CWD, '.env')});
dotenvExt.load({
path: path.join(process.env.INIT_CWD, '.env'),
defaults: path.join(process.env.INIT_CWD, '.env.defaults'),
errorOnMissing: false,
includeProcessEnv: true,
});
const type = 'AUDIT';

try {
Expand Down
4 changes: 4 additions & 0 deletions services/audit-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
"database.json",
"!*/__tests__"
],
"peerDependencies": {
"db-migrate": "< 1.0.0 || ^1.0.0",
"db-migrate-pg": "^1.0.0"
},
"dependencies": {
"@loopback/boot": "^3.1.0",
"@loopback/core": "^2.12.0",
Expand Down
2 changes: 1 addition & 1 deletion services/authentication-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class AuthenticationDbDataSource

### Migrations

The migrations required for this service are processed during the installation automatically if you set the `AUTH_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `AUTH_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.
The migrations required for this service are processed during the installation automatically if you set the `AUTH_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. The migrations use (`db-migrate`)[https://www.npmjs.com/package/db-migrate] with (`db-migrate-pg`)[https://www.npmjs.com/package/db-migrate-pg] driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `AUTH_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.

### API Documentation

Expand Down
8 changes: 6 additions & 2 deletions services/authentication-service/migration.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
const dotenv = require('dotenv');
const dotenvExt = require('dotenv-extended');
const fs = require('fs');
const DBMigrate = require('db-migrate');
const path = require('path');
let isLocal = false;
dotenv.config({path: path.join(process.env.INIT_CWD, '.env')});
dotenvExt.load({
path: path.join(process.env.INIT_CWD, '.env'),
defaults: path.join(process.env.INIT_CWD, '.env.defaults'),
errorOnMissing: false,
includeProcessEnv: true,
});
const type = 'AUTH';

try {
Expand Down
4 changes: 4 additions & 0 deletions services/authentication-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
"database.json",
"!*/__tests__"
],
"peerDependencies": {
"db-migrate": "< 1.0.0 || ^1.0.0",
"db-migrate-pg": "^1.0.0"
},
"dependencies": {
"@loopback/boot": "^3.1.0",
"@loopback/context": "^3.13.0",
Expand Down
2 changes: 1 addition & 1 deletion services/bpmn-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Your workers are automatically initiated once a workflow is executed, to provide

### Migrations

The migrations required for this service are processed during the installation automatically if you set the `WORKFLOW_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `WORKFLOW_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.
The migrations required for this service are processed during the installation automatically if you set the `WORKFLOW_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. The migrations use (`db-migrate`)[https://www.npmjs.com/package/db-migrate] with (`db-migrate-pg`)[https://www.npmjs.com/package/db-migrate-pg] driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `WORKFLOW_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.

This project includes no migrations to seed your BPMN engine. If you are using Camunda BPM Run, you can use either the `resources` folder to seed a model, or you can config it to use a custom DB where you can seed your data. The steps to config Platform Run are given [here](https://camunda.com/blog/2020/03/introducing-camunda-bpm-run/).

Expand Down
8 changes: 6 additions & 2 deletions services/bpmn-service/migration.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
const dotenv = require('dotenv');
const dotenvExt = require('dotenv-extended');
const fs = require('fs');
const DBMigrate = require('db-migrate');
const path = require('path');
let isLocal = false;
dotenv.config({path: path.join(process.env.INIT_CWD, '.env')});
dotenvExt.load({
path: path.join(process.env.INIT_CWD, '.env'),
defaults: path.join(process.env.INIT_CWD, '.env.defaults'),
errorOnMissing: false,
includeProcessEnv: true,
});
const type = 'WORKFLOW';

try {
Expand Down
4 changes: 4 additions & 0 deletions services/bpmn-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
"database.json",
"!*/__tests__"
],
"peerDependencies": {
"db-migrate": "< 1.0.0 || ^1.0.0",
"db-migrate-pg": "^1.0.0"
},
"dependencies": {
"@loopback/boot": "^3.1.0",
"@loopback/context": "^3.13.0",
Expand Down
2 changes: 1 addition & 1 deletion services/in-mail-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ any client application.

### Migration

The migrations required for this service are processed during the installation automatically if you set the `INMAIL_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `INMAIL_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.
The migrations required for this service are processed during the installation automatically if you set the `INMAIL_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. The migrations use (`db-migrate`)[https://www.npmjs.com/package/db-migrate] with (`db-migrate-pg`)[https://www.npmjs.com/package/db-migrate-pg] driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `INMAIL_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.

### Implementation

Expand Down
8 changes: 6 additions & 2 deletions services/in-mail-service/migration.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
const dotenv = require('dotenv');
const dotenvExt = require('dotenv-extended');
const fs = require('fs');
const DBMigrate = require('db-migrate');
const path = require('path');
let isLocal = false;
dotenv.config({path: path.join(process.env.INIT_CWD, '.env')});
dotenvExt.load({
path: path.join(process.env.INIT_CWD, '.env'),
defaults: path.join(process.env.INIT_CWD, '.env.defaults'),
errorOnMissing: false,
includeProcessEnv: true,
});
const type = 'INMAIL';

try {
Expand Down
4 changes: 4 additions & 0 deletions services/in-mail-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
"database.json",
"!*/__tests__"
],
"peerDependencies": {
"db-migrate": "< 1.0.0 || ^1.0.0",
"db-migrate-pg": "^1.0.0"
},
"dependencies": {
"@loopback/boot": "^3.1.0",
"@loopback/context": "^3.13.0",
Expand Down
2 changes: 1 addition & 1 deletion services/notification-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class NotificationDbDataSource extends juggler.DataSource

### Migrations

The migrations required for this service are processed during the installation automatically if you set the `NOTIF_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `NOTIF_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.
The migrations required for this service are processed during the installation automatically if you set the `NOTIF_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. The migrations use (`db-migrate`)[https://www.npmjs.com/package/db-migrate] with (`db-migrate-pg`)[https://www.npmjs.com/package/db-migrate-pg] driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `NOTIF_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.

### API Documentation

Expand Down
8 changes: 6 additions & 2 deletions services/notification-service/migration.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
const dotenv = require('dotenv');
const dotenvExt = require('dotenv-extended');
const fs = require('fs');
const DBMigrate = require('db-migrate');
const path = require('path');
let isLocal = false;
dotenv.config({path: path.join(process.env.INIT_CWD, '.env')});
dotenvExt.load({
path: path.join(process.env.INIT_CWD, '.env'),
defaults: path.join(process.env.INIT_CWD, '.env.defaults'),
errorOnMissing: false,
includeProcessEnv: true,
});
const type = 'NOTIF';

try {
Expand Down
4 changes: 4 additions & 0 deletions services/notification-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
"database.json",
"!*/__tests__"
],
"peerDependencies": {
"db-migrate": "< 1.0.0 || ^1.0.0",
"db-migrate-pg": "^1.0.0"
},
"dependencies": {
"@loopback/boot": "^3.1.0",
"@loopback/context": "^3.13.0",
Expand Down
2 changes: 1 addition & 1 deletion services/scheduler-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class SchedulerServiceApplication extends BootMixin(

## DB migrations

The migrations required for this service are processed during the installation automatically if you set the `SCHEDULAR_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `SCHEDULAR_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.
The migrations required for this service are processed during the installation automatically if you set the `SCHEDULER_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. The migrations use (`db-migrate`)[https://www.npmjs.com/package/db-migrate] with (`db-migrate-pg`)[https://www.npmjs.com/package/db-migrate-pg] driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `SCHEDULER_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.

#### Database Model

Expand Down
10 changes: 7 additions & 3 deletions services/scheduler-service/migration.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
const dotenv = require('dotenv');
const dotenvExt = require('dotenv-extended');
const fs = require('fs');
const DBMigrate = require('db-migrate');
const path = require('path');
let isLocal = false;
dotenv.config({path: path.join(process.env.INIT_CWD, '.env')});
const type = 'SCHEDULAR';
dotenvExt.load({
path: path.join(process.env.INIT_CWD, '.env'),
defaults: path.join(process.env.INIT_CWD, '.env.defaults'),
errorOnMissing: false,
includeProcessEnv: true,
});
const type = 'SCHEDULER';

try {
if (fs.existsSync('.infolder')) {
Expand Down
4 changes: 4 additions & 0 deletions services/scheduler-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
"database.json",
"!*/__tests__"
],
"peerDependencies": {
"db-migrate": "< 1.0.0 || ^1.0.0",
"db-migrate-pg": "^1.0.0"
},
"dependencies": {
"@loopback/boot": "^3.1.0",
"@loopback/context": "^3.13.0",
Expand Down
2 changes: 1 addition & 1 deletion services/video-conferencing-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class ClientComponent extends BootMixin(

## DB migrations

The migrations required for this service are processed during the installation automatically if you set the `VIDEOCONF_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `VIDEOCONF_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.
The migrations required for this service are processed during the installation automatically if you set the `VIDEOCONF_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. The migrations use (`db-migrate`)[https://www.npmjs.com/package/db-migrate] with (`db-migrate-pg`)[https://www.npmjs.com/package/db-migrate-pg] driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `VIDEOCONF_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.

## Using config

Expand Down
8 changes: 6 additions & 2 deletions services/video-conferencing-service/migration.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
const dotenv = require('dotenv');
const dotenvExt = require('dotenv-extended');
const fs = require('fs');
const DBMigrate = require('db-migrate');
const path = require('path');
let isLocal = false;
dotenv.config({path: path.join(process.env.INIT_CWD, '.env')});
dotenvExt.load({
path: path.join(process.env.INIT_CWD, '.env'),
defaults: path.join(process.env.INIT_CWD, '.env.defaults'),
errorOnMissing: false,
includeProcessEnv: true,
});
const type = 'VIDEOCONF';

try {
Expand Down
4 changes: 4 additions & 0 deletions services/video-conferencing-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
"database.json",
"!*/__tests__"
],
"peerDependencies": {
"db-migrate": "< 1.0.0 || ^1.0.0",
"db-migrate-pg": "^1.0.0"
},
"dependencies": {
"@loopback/boot": "^3.1.0",
"@loopback/context": "^3.13.0",
Expand Down

0 comments on commit 6f1ef17

Please sign in to comment.