Skip to content

Commit

Permalink
feat: add option to disable access to cloud metadata services
Browse files Browse the repository at this point in the history
  • Loading branch information
fgreinacher committed Dec 22, 2023
1 parent 5d95ece commit 7eb6b12
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/workers/global/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ function setGlobalHostRules(config: RenovateConfig): void {
}
}

function configureThirdPartyLibraries(config: AllConfig): void {
if (!config.useCloudMetadataServices) {
logger.debug('Disabling the use of cloud metadata services');
process.env.AWS_EC2_METADATA_DISABLED = 'true'; // See https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html#envvars-list
process.env.METADATA_SERVER_DETECTION = 'none'; // See https://cloud.google.com/nodejs/docs/reference/gcp-metadata/latest#environment-variables
}
}

export async function globalInitialize(
config_: AllConfig,
): Promise<RenovateConfig> {
Expand All @@ -76,6 +84,7 @@ export async function globalInitialize(
limitCommitsPerRun(config);
setEmojiConfig(config);
setGlobalHostRules(config);
configureThirdPartyLibraries(config);
await initMergeConfidence();
return config;
}
Expand Down

0 comments on commit 7eb6b12

Please sign in to comment.