mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
Improve code readability Aws node
This commit is contained in:
23
packages/nodes-base/nodes/Aws/GenericFunctions.ts
Normal file
23
packages/nodes-base/nodes/Aws/GenericFunctions.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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}`,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user