Skip to content

Commit

Permalink
ci: add missing env var
Browse files Browse the repository at this point in the history
feat: get current user id from token
  • Loading branch information
Ricardo Campos committed Feb 8, 2024
1 parent 744a815 commit 9486a8f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
file: backend/openshift.deploy.yml
parameters:
-p RESULTS_ENV_OPENSEARCH=test
-p AWS_COGNITO_ISSUER_URI=https://cognito-idp.${{ vars.AWS_REGION }}.amazonaws.com/${{ vars.VITE_USER_POOLS_ID }}
- name: frontend
file: frontend/openshift.deploy.yml
parameters:
Expand Down Expand Up @@ -124,6 +125,7 @@ jobs:
file: backend/openshift.deploy.yml
parameters:
-p RESULTS_ENV_OPENSEARCH=production
-p AWS_COGNITO_ISSUER_URI=https://cognito-idp.${{ vars.AWS_REGION }}.amazonaws.com/${{ vars.VITE_USER_POOLS_ID }}
- name: frontend
file: frontend/openshift.deploy.yml
parameters:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ jobs:
parameters:
-p MIN_REPLICAS=1
-p MAX_REPLICAS=2
-p AWS_COGNITO_ISSUER_URI=https://cognito-idp.${{ vars.AWS_REGION }}.amazonaws.com/${{ vars.VITE_USER_POOLS_ID }}
- name: frontend
file: frontend/openshift.deploy.yml
parameters:
Expand Down
5 changes: 5 additions & 0 deletions backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ parameters:
- name: ORACLEDB_KEYSTORE
description: Keystore location path
value: /app/jssecacerts
- name: AWS_COGNITO_ISSUER_URI
description: AWS Cognito JWT Server URI
required: true
objects:
- apiVersion: v1
kind: ImageStream
Expand Down Expand Up @@ -129,6 +132,8 @@ objects:
value: ${DATABASE_PORT}
- name: SERVICE_NAME
value: ${SERVICE_NAME}
- name: AWS_COGNITO_ISSUER_URI
value: ${AWS_COGNITO_ISSUER_URI}
- name: DATABASE_USER
valueFrom:
secretKeyRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import ca.bc.gov.restapi.results.entity.CutBlockOpenAdminEntity;
import ca.bc.gov.restapi.results.entity.OpeningEntity;
import ca.bc.gov.restapi.results.repository.OpeningRepository;
import ca.bc.gov.restapi.results.security.LoggedUserService;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
Expand All @@ -27,6 +28,8 @@ public class OpeningService {

private final CutBlockOpenAdminService cutBlockOpenAdminService;

private final LoggedUserService loggedUserService;

/**
* Gets all recent openings for the Home Screen.
*
Expand All @@ -38,7 +41,7 @@ public PaginatedResult<RecentOpeningDto> getRecentOpenings(PaginationParameters
pagination.page(),
pagination.pageSize());

String entryUserId = "idir-here";
String entryUserId = loggedUserService.getLoggedUserId();

// Openings
Pageable pageable = PageRequest.of(pagination.page(), pagination.pageSize());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import ca.bc.gov.restapi.results.entity.CutBlockOpenAdminEntity;
import ca.bc.gov.restapi.results.entity.OpeningEntity;
import ca.bc.gov.restapi.results.repository.OpeningRepository;
import ca.bc.gov.restapi.results.security.LoggedUserService;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -30,11 +31,14 @@ class OpeningServiceTest {

@Mock CutBlockOpenAdminService cutBlockOpenAdminService;

@Mock LoggedUserService loggedUserService;

private OpeningService openingService;

@BeforeEach
void setup() {
openingService = new OpeningService(openingRepository, cutBlockOpenAdminService);
openingService =
new OpeningService(openingRepository, cutBlockOpenAdminService, loggedUserService);
}

@Test
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ services:
SERVICE_NAME: dbq01.nrs.bcgov
ORACLEDB_KEYSTORE: /app/jssecacerts
ORACLEDB_SECRET: changeit
AWS_COGNITO_ISSUER_URI: https://cognito-idp.ca-central-1.amazonaws.com/ca-central-1_t2HSZBHur
<<: *backend

backend-native:
Expand Down

0 comments on commit 9486a8f

Please sign in to comment.