Skip to content

Commit 7d69ef2

Browse files
authored
Allow env vars (#13)
* allow env vars * manually run prettier * rebuild dist * Revert "rebuild dist" This reverts commit 9d56240. * rebuild dist using node16
1 parent d792d9b commit 7d69ef2

File tree

6 files changed

+29
-17
lines changed

6 files changed

+29
-17
lines changed

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ inputs:
3131
required: true
3232
aws-access-key-id:
3333
description: 'An AWS access key id to access the bucket'
34-
required: true
34+
required: false
3535
aws-secret-access-key:
3636
description: 'An AWS secret access key to access the bucket'
37-
required: true
37+
required: false
3838
aws-region:
3939
description: 'An AWS region where the bucket is located'
4040
required: false

dist/restore-only/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15852,10 +15852,12 @@ function getInputS3ClientConfig() {
1585215852
}
1585315853
const s3config = {
1585415854
credentials: {
15855-
accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId),
15856-
secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey)
15855+
accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId) ||
15856+
process.env["AWS_ACCESS_KEY_ID"],
15857+
secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey) ||
15858+
process.env["AWS_SECRET_ACCESS_KEY"]
1585715859
},
15858-
region: core.getInput(constants_1.Inputs.AWSRegion),
15860+
region: core.getInput(constants_1.Inputs.AWSRegion) || process.env["AWS_REGION"],
1585915861
endpoint: core.getInput(constants_1.Inputs.AWSEndpoint),
1586015862
bucketEndpoint: core.getBooleanInput(constants_1.Inputs.AWSS3BucketEndpoint),
1586115863
forcePathStyle: core.getBooleanInput(constants_1.Inputs.AWSS3ForcePathStyle)

dist/restore/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15852,10 +15852,12 @@ function getInputS3ClientConfig() {
1585215852
}
1585315853
const s3config = {
1585415854
credentials: {
15855-
accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId),
15856-
secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey)
15855+
accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId) ||
15856+
process.env["AWS_ACCESS_KEY_ID"],
15857+
secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey) ||
15858+
process.env["AWS_SECRET_ACCESS_KEY"]
1585715859
},
15858-
region: core.getInput(constants_1.Inputs.AWSRegion),
15860+
region: core.getInput(constants_1.Inputs.AWSRegion) || process.env["AWS_REGION"],
1585915861
endpoint: core.getInput(constants_1.Inputs.AWSEndpoint),
1586015862
bucketEndpoint: core.getBooleanInput(constants_1.Inputs.AWSS3BucketEndpoint),
1586115863
forcePathStyle: core.getBooleanInput(constants_1.Inputs.AWSS3ForcePathStyle)

dist/save-only/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15852,10 +15852,12 @@ function getInputS3ClientConfig() {
1585215852
}
1585315853
const s3config = {
1585415854
credentials: {
15855-
accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId),
15856-
secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey)
15855+
accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId) ||
15856+
process.env["AWS_ACCESS_KEY_ID"],
15857+
secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey) ||
15858+
process.env["AWS_SECRET_ACCESS_KEY"]
1585715859
},
15858-
region: core.getInput(constants_1.Inputs.AWSRegion),
15860+
region: core.getInput(constants_1.Inputs.AWSRegion) || process.env["AWS_REGION"],
1585915861
endpoint: core.getInput(constants_1.Inputs.AWSEndpoint),
1586015862
bucketEndpoint: core.getBooleanInput(constants_1.Inputs.AWSS3BucketEndpoint),
1586115863
forcePathStyle: core.getBooleanInput(constants_1.Inputs.AWSS3ForcePathStyle)

dist/save/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15852,10 +15852,12 @@ function getInputS3ClientConfig() {
1585215852
}
1585315853
const s3config = {
1585415854
credentials: {
15855-
accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId),
15856-
secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey)
15855+
accessKeyId: core.getInput(constants_1.Inputs.AWSAccessKeyId) ||
15856+
process.env["AWS_ACCESS_KEY_ID"],
15857+
secretAccessKey: core.getInput(constants_1.Inputs.AWSSecretAccessKey) ||
15858+
process.env["AWS_SECRET_ACCESS_KEY"]
1585715859
},
15858-
region: core.getInput(constants_1.Inputs.AWSRegion),
15860+
region: core.getInput(constants_1.Inputs.AWSRegion) || process.env["AWS_REGION"],
1585915861
endpoint: core.getInput(constants_1.Inputs.AWSEndpoint),
1586015862
bucketEndpoint: core.getBooleanInput(constants_1.Inputs.AWSS3BucketEndpoint),
1586115863
forcePathStyle: core.getBooleanInput(constants_1.Inputs.AWSS3ForcePathStyle)

src/utils/actionUtils.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,14 @@ export function getInputS3ClientConfig(): S3ClientConfig | undefined {
8888

8989
const s3config = {
9090
credentials: {
91-
accessKeyId: core.getInput(Inputs.AWSAccessKeyId),
92-
secretAccessKey: core.getInput(Inputs.AWSSecretAccessKey)
91+
accessKeyId:
92+
core.getInput(Inputs.AWSAccessKeyId) ||
93+
process.env["AWS_ACCESS_KEY_ID"],
94+
secretAccessKey:
95+
core.getInput(Inputs.AWSSecretAccessKey) ||
96+
process.env["AWS_SECRET_ACCESS_KEY"]
9397
},
94-
region: core.getInput(Inputs.AWSRegion),
98+
region: core.getInput(Inputs.AWSRegion) || process.env["AWS_REGION"],
9599
endpoint: core.getInput(Inputs.AWSEndpoint),
96100
bucketEndpoint: core.getBooleanInput(Inputs.AWSS3BucketEndpoint),
97101
forcePathStyle: core.getBooleanInput(Inputs.AWSS3ForcePathStyle)

0 commit comments

Comments
 (0)