Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
require('dotenv').config();
const random = require('math-random');
// Setting default environment variables.
process.env = {
AAD_OAUTH_AUTHORIZE_URL: 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize',
AAD_OAUTH_ACCESS_TOKEN_URL: 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token',
AAD_OAUTH_PKCE_SALT: random.toString(36).substr(2),
AAD_OAUTH_SCOPE: 'User.Read',
GITHUB_OAUTH_ACCESS_TOKEN_URL: 'https://github.com/login/oauth/access_token',
GITHUB_OAUTH_AUTHORIZE_URL: 'https://github.com/login/oauth/authorize',
GITHUB_OAUTH_SCOPE: 'user:email',
GITHUB_OAUTH_STATE_SALT: random.toString(36).substr(2),
PORT: '5000',
STATIC_FILES: 'public',
...process.env
};
// Checks for required environment variables.
[
'AAD_OAUTH_CLIENT_ID',
'AAD_OAUTH_REDIRECT_URI',
'DIRECT_LINE_SECRET',
'GITHUB_OAUTH_CLIENT_ID',
'GITHUB_OAUTH_CLIENT_SECRET',
'GITHUB_OAUTH_REDIRECT_URI'
].forEach(name => {
if (!process.env[name]) {
throw new Error(`Environment variable ${name} must be set.`);
require('dotenv').config();
const random = require('math-random');
// Setting default environment variables.
process.env = {
OAUTH_AUTHORIZE_URL: 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize',
OAUTH_ACCESS_TOKEN_URL: 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token',
OAUTH_PKCE_SALT: random.toString(36).substr(2),
OAUTH_SCOPE: 'User.Read',
PORT: '5000',
STATIC_FILES: 'public',
...process.env
};
// Checks for required environment variables.
['OAUTH_CLIENT_ID', 'OAUTH_REDIRECT_URI', 'DIRECT_LINE_SECRET'].forEach(name => {
if (!process.env[name]) {
throw new Error(`Environment variable ${name} must be set.`);
}
});
const { join } = require('path');
const restify = require('restify');