Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JhontSouth committed Oct 9, 2023
1 parent bf851a2 commit da6a85a
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions samples/javascript_nodejs/85.bot-authentication-sni/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
// Licensed under the MIT License.

const path = require('path');
const fs = require('fs');
// const fs = require('fs');
const dotenv = require('dotenv');
const restify = require('restify');
const msal = require('@azure/msal-node');
const { DefaultAzureCredential } = require("@azure/identity");
const { SecretClient } = require("@azure/keyvault-secrets");
const {
MsalServiceClientCredentialsFactory,
} = require("botframework-connector");
const { DefaultAzureCredential } = require('@azure/identity');
const { SecretClient } = require('@azure/keyvault-secrets');
const { MsalServiceClientCredentialsFactory } = require('botframework-connector');

// Import required bot configuration.
const ENV_FILE = path.join(__dirname, '.env');
Expand All @@ -33,19 +31,19 @@ const { AuthBot } = require('./authBot');
server.use(restify.plugins.bodyParser());

server.listen(process.env.port || process.env.PORT || 3978, () => {
console.log(`\n${server.name} listening to ${server.url}`);
console.log(`\n${ server.name } listening to ${ server.url }`);
console.log('\nGet Bot Framework Emulator: https://aka.ms/botframework-emulator');
console.log('\nTo talk to your bot, open the emulator select "Open Bot"');
});

const authorityUrl = "https://login.microsoftonline.com/botframework.com";
const authorityUrl = 'https://login.microsoftonline.com/botframework.com';

// ---- Authenticate using key vault to obtain the certificate values.
// Create an Azure credential to authenticate.
const credential = new DefaultAzureCredential();

const vaultName = process.env.KeyVaultName;
const keyVaultUrl = `https://${vaultName}.vault.azure.net`;
const keyVaultUrl = `https://${ vaultName }.vault.azure.net`;

const certificateName = process.env.CertificateName;

Expand Down Expand Up @@ -76,8 +74,8 @@ const { AuthBot } = require('./authBot');
thumbprint: process.env.CertificateThumbprint,
privateKey: certificateKey,
x5c: x5cValue
},
},
}
}
})
);

Expand All @@ -92,12 +90,12 @@ const { AuthBot } = require('./authBot');
// NOTE: In production environment, you should consider logging this to Azure
// application insights. See https://aka.ms/bottelemetry for telemetry
// configuration instructions.
console.error(`\n [onTurnError] unhandled error: ${error}`);
console.error(`\n [onTurnError] unhandled error: ${ error }`);

// Send a trace activity, which will be displayed in Bot Framework Emulator
await context.sendTraceActivity(
'OnTurnError Trace',
`${error}`,
`${ error }`,
'https://www.botframework.com/schemas/error',
'TurnError'
);
Expand Down Expand Up @@ -128,8 +126,7 @@ const { AuthBot } = require('./authBot');

await streamingAdapter.process(req, socket, head, (context) => myBot.run(context));
});

} catch (error) {
console.log(error)
console.log(error);
}
})();

0 comments on commit da6a85a

Please sign in to comment.