Skip to content

Commit

Permalink
feat(DTFS2-7052): code style improvements based on PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
avaitonis committed May 13, 2024
1 parent 32aa1ef commit 38939db
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ APIM_INFORMATICA_URL=
APIM_INFORMATICA_USERNAME=
APIM_INFORMATICA_PASSWORD=
APIM_INFORMATICA_MAX_REDIRECTS=
APIM_INFORMATICA_TIMEOUT=
APIM_INFORMATICA_TIMEOUT= # in milliseconds

# ORDNANCE SURVEY
# Use .uk domain, instead of .co.uk
ORDNANCE_SURVEY_URL=
ORDNANCE_SURVEY_KEY=
ORDNANCE_SURVEY_MAX_REDIRECTS=
ORDNANCE_SURVEY_TIMEOUT=
ORDNANCE_SURVEY_TIMEOUT= # in milliseconds
2 changes: 1 addition & 1 deletion src/config/informatica.config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('informaticaConfig', () => {
{
configPropertyName: 'timeout',
environmentVariableName: 'APIM_INFORMATICA_TIMEOUT',
defaultConfigValue: 30000,
defaultConfigValue: 30000, // in milliseconds
},
];

Expand Down
2 changes: 1 addition & 1 deletion src/config/informatica.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export default registerAs(
username: process.env.APIM_INFORMATICA_USERNAME,
password: process.env.APIM_INFORMATICA_PASSWORD,
maxRedirects: getIntConfig(process.env.APIM_INFORMATICA_MAX_REDIRECTS, 5),
timeout: getIntConfig(process.env.APIM_INFORMATICA_TIMEOUT, 30000),
timeout: getIntConfig(process.env.APIM_INFORMATICA_TIMEOUT, 30000), // in milliseconds
}),
);
2 changes: 1 addition & 1 deletion src/config/ordnance-survey.config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('ordnanceSurveyConfig', () => {
{
configPropertyName: 'timeout',
environmentVariableName: 'ORDNANCE_SURVEY_TIMEOUT',
defaultConfigValue: 30000,
defaultConfigValue: 30000, // in milliseconds
},
];

Expand Down
2 changes: 1 addition & 1 deletion src/config/ordnance-survey.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ export default registerAs(
baseUrl: process.env.ORDNANCE_SURVEY_URL,
key: process.env.ORDNANCE_SURVEY_KEY,
maxRedirects: getIntConfig(process.env.ORDNANCE_SURVEY_MAX_REDIRECTS, 5),
timeout: getIntConfig(process.env.ORDNANCE_SURVEY_TIMEOUT, 30000),
timeout: getIntConfig(process.env.ORDNANCE_SURVEY_TIMEOUT, 30000), // in milliseconds
}),
);
2 changes: 1 addition & 1 deletion src/constants/enums/geospatialCountries.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export enum GeospatialCountriesEnum {
E = 'England',
N = 'Northern Ireland',
S = 'Scotland',
W = 'Wales',
N = 'Northern Ireland',
}
1 change: 1 addition & 0 deletions src/constants/geospatial.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const GEOSPATIAL = {
},
REGEX: {
// UK postcode regex is from DTFS project and slightly optimised by lint.
// https://github.com/UK-Export-Finance/dtfs2/blob/main/portal-api/src/constants/regex.js
UK_POSTCODE: /^[A-Za-z]{1,2}[\dRr][\dA-Za-z]?\s?\d[ABD-HJLNP-UW-Zabd-hjlnp-uw-z]{2}$/,
},
};
4 changes: 2 additions & 2 deletions src/helper-modules/ordnance-survey/ordnance-survey.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { OrdnanceSurveyService } from './ordnance-survey.service';
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => {
const { baseUrl, maxRedirects, timeout } = configService.get<OrdnanceSurveyConfig>(ORDNANCE_SURVEY_CONFIG_KEY);
const { baseUrl: baseURL, maxRedirects, timeout } = configService.get<OrdnanceSurveyConfig>(ORDNANCE_SURVEY_CONFIG_KEY);
return {
baseURL: baseUrl,
baseURL,
maxRedirects,
timeout,
};
Expand Down

0 comments on commit 38939db

Please sign in to comment.