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

fix: z/OSMF static definition file processing in v2 #4164

Open
wants to merge 1 commit into
base: v2.x/staging
Choose a base branch
from
Open
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
42 changes: 42 additions & 0 deletions bin/libs/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,32 @@ export function findAllLaunchComponents2(): string[] {
});
}

function getBooleanEnv(variableName) {
const value = std.getenv(`${variableName}`);
if (value === "true") {
return true
}
if (value === "false") {
return false
}
return undefined
}


function isClientAttls() {
const clientGlobalAttls = getBooleanEnv('ZWE_zowe_network_client_tls_attls');
const serverGlobalAttls = getBooleanEnv('ZWE_zowe_network_server_tls_attls');
const clientLocalAttls = getBooleanEnv('ZWE_components_zaas_zowe_network_client_tls_attls');
const serverLocalAttls = getBooleanEnv('ZWE_components_zaas_zowe_network_server_tls_attls');
const clientAttls = clientGlobalAttls || clientLocalAttls;
if ((clientGlobalAttls !== false) && (clientLocalAttls !== false) && (!clientAttls)) {
// If client attls not explicitly false OR truthy, have client follow server attls variable. it simplifies common case in which users want both.
return serverGlobalAttls || serverLocalAttls;
} else {
return clientAttls;
}
}

export function processComponentApimlStaticDefinitions(componentDir: string): boolean {
const STATIC_DEF_DIR=std.getenv('ZWE_STATIC_DEFINITIONS_DIR');
if (!STATIC_DEF_DIR) {
Expand Down Expand Up @@ -418,6 +444,22 @@ export function processComponentApimlStaticDefinitions(componentDir: string): bo

const contents = xplatform.loadFileUTF8(path,xplatform.AUTO_DETECT);
if (contents) {
const zosmfScheme = std.getenv("ZOSMF_SCHEME");
const attls = isClientAttls()
const schemeEnv = std.getenv("ZWE_zOSMF_scheme");

let scheme = "https";

if (zosmfScheme) {
scheme = zosmfScheme;
} else if (schemeEnv) {
scheme = schemeEnv;
} else if (attls) {
scheme = "http";
}

std.setenv('ZOSMF_SCHEME', scheme);

const resolvedContents = varlib.resolveShellTemplate(contents);

const zweCliParameterHaInstance=std.getenv("ZWE_CLI_PARAMETER_HA_INSTANCE");
Expand Down
Loading