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

amend initialise function #20

Merged
merged 7 commits into from
Sep 5, 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
8 changes: 4 additions & 4 deletions app/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ const setupBlobServiceClient = () => {
} else {
const uri = `https://${storageConfig.storageAccount}.blob.core.windows.net`
let credential
if (storageConfig.clientId && storageConfig.clientSecret && storageConfig.tenantId) {
if (storageConfig.demographicsClientId && storageConfig.demographicsClientSecret && storageConfig.demographicsTenantId) {
console.log('Using Service Principal for BlobServiceClient')
credential = new ClientSecretCredential(
storageConfig.tenantId,
storageConfig.clientId,
storageConfig.clientSecret
storageConfig.demographicsTenantId,
storageConfig.demographicsClientId,
storageConfig.demographicsClientSecret
)
} else {
console.log('Using DefaultAzureCredential for BlobServiceClient')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ffc-pay-demographics",
"version": "1.2.6",
"version": "1.2.7",
"description": "Process customer updates",
"homepage": "https://github.com/DEFRA/ffc-pay-demographics",
"main": "app/index.js",
Expand Down
12 changes: 6 additions & 6 deletions test/storage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ describe('storage', () => {

test('should use DefaultAzureCredential when useConnectionStr is false and no client credentials are provided', async () => {
storageConfig.useConnectionStr = false
storageConfig.clientId = null
storageConfig.clientSecret = null
storageConfig.tenantId = null
storageConfig.demographicsClientId = null
storageConfig.demographicsClientSecret = null
storageConfig.demographicsTenantId = null

await initialiseContainers()

Expand All @@ -178,9 +178,9 @@ describe('storage', () => {

test('should use ClientSecretCredential when client credentials are provided', async () => {
storageConfig.useConnectionStr = false
storageConfig.clientId = 'mock-client-id'
storageConfig.clientSecret = 'mock-client-secret'
storageConfig.tenantId = 'mock-tenant-id'
storageConfig.demographicsClientId = 'mock-client-id'
storageConfig.demographicsClientSecret = 'mock-client-secret'
storageConfig.demographicsTenantId = 'mock-tenant-id'

await initialiseContainers()

Expand Down