Prefix all of the environmental variables so that it reduces the risk of var name conflicts with other apps.
This commit is contained in:
Elliot Huffman 2022-04-10 14:49:13 -04:00
Родитель ed6bb44e76
Коммит 1f7c867d7e
5 изменённых файлов: 14 добавлений и 14 удалений

Просмотреть файл

@ -26,7 +26,7 @@ export class SwaggerUI {
initSwaggerUI(): void {
// Import environmental variables
const port = process.env.PORT || 3000;
const port = process.env.PSM_PORT || 3000;
// Set the app version in the API Doc
openAPIDoc.info.version = appVersion;

Просмотреть файл

@ -22,12 +22,12 @@ export class MSAzureAccessCredential {
// Initialize the Access Credential class when instantiated
constructor() {
// Import environmental variables
this.clientID = process.env.Client_GUID || ""
this.clientSecret = process.env.Client_Secret || ""
this.tenantID = process.env.Tenant_ID || ""
this.managedIdentGUID = process.env.Managed_ID_GUID || "None"
this.keyVaultName = process.env.KeyVault_Name
this.kvSecretName = process.env.KeyVault_Secret
this.clientID = process.env.PSM_Client_GUID || ""
this.clientSecret = process.env.PSM_Client_Secret || ""
this.tenantID = process.env.PSM_Tenant_ID || ""
this.managedIdentGUID = process.env.PSM_Managed_ID_GUID || "None"
this.keyVaultName = process.env.PSM_KeyVault_Name
this.kvSecretName = process.env.PSM_KeyVault_Secret
// Validate environmental variable input to ensure that the input is as expected and not an injection attempt.
if (!validateGUID(this.clientID) && this.clientID !== "") { throw new Error("Client ID is not configured properly!") };

Просмотреть файл

@ -77,18 +77,18 @@ export class ConfigurationEngine {
writeDebugInfo("Initialized standard class properties");
// Write debug info
writeDebugInfo(process.env.Scope_Tag, "Scope_Tag environmental variable value:");
writeDebugInfo(process.env.PSM_Scope_Tag, "Scope_Tag environmental variable value:");
// Check to make sure the scope_tag variable is present
if (typeof process.env.Scope_Tag !== "string") {
if (typeof process.env.PSM_Scope_Tag !== "string") {
// Write debug info
writeDebugInfo((typeof process.env.Scope_Tag), "Scope_Tag env var is not a string:");
writeDebugInfo((typeof process.env.PSM_Scope_Tag), "Scope_Tag env var is not a string:");
// If it isn't set the scope tag name to a predefined tag name
this.scopeTagName = "Priv Sec Mgmt App"
} else {
// If it is present, set the scope tag name to the specified tag name
this.scopeTagName = process.env.Scope_Tag;
this.scopeTagName = process.env.PSM_Scope_Tag;
// Write debug info
writeDebugInfo(this.scopeTagName, "Set scopeTagName:");

Просмотреть файл

@ -5,7 +5,7 @@
// Write debug data to the console if debug mode is turned on
export function writeDebugInfo(object: any, message?: any): void {
// Gather the debug mode setting from the current environmental variable set
const debugMode = process.env.Debug || "false";
const debugMode = process.env.PSM_Debug || "false";
// If the debug mode value is "true" write to the console
if (debugMode === "true") {

Просмотреть файл

@ -13,8 +13,8 @@ import { SwaggerUI } from "./Routes/OpenAPI";
import { writeDebugInfo } from "./Utility/Utility";
// Import environmental variables
const port = process.env.PORT || 3000;
const debugMode = process.env.Debug || "false"
const port = process.env.PSM_PORT || 3000;
const debugMode = process.env.PSM_Debug || "false"
// Generate an authentication session that can create access tokens.
// This will automatically use available credentials available in Managed Identity, Key Vault or environmental vars.