mirror of
https://github.com/strapi/strapi.git
synced 2025-09-17 20:40:17 +00:00
fix: make aws credentials optional
This commit is contained in:
parent
d999ad0b00
commit
1d64d58bb8
@ -16,7 +16,7 @@ const defaultOptions = {
|
|||||||
|
|
||||||
describe('Utils', () => {
|
describe('Utils', () => {
|
||||||
describe('Extract credentials for V4 different aws provider configurations', () => {
|
describe('Extract credentials for V4 different aws provider configurations', () => {
|
||||||
test('[Legacy] Credentials directly in the options', async () => {
|
test('[Legacy] Credentials directly in the options', () => {
|
||||||
const options: InitOptions = {
|
const options: InitOptions = {
|
||||||
accessKeyId,
|
accessKeyId,
|
||||||
secretAccessKey,
|
secretAccessKey,
|
||||||
@ -30,7 +30,7 @@ describe('Utils', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('[Legacy] credentials directly in s3Options', async () => {
|
test('[Legacy] credentials directly in s3Options', () => {
|
||||||
const options: InitOptions = {
|
const options: InitOptions = {
|
||||||
s3Options: {
|
s3Options: {
|
||||||
accessKeyId,
|
accessKeyId,
|
||||||
@ -46,7 +46,7 @@ describe('Utils', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Credentials in credentials object inside s3Options', async () => {
|
test('Credentials in credentials object inside s3Options', () => {
|
||||||
const options: InitOptions = {
|
const options: InitOptions = {
|
||||||
s3Options: {
|
s3Options: {
|
||||||
credentials: {
|
credentials: {
|
||||||
@ -63,5 +63,15 @@ describe('Utils', () => {
|
|||||||
secretAccessKey,
|
secretAccessKey,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
test('Does not throw an error when are not present', () => {
|
||||||
|
const options: InitOptions = {
|
||||||
|
s3Options: {
|
||||||
|
...defaultOptions,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const credentials = extractCredentials(options);
|
||||||
|
|
||||||
|
expect(credentials).toEqual({});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -114,6 +114,5 @@ export const extractCredentials = (options: InitOptions): AwsCredentialIdentity
|
|||||||
secretAccessKey: options.s3Options.credentials.secretAccessKey,
|
secretAccessKey: options.s3Options.credentials.secretAccessKey,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
return {};
|
||||||
throw new Error("Couldn't find AWS credentials.");
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user