Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make IDIR fields env variables #57

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ IN_PERSON_VISITS_WORKSPACE='workspace here'
ATTACHMENTS_WORKSPACE='workspace here'
IN_PERSON_VISITS_POST_WORKSPACE='workspace here'
CONTACTS_WORKSPACE='workspace here'
CASE_IDIR_FIELD='idir field here'
INCIDENT_IDIR_FIELD='idir field here'
SR_IDIR_FIELD='idir field here'
MEMO_IDIR_FIELD='idir field here'
SKIP_AUTH_GUARD=false

# Cypress testing only variables. Not required for build
Expand Down
20 changes: 20 additions & 0 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,26 @@ spec:
secretKeyRef:
name: visitz-api
key: CONTACTS_WORKSPACE
- name: CASE_IDIR_FIELD
valueFrom:
secretKeyRef:
name: visitz-api
key: CASE_IDIR_FIELD
- name: INCIDENT_IDIR_FIELD
valueFrom:
secretKeyRef:
name: visitz-api
key: INCIDENT_IDIR_FIELD
- name: SR_IDIR_FIELD
valueFrom:
secretKeyRef:
name: visitz-api
key: SR_IDIR_FIELD
- name: MEMO_IDIR_FIELD
valueFrom:
secretKeyRef:
name: visitz-api
key: MEMO_IDIR_FIELD
- name: VPI_APP_LABEL
value: {{ .Values.vpiAppBuildLabel.version }}
restartPolicy: Always
3 changes: 0 additions & 3 deletions src/common/guards/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ export class AuthService {
this.configService.get<string>(`upstreamAuth.${recordType}.endpoint`) +
id;

this.logger.log({ url, params });

let response;
try {
const token =
Expand All @@ -116,7 +114,6 @@ export class AuthService {
response = await firstValueFrom(
this.httpService.get(url, { params, headers }),
);
this.logger.log({ data: response.data });
const idir =
response.data[
this.configService.get<string>(`upstreamAuth.${recordType}.idirField`)
Expand Down
8 changes: 4 additions & 4 deletions src/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ export default () => ({
case: {
endpoint: encodeURI((process.env.CASE_ENDPOINT ?? ' ').trim()),
workspace: process.env.CASE_WORKSPACE ?? undefined,
idirField: 'Sales Rep',
idirField: process.env.CASE_IDIR_FIELD ?? undefined,
},
incident: {
endpoint: encodeURI((process.env.INCIDENT_ENDPOINT ?? ' ').trim()),
workspace: process.env.INCIDENT_WORKSPACE ?? undefined,
idirField: 'Owned By',
idirField: process.env.INCIDENT_IDIR_FIELD ?? undefined,
// TODO: change to Assigned To when this is ready
},
sr: {
endpoint: encodeURI((process.env.SR_ENDPOINT ?? ' ').trim()),
workspace: process.env.SR_WORKSPACE ?? undefined,
idirField: 'Assigned To',
idirField: process.env.SR_IDIR_FIELD ?? undefined,
},
memo: {
endpoint: encodeURI((process.env.MEMO_ENDPOINT ?? ' ').trim()),
workspace: process.env.MEMO_WORKSPACE ?? undefined,
idirField: 'Assigned To',
idirField: process.env.MEMO_IDIR_FIELD ?? undefined,
},
},
oauth: {
Expand Down
4 changes: 4 additions & 0 deletions src/external-api/token-refresher/token-refresher.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export class TokenRefresherService {
response = await firstValueFrom(
this.httpService.post(this.accessTokenUrl, data, { headers }),
);
this.logger.log({
functionName: 'authenticateUpstream',
data: response.data,
});
const access_token = response.data['access_token'];
const token_type = response.data['token_type'];
const expirySeconds = response.data['expires_in'];
Expand Down