Skip to content

Commit

Permalink
chore(regulations-admin): Update national registry for regulations (#…
Browse files Browse the repository at this point in the history
…15995)

* Add nat reg v3

* remove console log

* chore: charts update dirty files

* Remove unused

* test

* cleanup

* add missing chart value

---------

Co-authored-by: andes-it <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 13, 2024
1 parent a811680 commit dddefda
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { service, ServiceBuilder } from '../../../../infra/src/dsl/dsl'
import { Base, Client, NationalRegistry } from '../../../../infra/src/dsl/xroad'
import {
Base,
Client,
NationalRegistryB2C,
} from '../../../../infra/src/dsl/xroad'

export const serviceSetup = (): ServiceBuilder<'regulations-admin-backend'> =>
service('regulations-admin-backend')
Expand All @@ -25,12 +29,14 @@ export const serviceSetup = (): ServiceBuilder<'regulations-admin-backend'> =>
'/k8s/api/REGULATIONS_FILE_UPLOAD_KEY_PUBLISH',
REGULATIONS_FILE_UPLOAD_KEY_PRESIGNED:
'/k8s/api/REGULATIONS_FILE_UPLOAD_KEY_PRESIGNED',
NATIONAL_REGISTRY_B2C_CLIENT_SECRET:
'/k8s/api/NATIONAL_REGISTRY_B2C_CLIENT_SECRET',
})
.resources({
limits: { cpu: '400m', memory: '512Mi' },
requests: { cpu: '100m', memory: '256Mi' },
})
.xroad(Base, Client, NationalRegistry)
.xroad(Base, Client, NationalRegistryB2C)
.readiness('/liveness')
.liveness('/liveness')
.grantNamespaces('islandis', 'download-service')
4 changes: 2 additions & 2 deletions apps/services/regulations-admin-backend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { AuthModule } from '@island.is/auth-nest-tools'
import { AuditModule } from '@island.is/nest/audit'

import { environment } from '../environments'
import { NationalRegistryClientConfig } from '@island.is/clients/national-registry-v2'
import { NationalRegistryV3ClientConfig } from '@island.is/clients/national-registry-v3'
import { RegulationsClientConfig } from '@island.is/clients/regulations'
import { DraftRegulationModule } from './modules/draft_regulation'
import { DraftRegulationChangeModule } from './modules/draft_regulation_change'
Expand All @@ -31,7 +31,7 @@ import { SequelizeConfigService } from './sequelizeConfig.service'
load: [
RegulationsClientConfig,
XRoadConfig,
NationalRegistryClientConfig,
NationalRegistryV3ClientConfig,
IdsClientConfig,
],
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { DraftRegulationModel } from './draft_regulation.model'
import { DraftRegulationChangeModule } from '../draft_regulation_change'
import { DraftRegulationCancelModule } from '../draft_regulation_cancel'
import { RegulationsService } from '@island.is/clients/regulations'
import { NationalRegistryClientModule } from '@island.is/clients/national-registry-v2'
import { NationalRegistryV3ClientModule } from '@island.is/clients/national-registry-v3'
import { DraftAuthorModule } from '../draft_author'

@Module({
Expand All @@ -16,7 +16,7 @@ import { DraftAuthorModule } from '../draft_author'
DraftAuthorModule,
DraftRegulationChangeModule,
DraftRegulationCancelModule,
NationalRegistryClientModule,
NationalRegistryV3ClientModule,
],
providers: [DraftRegulationService, RegulationsService],
controllers: [DraftRegulationController],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
} from '@island.is/regulations/admin'
import { Kennitala, RegQueryName } from '@island.is/regulations'
import * as kennitala from 'kennitala'
import { NationalRegistryClientService } from '@island.is/clients/national-registry-v2'
import { NationalRegistryV3ClientService } from '@island.is/clients/national-registry-v3'
import type { User } from '@island.is/auth-nest-tools'

const sortImpacts = (
Expand All @@ -54,7 +54,7 @@ export class DraftRegulationService {
private readonly regulationsService: RegulationsService,
@Inject(LOGGER_PROVIDER)
private readonly logger: Logger,
private readonly nationalRegistryApi: NationalRegistryClientService,
private readonly nationalRegistryApi: NationalRegistryV3ClientService,
) {}

async getAll(user?: User, page = 1): Promise<TaskListType> {
Expand Down Expand Up @@ -337,12 +337,14 @@ export class DraftRegulationService {

if (!author) {
try {
const person = await this.nationalRegistryApi.getIndividual(
const person = await this.nationalRegistryApi.getAllDataIndividual(
nationalId,
false,
)
if (person?.name) {

if (person?.nafn) {
author = {
name: person.name,
name: person.nafn,
authorId: nationalId,
}
await this.draftAuthorService.create(author)
Expand Down
9 changes: 5 additions & 4 deletions charts/islandis/values.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1865,15 +1865,15 @@ regulations-admin-backend:
IDENTITY_SERVER_CLIENT_ID: '@island.is/clients/regulations-admin-api'
IDENTITY_SERVER_ISSUER_URL: 'https://identity-server.dev01.devland.is'
LOG_LEVEL: 'info'
NATIONAL_REGISTRY_B2C_CLIENT_ID: 'b464afdd-056b-406d-b650-6d41733cfeb7'
NATIONAL_REGISTRY_B2C_ENDPOINT: 'https://skraidentitydev.b2clogin.com/skraidentitydev.onmicrosoft.com/b2c_1_midlun_flow/oauth2/v2.0/token'
NATIONAL_REGISTRY_B2C_PATH: 'IS-DEV/GOV/10001/SKRA-Cloud-Protected/Midlun-v1'
NATIONAL_REGISTRY_B2C_SCOPE: 'https://skraidentitydev.onmicrosoft.com/midlun/.default'
NODE_OPTIONS: '--max-old-space-size=460 -r dd-trace/init'
SERVERSIDE_FEATURES_ON: ''
XROAD_BASE_PATH: 'http://securityserver.dev01.devland.is'
XROAD_BASE_PATH_WITH_ENV: 'http://securityserver.dev01.devland.is/r1/IS-DEV'
XROAD_CLIENT_ID: 'IS-DEV/GOV/10000/island-is-client'
XROAD_NATIONAL_REGISTRY_REDIS_NODES: '["clustercfg.general-redis-cluster-group.5fzau3.euw1.cache.amazonaws.com:6379"]'
XROAD_NATIONAL_REGISTRY_SERVICE_PATH: 'IS-DEV/GOV/10001/SKRA-Protected/Einstaklingar-v1'
XROAD_TJODSKRA_API_PATH: '/SKRA-Protected/Einstaklingar-v1'
XROAD_TJODSKRA_MEMBER_CODE: '10001'
XROAD_TLS_BASE_PATH: 'https://securityserver.dev01.devland.is'
XROAD_TLS_BASE_PATH_WITH_ENV: 'https://securityserver.dev01.devland.is/r1/IS-DEV'
grantNamespaces:
Expand Down Expand Up @@ -1941,6 +1941,7 @@ regulations-admin-backend:
CONFIGCAT_SDK_KEY: '/k8s/configcat/CONFIGCAT_SDK_KEY'
DB_PASS: '/k8s/regulations-admin-backend/DB_PASSWORD'
IDENTITY_SERVER_CLIENT_SECRET: '/k8s/services-regulations-admin/IDENTITY_SERVER_CLIENT_SECRET'
NATIONAL_REGISTRY_B2C_CLIENT_SECRET: '/k8s/api/NATIONAL_REGISTRY_B2C_CLIENT_SECRET'
REGULATIONS_API_URL: '/k8s/api/REGULATIONS_API_URL'
REGULATIONS_FILE_UPLOAD_KEY_DRAFT: '/k8s/api/REGULATIONS_FILE_UPLOAD_KEY_DRAFT'
REGULATIONS_FILE_UPLOAD_KEY_PRESIGNED: '/k8s/api/REGULATIONS_FILE_UPLOAD_KEY_PRESIGNED'
Expand Down
9 changes: 5 additions & 4 deletions charts/islandis/values.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1733,15 +1733,15 @@ regulations-admin-backend:
IDENTITY_SERVER_CLIENT_ID: '@island.is/clients/regulations-admin-api'
IDENTITY_SERVER_ISSUER_URL: 'https://innskra.island.is'
LOG_LEVEL: 'info'
NATIONAL_REGISTRY_B2C_CLIENT_ID: '2304d7ca-7ed3-4188-8b6d-e1b7e0e3df7f'
NATIONAL_REGISTRY_B2C_ENDPOINT: 'https://skraidentity.b2clogin.com/skraidentity.onmicrosoft.com/b2c_1_midlun_flow/oauth2/v2.0/token'
NATIONAL_REGISTRY_B2C_PATH: 'IS/GOV/6503760649/SKRA-Cloud-Protected/Midlun-v1'
NATIONAL_REGISTRY_B2C_SCOPE: 'https://skraidentity.onmicrosoft.com/midlun/.default'
NODE_OPTIONS: '--max-old-space-size=460 -r dd-trace/init'
SERVERSIDE_FEATURES_ON: 'driving-license-use-v1-endpoint-for-v2-comms'
XROAD_BASE_PATH: 'http://securityserver.island.is'
XROAD_BASE_PATH_WITH_ENV: 'http://securityserver.island.is/r1/IS'
XROAD_CLIENT_ID: 'IS/GOV/5501692829/island-is-client'
XROAD_NATIONAL_REGISTRY_REDIS_NODES: '["clustercfg.general-redis-cluster-group.whakos.euw1.cache.amazonaws.com:6379"]'
XROAD_NATIONAL_REGISTRY_SERVICE_PATH: 'IS/GOV/6503760649/SKRA-Protected/Einstaklingar-v1'
XROAD_TJODSKRA_API_PATH: '/SKRA-Protected/Einstaklingar-v1'
XROAD_TJODSKRA_MEMBER_CODE: '6503760649'
XROAD_TLS_BASE_PATH: 'https://securityserver.island.is'
XROAD_TLS_BASE_PATH_WITH_ENV: 'https://securityserver.island.is/r1/IS'
grantNamespaces:
Expand Down Expand Up @@ -1809,6 +1809,7 @@ regulations-admin-backend:
CONFIGCAT_SDK_KEY: '/k8s/configcat/CONFIGCAT_SDK_KEY'
DB_PASS: '/k8s/regulations-admin-backend/DB_PASSWORD'
IDENTITY_SERVER_CLIENT_SECRET: '/k8s/services-regulations-admin/IDENTITY_SERVER_CLIENT_SECRET'
NATIONAL_REGISTRY_B2C_CLIENT_SECRET: '/k8s/api/NATIONAL_REGISTRY_B2C_CLIENT_SECRET'
REGULATIONS_API_URL: '/k8s/api/REGULATIONS_API_URL'
REGULATIONS_FILE_UPLOAD_KEY_DRAFT: '/k8s/api/REGULATIONS_FILE_UPLOAD_KEY_DRAFT'
REGULATIONS_FILE_UPLOAD_KEY_PRESIGNED: '/k8s/api/REGULATIONS_FILE_UPLOAD_KEY_PRESIGNED'
Expand Down
9 changes: 5 additions & 4 deletions charts/islandis/values.staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1607,15 +1607,15 @@ regulations-admin-backend:
IDENTITY_SERVER_CLIENT_ID: '@island.is/clients/regulations-admin-api'
IDENTITY_SERVER_ISSUER_URL: 'https://identity-server.staging01.devland.is'
LOG_LEVEL: 'info'
NATIONAL_REGISTRY_B2C_CLIENT_ID: 'ca128c23-b43c-443d-bade-ec5a146a933f'
NATIONAL_REGISTRY_B2C_ENDPOINT: 'https://skraidentitydev.b2clogin.com/skraidentitystaging.onmicrosoft.com/b2c_1_midlun_flow/oauth2/v2.0/token'
NATIONAL_REGISTRY_B2C_PATH: 'IS-TEST/GOV/6503760649/SKRA-Cloud-Protected/Midlun-v1'
NATIONAL_REGISTRY_B2C_SCOPE: 'https://skraidentitystaging.onmicrosoft.com/midlun/.default'
NODE_OPTIONS: '--max-old-space-size=460 -r dd-trace/init'
SERVERSIDE_FEATURES_ON: ''
XROAD_BASE_PATH: 'http://securityserver.staging01.devland.is'
XROAD_BASE_PATH_WITH_ENV: 'http://securityserver.staging01.devland.is/r1/IS-TEST'
XROAD_CLIENT_ID: 'IS-TEST/GOV/5501692829/island-is-client'
XROAD_NATIONAL_REGISTRY_REDIS_NODES: '["clustercfg.general-redis-cluster-group.ab9ckb.euw1.cache.amazonaws.com:6379"]'
XROAD_NATIONAL_REGISTRY_SERVICE_PATH: 'IS-TEST/GOV/6503760649/SKRA-Protected/Einstaklingar-v1'
XROAD_TJODSKRA_API_PATH: '/SKRA-Protected/Einstaklingar-v1'
XROAD_TJODSKRA_MEMBER_CODE: '6503760649'
XROAD_TLS_BASE_PATH: 'https://securityserver.staging01.devland.is'
XROAD_TLS_BASE_PATH_WITH_ENV: 'https://securityserver.staging01.devland.is/r1/IS-TEST'
grantNamespaces:
Expand Down Expand Up @@ -1683,6 +1683,7 @@ regulations-admin-backend:
CONFIGCAT_SDK_KEY: '/k8s/configcat/CONFIGCAT_SDK_KEY'
DB_PASS: '/k8s/regulations-admin-backend/DB_PASSWORD'
IDENTITY_SERVER_CLIENT_SECRET: '/k8s/services-regulations-admin/IDENTITY_SERVER_CLIENT_SECRET'
NATIONAL_REGISTRY_B2C_CLIENT_SECRET: '/k8s/api/NATIONAL_REGISTRY_B2C_CLIENT_SECRET'
REGULATIONS_API_URL: '/k8s/api/REGULATIONS_API_URL'
REGULATIONS_FILE_UPLOAD_KEY_DRAFT: '/k8s/api/REGULATIONS_FILE_UPLOAD_KEY_DRAFT'
REGULATIONS_FILE_UPLOAD_KEY_PRESIGNED: '/k8s/api/REGULATIONS_FILE_UPLOAD_KEY_PRESIGNED'
Expand Down

0 comments on commit dddefda

Please sign in to comment.