Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
this.region = providerOptions ? providerOptions.region : undefined;
if (providerOptions.secret) {
this.logger.silly('Got credentials from providerOptions');
if (!this.region) {
const message = 'providerOptions.region is required when providing credentials';
this.logger.info(message);
return q.reject(new Error(message));
}
let credentials;
try {
const credentialsBuf = cloudUtil.createBufferFrom(providerOptions.secret, 'base64');
credentials = JSON.parse(credentialsBuf.toString());
} catch (err) {
this.logger.info('Error parsing credentials');
return q.reject(err);
}
this.compute = new Compute({ credentials });
this.storage = new Storage({ credentials });
// TODO: Add credentials handling to our pubSub client
} else {
this.logger.silly('No provider credentials - assuming we are running in Google Cloud');
this.compute = new Compute();
this.storage = new Storage();
if (this.initOptions.autoscale) {
.then((port) => {
const credentials = cloudUtil.createBufferFrom(
`${wrapper.targetUsername}:${updatedPassword}`,
'ascii'
).toString('base64');
const auth = `Basic ${credentials}`;
const restOperation = this.restOperationFactory.createRestOperationInstance()
.setUri(
`https://${wrapper.targetHost}:${port}/mgmt/shared/authn/root`
)
.setIsSetBasicAuthHeader(true)
.setBasicAuthorization(auth)
.setContentType('application/json')
.setBody(
{
oldPassword: updatedPassword,
newPassword: updatedPassword
}