mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 22:54:05 -08:00
24 lines
590 B
TypeScript
24 lines
590 B
TypeScript
|
import {
|
||
|
IExecuteFunctions,
|
||
|
IHookFunctions,
|
||
|
ILoadOptionsFunctions,
|
||
|
} from 'n8n-core';
|
||
|
|
||
|
import { config } from 'aws-sdk';
|
||
|
import { OptionsWithUri } from 'request';
|
||
|
|
||
|
|
||
|
export async function awsConfigCredentials(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions): Promise<void> {
|
||
|
const credentials = this.getCredentials('aws');
|
||
|
|
||
|
if (credentials === undefined) {
|
||
|
throw new Error('No credentials got returned!');
|
||
|
}
|
||
|
|
||
|
config.update({
|
||
|
region: `${credentials.region}`,
|
||
|
accessKeyId: `${credentials.accessKeyId}`,
|
||
|
secretAccessKey: `${credentials.secretAccessKey}`,
|
||
|
});
|
||
|
}
|