-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(application-system): Add validated config (#15872)
* feat(application-system): Add validated config * Add sharedConfig to appModule * Cleanup * PR comment * PR comment fixes * Remove unused import * SharedTemplateAPIModule no longer dynamically registered * local fallback for attachment bucket * Add error logging * Modules that no longer need to be dynamic are no longer dynamic * Update readme * Post merge conflict fix * Cleanup * fix shared.utils * Cleanup * Fixes * Fix test * fix tests * Fix lint * Update social-insurance-administration.service to static module * Remove unused import * transition parental leave module to static * Transition children residence change to static module * cleanup shared utils * fix test * coderabbit suggestion --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
c836d9d
commit fb6d2cf
Showing
105 changed files
with
1,346 additions
and
1,648 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 |
---|---|---|
|
@@ -18,6 +18,7 @@ import { MockFeatureFlagService } from './mockFeatureFlagService' | |
import * as uuid from 'uuidv4' | ||
import jwt from 'jsonwebtoken' | ||
import { coreHistoryMessages } from '@island.is/application/core' | ||
import { sharedModuleConfig } from '@island.is/application/template-api-modules' | ||
|
||
let app: INestApplication | ||
|
||
|
@@ -56,6 +57,35 @@ class MockContentfulRepository { | |
} | ||
} | ||
|
||
const mockConfig = { | ||
clientLocationOrigin: 'http://localhost:4242', | ||
baseApiUrl: 'http://localhost:4444', | ||
attachmentBucket: 'attachmentBucket', | ||
templateApi: { | ||
clientLocationOrigin: 'http://localhost:4242/umsoknir', | ||
email: { | ||
sender: 'Devland.is', | ||
address: '[email protected]', | ||
}, | ||
jwtSecret: 'supersecret', | ||
xRoadBasePathWithEnv: '', | ||
baseApiUrl: 'http://localhost:4444', | ||
presignBucket: '', | ||
attachmentBucket: 'island-is-dev-storage-application-system', | ||
generalPetition: { | ||
endorsementApiBasePath: 'http://localhost:4246', | ||
}, | ||
userProfile: { | ||
serviceBasePath: 'http://localhost:3366', | ||
}, | ||
islykill: { | ||
cert: '', | ||
passphrase: '', | ||
basePath: '', | ||
}, | ||
}, | ||
} | ||
|
||
let server: request.SuperTest<request.Test> | ||
// eslint-disable-next-line local-rules/disallow-kennitalas | ||
const nationalId = '1234564321' | ||
|
@@ -74,6 +104,8 @@ beforeAll(async () => { | |
.useClass(MockFeatureFlagService) | ||
.overrideProvider(EmailService) | ||
.useClass(MockEmailService) | ||
.overrideProvider(sharedModuleConfig.KEY) | ||
.useValue(mockConfig) | ||
.overrideGuard(IdsUserGuard) | ||
.useValue(mockAuthGuard), | ||
}) | ||
|
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
18 changes: 7 additions & 11 deletions
18
...ication/template-api-modules/src/lib/modules/shared/api/application/application.module.ts
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,15 +1,11 @@ | ||
import { ApplicationApiCoreModule } from '@island.is/application/api/core' | ||
import { HistoryModule } from '@island.is/application/api/history' | ||
import { DynamicModule } from '@nestjs/common' | ||
import { Module } from '@nestjs/common' | ||
import { ApplicationService } from './application.service' | ||
|
||
export class ApplicationModule { | ||
static register(): DynamicModule { | ||
return { | ||
module: ApplicationModule, | ||
imports: [ApplicationApiCoreModule, HistoryModule], | ||
providers: [ApplicationService], | ||
exports: [ApplicationService], | ||
} | ||
} | ||
} | ||
@Module({ | ||
imports: [ApplicationApiCoreModule, HistoryModule], | ||
providers: [ApplicationService], | ||
exports: [ApplicationService], | ||
}) | ||
export class ApplicationModule {} |
19 changes: 8 additions & 11 deletions
19
...rc/lib/modules/shared/api/directorate-of-immigration/directorate-of-immigration.module.ts
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,13 +1,10 @@ | ||
import { DynamicModule } from '@nestjs/common' | ||
import { Module } from '@nestjs/common' | ||
import { DirectorateOfImmigrationService } from './directorate-of-immigration.service' | ||
import { DirectorateOfImmigrationClientModule } from '@island.is/clients/directorate-of-immigration' | ||
export class DirectorateOfImmigrationModule { | ||
static register(): DynamicModule { | ||
return { | ||
module: DirectorateOfImmigrationModule, | ||
imports: [DirectorateOfImmigrationClientModule], | ||
providers: [DirectorateOfImmigrationService], | ||
exports: [DirectorateOfImmigrationService], | ||
} | ||
} | ||
} | ||
|
||
@Module({ | ||
imports: [DirectorateOfImmigrationClientModule], | ||
providers: [DirectorateOfImmigrationService], | ||
exports: [DirectorateOfImmigrationService], | ||
}) | ||
export class DirectorateOfImmigrationModule {} |
18 changes: 7 additions & 11 deletions
18
...template-api-modules/src/lib/modules/shared/api/driving-license/driving-license.module.ts
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,15 +1,11 @@ | ||
import { DynamicModule } from '@nestjs/common' | ||
import { Module } from '@nestjs/common' | ||
import { DrivingLicenseProviderService } from './driving-license.service' | ||
import { DrivingLicenseApiModule } from '@island.is/clients/driving-license' | ||
import { DrivingLicenseBookModule } from '@island.is/api/domains/driving-license-book' | ||
|
||
export class DrivingLicenseModule { | ||
static register(): DynamicModule { | ||
return { | ||
module: DrivingLicenseModule, | ||
imports: [DrivingLicenseApiModule, DrivingLicenseBookModule], | ||
providers: [DrivingLicenseProviderService], | ||
exports: [DrivingLicenseProviderService], | ||
} | ||
} | ||
} | ||
@Module({ | ||
imports: [DrivingLicenseApiModule, DrivingLicenseBookModule], | ||
providers: [DrivingLicenseProviderService], | ||
exports: [DrivingLicenseProviderService], | ||
}) | ||
export class DrivingLicenseModule {} |
19 changes: 8 additions & 11 deletions
19
libs/application/template-api-modules/src/lib/modules/shared/api/education/inna.module.ts
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,13 +1,10 @@ | ||
import { DynamicModule } from '@nestjs/common' | ||
import { Module } from '@nestjs/common' | ||
import { InnaClientModule } from '@island.is/clients/inna' | ||
import { InnaService } from './inna.service' | ||
export class InnaModule { | ||
static register(): DynamicModule { | ||
return { | ||
module: InnaModule, | ||
imports: [InnaClientModule], | ||
providers: [InnaService], | ||
exports: [InnaService], | ||
} | ||
} | ||
} | ||
|
||
@Module({ | ||
imports: [InnaClientModule], | ||
providers: [InnaService], | ||
exports: [InnaService], | ||
}) | ||
export class InnaModule {} |
30 changes: 13 additions & 17 deletions
30
...mplate-api-modules/src/lib/modules/shared/api/health-insurance/health-insurance.module.ts
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,24 +1,20 @@ | ||
import { DynamicModule } from '@nestjs/common' | ||
import { Module } from '@nestjs/common' | ||
import { HealthInsuranceService } from './health-insurance.service' | ||
import { | ||
RightsPortalClientConfig, | ||
RightsPortalClientModule, | ||
} from '@island.is/clients/icelandic-health-insurance/rights-portal' | ||
import { ConfigModule } from '@nestjs/config' | ||
|
||
export class HealthInsuranceModule { | ||
static register(): DynamicModule { | ||
return { | ||
module: HealthInsuranceModule, | ||
imports: [ | ||
RightsPortalClientModule, | ||
ConfigModule.forRoot({ | ||
isGlobal: true, | ||
load: [RightsPortalClientConfig], | ||
}), | ||
], | ||
providers: [HealthInsuranceService], | ||
exports: [HealthInsuranceService], | ||
} | ||
} | ||
} | ||
@Module({ | ||
imports: [ | ||
RightsPortalClientModule, | ||
ConfigModule.forRoot({ | ||
isGlobal: true, | ||
load: [RightsPortalClientConfig], | ||
}), | ||
], | ||
providers: [HealthInsuranceService], | ||
exports: [HealthInsuranceService], | ||
}) | ||
export class HealthInsuranceModule {} |
19 changes: 7 additions & 12 deletions
19
libs/application/template-api-modules/src/lib/modules/shared/api/identity/identity.module.ts
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,15 +1,10 @@ | ||
import { DynamicModule } from '@nestjs/common' | ||
import { BaseTemplateAPIModuleConfig } from '../../../../types' | ||
import { Module } from '@nestjs/common' | ||
import { IdentityClientModule } from '@island.is/clients/identity' | ||
import { IdentityService } from './identity.service' | ||
|
||
export class IdentityModule { | ||
static register(config: BaseTemplateAPIModuleConfig): DynamicModule { | ||
return { | ||
module: IdentityModule, | ||
imports: [IdentityClientModule], | ||
providers: [IdentityService], | ||
exports: [IdentityService], | ||
} | ||
} | ||
} | ||
@Module({ | ||
imports: [IdentityClientModule], | ||
providers: [IdentityService], | ||
exports: [IdentityService], | ||
}) | ||
export class IdentityModule {} |
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
33 changes: 14 additions & 19 deletions
33
...late-api-modules/src/lib/modules/shared/api/national-registry/national-registry.module.ts
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,25 +1,20 @@ | ||
import { DynamicModule } from '@nestjs/common' | ||
import { BaseTemplateAPIModuleConfig } from '../../../../types' | ||
import { Module } from '@nestjs/common' | ||
import { NationalRegistryClientModule } from '@island.is/clients/national-registry-v2' | ||
import { NationalRegistryService } from './national-registry.service' | ||
import { AssetsModule } from '@island.is/api/domains/assets' | ||
import { ConfigModule } from '@nestjs/config' | ||
import { AssetsClientConfig } from '@island.is/clients/assets' | ||
|
||
export class NationalRegistryModule { | ||
static register(config: BaseTemplateAPIModuleConfig): DynamicModule { | ||
return { | ||
module: NationalRegistryModule, | ||
imports: [ | ||
NationalRegistryClientModule, | ||
AssetsModule, | ||
ConfigModule.forRoot({ | ||
isGlobal: true, | ||
load: [AssetsClientConfig], | ||
}), | ||
], | ||
providers: [NationalRegistryService], | ||
exports: [NationalRegistryService], | ||
} | ||
} | ||
} | ||
@Module({ | ||
imports: [ | ||
NationalRegistryClientModule, | ||
AssetsModule, | ||
ConfigModule.forRoot({ | ||
isGlobal: true, | ||
load: [AssetsClientConfig], | ||
}), | ||
], | ||
providers: [NationalRegistryService], | ||
exports: [NationalRegistryService], | ||
}) | ||
export class NationalRegistryModule {} |
18 changes: 7 additions & 11 deletions
18
libs/application/template-api-modules/src/lib/modules/shared/api/passport/passport.module.ts
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,14 +1,10 @@ | ||
import { DynamicModule } from '@nestjs/common' | ||
import { Module } from '@nestjs/common' | ||
import { PassportService } from './passport.service' | ||
import { PassportsClientModule } from '@island.is/clients/passports' | ||
|
||
export class PassportModule { | ||
static register(): DynamicModule { | ||
return { | ||
module: PassportModule, | ||
imports: [PassportsClientModule], | ||
providers: [PassportService], | ||
exports: [PassportService], | ||
} | ||
} | ||
} | ||
@Module({ | ||
imports: [PassportsClientModule], | ||
providers: [PassportService], | ||
exports: [PassportService], | ||
}) | ||
export class PassportModule {} |
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
Oops, something went wrong.