Skip to content

Commit c9157f7

Browse files
authored
chore: revert DB connection to managed identities
Refs: #638
1 parent f69ec26 commit c9157f7

File tree

3 files changed

+14
-31
lines changed

3 files changed

+14
-31
lines changed

.changeset/sweet-wings-act.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"io-wallet-user-func": patch
3+
---
4+
5+
Switched DB connection from connection string to Managed Identity

apps/io-wallet-user-func/src/app/config.ts

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,7 @@ const AzureFrontDoorConfig = t.type({
135135
type AzureFrontDoorConfig = t.TypeOf<typeof AzureFrontDoorConfig>;
136136

137137
const AzureConfig = t.type({
138-
cosmos: t.intersection([
139-
AzureCosmosConfig,
140-
t.type({ connectionString: t.string }),
141-
]),
138+
cosmos: AzureCosmosConfig,
142139
frontDoor: AzureFrontDoorConfig,
143140
generic: AzureGenericConfig,
144141
storage: AzureStorageConfig,
@@ -415,24 +412,12 @@ export const getAzureConfigFromEnvironment: RE.ReaderEither<
415412
NodeJS.ProcessEnv,
416413
Error,
417414
AzureConfig
418-
> = pipe(
419-
sequenceS(RE.Apply)({
420-
cosmos: getAzureCosmosConfigFromEnvironment,
421-
cosmosAccountConnectionString: readFromEnvironment(
422-
"CosmosAccountConnectionString",
423-
),
424-
frontDoor: getAzureFrontDoorConfigFromEnvironment,
425-
generic: getAzureGenericConfigFromEnvironment,
426-
storage: getAzureStorageConfigFromEnvironment,
427-
}),
428-
RE.map(({ cosmos, cosmosAccountConnectionString, ...rest }) => ({
429-
...rest,
430-
cosmos: {
431-
...cosmos,
432-
connectionString: cosmosAccountConnectionString,
433-
},
434-
})),
435-
);
415+
> = sequenceS(RE.Apply)({
416+
cosmos: getAzureCosmosConfigFromEnvironment,
417+
frontDoor: getAzureFrontDoorConfigFromEnvironment,
418+
generic: getAzureGenericConfigFromEnvironment,
419+
storage: getAzureStorageConfigFromEnvironment,
420+
});
436421

437422
const getPidIssuerConfigFromEnvironment: RE.ReaderEither<
438423
NodeJS.ProcessEnv,

apps/io-wallet-user-func/src/app/main.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,12 @@ const config = configOrError;
5555

5656
const credential = new DefaultAzureCredential();
5757

58-
// const cosmosClient = new CosmosClient({
59-
// aadCredentials: credential,
60-
// connectionPolicy: {
61-
// requestTimeout: config.azure.cosmos.requestTimeout,
62-
// },
63-
// endpoint: config.azure.cosmos.endpoint,
64-
// });
65-
6658
const cosmosClient = new CosmosClient({
59+
aadCredentials: credential,
6760
connectionPolicy: {
6861
requestTimeout: config.azure.cosmos.requestTimeout,
6962
},
70-
connectionString: config.azure.cosmos.connectionString,
63+
endpoint: config.azure.cosmos.endpoint,
7164
});
7265

7366
const subscriptionId = config.azure.generic.subscriptionId;

0 commit comments

Comments
 (0)