@fastly/compute-js-static-publish 8.0.0-beta.7 → 8.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli/cli/commands/manage/clean.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/clean.js +10 -19
- package/build/cli/cli/commands/manage/collections/delete.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/delete.js +10 -19
- package/build/cli/cli/commands/manage/collections/index.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/index.js +5 -12
- package/build/cli/cli/commands/manage/collections/list.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/list.js +10 -19
- package/build/cli/cli/commands/manage/collections/promote.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/promote.js +10 -19
- package/build/cli/cli/commands/manage/collections/update-expiration.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/update-expiration.js +10 -19
- package/build/cli/cli/commands/manage/index.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/index.js +5 -12
- package/build/cli/cli/commands/manage/publish-content.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/publish-content.js +10 -19
- package/build/cli/cli/commands/scaffold/index.js +28 -28
- package/build/cli/cli/storage/s3-storage-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/s3-storage-provider.js +8 -9
- package/build/cli/cli/storage/storage-provider.d.ts +2 -3
- package/build/cli/cli/storage/storage-provider.d.ts.map +1 -1
- package/build/cli/cli/util/s3-credentials.d.ts +11 -0
- package/build/cli/cli/util/s3-credentials.d.ts.map +1 -0
- package/build/cli/cli/util/s3-credentials.js +38 -0
- package/build/cli/cli/util/s3.d.ts +1 -1
- package/build/cli/cli/util/s3.d.ts.map +1 -1
- package/build/cli/cli/util/s3.js +1 -1
- package/build/cli/models/metadata/index.js +1 -1
- package/build/server/models/metadata/index.js +1 -1
- package/build/server/server/index.d.ts +1 -1
- package/build/server/server/index.d.ts.map +1 -1
- package/build/server/server/index.js +1 -1
- package/build/server/server/storage/s3-storage-provider.d.ts +7 -7
- package/build/server/server/storage/s3-storage-provider.d.ts.map +1 -1
- package/build/server/server/storage/s3-storage-provider.js +28 -28
- package/package.json +2 -3
- package/build/cli/cli/util/aws-credentials.d.ts +0 -12
- package/build/cli/cli/util/aws-credentials.d.ts.map +0 -1
- package/build/cli/cli/util/aws-credentials.js +0 -67
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/clean.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/clean.ts"],"names":[],"mappings":"AAoDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAoNhD"}
|
|
@@ -31,20 +31,13 @@ KV Store Options:
|
|
|
31
31
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
32
32
|
If not set, the tool will check:
|
|
33
33
|
1. FASTLY_API_TOKEN environment variable
|
|
34
|
-
2.
|
|
34
|
+
2. The default profile in the Fastly CLI
|
|
35
35
|
|
|
36
36
|
S3 Storage Options (BETA):
|
|
37
|
-
--
|
|
38
|
-
--
|
|
39
|
-
If not set, the tool will check
|
|
40
|
-
|
|
41
|
-
environment variables
|
|
42
|
-
2. The aws credentials file, see below
|
|
43
|
-
|
|
44
|
-
--aws-profile=<profile> Profile within the aws credentials file.
|
|
45
|
-
If not set, the tool will check:
|
|
46
|
-
1. AWS_PROFILE environment variable
|
|
47
|
-
2. The default profile, if set
|
|
37
|
+
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
38
|
+
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
39
|
+
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
40
|
+
and S3_SECRET_ACCESS_KEY environment variables.
|
|
48
41
|
|
|
49
42
|
Global Options:
|
|
50
43
|
-h, --help Show this help message and exit.
|
|
@@ -57,9 +50,8 @@ export async function action(actionArgs) {
|
|
|
57
50
|
{ name: 'dry-run', type: Boolean },
|
|
58
51
|
{ name: 'local', type: Boolean },
|
|
59
52
|
{ name: 'fastly-api-token', type: String, },
|
|
60
|
-
{ name: '
|
|
61
|
-
{ name: '
|
|
62
|
-
{ name: 'aws-secret-access-key', type: String, },
|
|
53
|
+
{ name: 's3-access-key-id', type: String, },
|
|
54
|
+
{ name: 's3-secret-access-key', type: String, },
|
|
63
55
|
];
|
|
64
56
|
const parsed = parseCommandLine(actionArgs, optionDefinitions);
|
|
65
57
|
if (parsed.needHelp) {
|
|
@@ -71,7 +63,7 @@ export async function action(actionArgs) {
|
|
|
71
63
|
help();
|
|
72
64
|
return;
|
|
73
65
|
}
|
|
74
|
-
const { verbose, ['delete-expired-collections']: deleteExpiredCollections, ['dry-run']: dryRun, local: localMode, ['fastly-api-token']: fastlyApiToken, ['
|
|
66
|
+
const { verbose, ['delete-expired-collections']: deleteExpiredCollections, ['dry-run']: dryRun, local: localMode, ['fastly-api-token']: fastlyApiToken, ['s3-access-key-id']: s3AccessKeyId, ['s3-secret-access-key']: s3SecretAccessKey, } = parsed.commandLineOptions;
|
|
75
67
|
// compute-js-static-publisher cli is always run from the Compute application directory
|
|
76
68
|
// in other words, the directory that contains `fastly.toml`.
|
|
77
69
|
const computeAppDir = path.resolve();
|
|
@@ -105,9 +97,8 @@ export async function action(actionArgs) {
|
|
|
105
97
|
computeAppDir,
|
|
106
98
|
localMode,
|
|
107
99
|
fastlyApiToken,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
awsSecretAccessKey,
|
|
100
|
+
s3AccessKeyId,
|
|
101
|
+
s3SecretAccessKey,
|
|
111
102
|
});
|
|
112
103
|
}
|
|
113
104
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/delete.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/delete.ts"],"names":[],"mappings":"AAkDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAqIhD"}
|
|
@@ -30,20 +30,13 @@ KV Store Options:
|
|
|
30
30
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
31
31
|
If not set, the tool will check:
|
|
32
32
|
1. FASTLY_API_TOKEN environment variable
|
|
33
|
-
2.
|
|
33
|
+
2. The default profile in the Fastly CLI
|
|
34
34
|
|
|
35
35
|
S3 Storage Options (BETA):
|
|
36
|
-
--
|
|
37
|
-
--
|
|
38
|
-
If not set, the tool will check
|
|
39
|
-
|
|
40
|
-
environment variables
|
|
41
|
-
2. The aws credentials file, see below
|
|
42
|
-
|
|
43
|
-
--aws-profile=<profile> Profile within the aws credentials file.
|
|
44
|
-
If not set, the tool will check:
|
|
45
|
-
1. AWS_PROFILE environment variable
|
|
46
|
-
2. The default profile, if set
|
|
36
|
+
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
37
|
+
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
38
|
+
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
39
|
+
and S3_SECRET_ACCESS_KEY environment variables.
|
|
47
40
|
|
|
48
41
|
Global Options:
|
|
49
42
|
-h, --help Show this help message and exit.
|
|
@@ -55,9 +48,8 @@ export async function action(actionArgs) {
|
|
|
55
48
|
{ name: 'collection-name', type: String },
|
|
56
49
|
{ name: 'local', type: Boolean },
|
|
57
50
|
{ name: 'fastly-api-token', type: String, },
|
|
58
|
-
{ name: '
|
|
59
|
-
{ name: '
|
|
60
|
-
{ name: 'aws-secret-access-key', type: String, },
|
|
51
|
+
{ name: 's3-access-key-id', type: String, },
|
|
52
|
+
{ name: 's3-secret-access-key', type: String, },
|
|
61
53
|
];
|
|
62
54
|
const parsed = parseCommandLine(actionArgs, optionDefinitions);
|
|
63
55
|
if (parsed.needHelp) {
|
|
@@ -69,7 +61,7 @@ export async function action(actionArgs) {
|
|
|
69
61
|
help();
|
|
70
62
|
return;
|
|
71
63
|
}
|
|
72
|
-
const { verbose, ['collection-name']: collectionNameValue, ['fastly-api-token']: fastlyApiToken, local: localMode, ['
|
|
64
|
+
const { verbose, ['collection-name']: collectionNameValue, ['fastly-api-token']: fastlyApiToken, local: localMode, ['s3-access-key-id']: s3AccessKeyId, ['s3-secret-access-key']: s3SecretAccessKey, } = parsed.commandLineOptions;
|
|
73
65
|
// compute-js-static-publisher cli is always run from the Compute application directory
|
|
74
66
|
// in other words, the directory that contains `fastly.toml`.
|
|
75
67
|
const computeAppDir = path.resolve();
|
|
@@ -108,9 +100,8 @@ export async function action(actionArgs) {
|
|
|
108
100
|
computeAppDir,
|
|
109
101
|
localMode,
|
|
110
102
|
fastlyApiToken,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
awsSecretAccessKey,
|
|
103
|
+
s3AccessKeyId,
|
|
104
|
+
s3SecretAccessKey,
|
|
114
105
|
});
|
|
115
106
|
}
|
|
116
107
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/index.ts"],"names":[],"mappings":"AAoDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0BhD"}
|
|
@@ -31,20 +31,13 @@ KV Store Options:
|
|
|
31
31
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
32
32
|
If not set, the tool will check:
|
|
33
33
|
1. FASTLY_API_TOKEN environment variable
|
|
34
|
-
2.
|
|
34
|
+
2. The default profile in the Fastly CLI
|
|
35
35
|
|
|
36
36
|
S3 Storage Options (BETA):
|
|
37
|
-
--
|
|
38
|
-
--
|
|
39
|
-
If not set, the tool will check
|
|
40
|
-
|
|
41
|
-
environment variables
|
|
42
|
-
2. The aws credentials file, see below
|
|
43
|
-
|
|
44
|
-
--aws-profile=<profile> Profile within the aws credentials file.
|
|
45
|
-
If not set, the tool will check:
|
|
46
|
-
1. AWS_PROFILE environment variable
|
|
47
|
-
2. The default profile, if set
|
|
37
|
+
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
38
|
+
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
39
|
+
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
40
|
+
and S3_SECRET_ACCESS_KEY environment variables.
|
|
48
41
|
|
|
49
42
|
Global Options:
|
|
50
43
|
-h, --help Show this help message and exit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/list.ts"],"names":[],"mappings":"AA6CA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAmIhD"}
|
|
@@ -25,20 +25,13 @@ KV Store Options:
|
|
|
25
25
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
26
26
|
If not set, the tool will check:
|
|
27
27
|
1. FASTLY_API_TOKEN environment variable
|
|
28
|
-
2.
|
|
28
|
+
2. The default profile in the Fastly CLI
|
|
29
29
|
|
|
30
30
|
S3 Storage Options (BETA):
|
|
31
|
-
--
|
|
32
|
-
--
|
|
33
|
-
If not set, the tool will check
|
|
34
|
-
|
|
35
|
-
environment variables
|
|
36
|
-
2. The aws credentials file, see below
|
|
37
|
-
|
|
38
|
-
--aws-profile=<profile> Profile within the aws credentials file.
|
|
39
|
-
If not set, the tool will check:
|
|
40
|
-
1. AWS_PROFILE environment variable
|
|
41
|
-
2. The default profile, if set
|
|
31
|
+
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
32
|
+
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
33
|
+
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
34
|
+
and S3_SECRET_ACCESS_KEY environment variables.
|
|
42
35
|
|
|
43
36
|
Global Options:
|
|
44
37
|
-h, --help Show this help message and exit.
|
|
@@ -49,9 +42,8 @@ export async function action(actionArgs) {
|
|
|
49
42
|
{ name: 'verbose', type: Boolean },
|
|
50
43
|
{ name: 'local', type: Boolean },
|
|
51
44
|
{ name: 'fastly-api-token', type: String, },
|
|
52
|
-
{ name: '
|
|
53
|
-
{ name: '
|
|
54
|
-
{ name: 'aws-secret-access-key', type: String, },
|
|
45
|
+
{ name: 's3-access-key-id', type: String, },
|
|
46
|
+
{ name: 's3-secret-access-key', type: String, },
|
|
55
47
|
];
|
|
56
48
|
const parsed = parseCommandLine(actionArgs, optionDefinitions);
|
|
57
49
|
if (parsed.needHelp) {
|
|
@@ -63,7 +55,7 @@ export async function action(actionArgs) {
|
|
|
63
55
|
help();
|
|
64
56
|
return;
|
|
65
57
|
}
|
|
66
|
-
const { verbose, local: localMode, ['fastly-api-token']: fastlyApiToken, ['
|
|
58
|
+
const { verbose, local: localMode, ['fastly-api-token']: fastlyApiToken, ['s3-access-key-id']: s3AccessKeyId, ['s3-secret-access-key']: s3SecretAccessKey, } = parsed.commandLineOptions;
|
|
67
59
|
// compute-js-static-publisher cli is always run from the Compute application directory
|
|
68
60
|
// in other words, the directory that contains `fastly.toml`.
|
|
69
61
|
const computeAppDir = path.resolve();
|
|
@@ -97,9 +89,8 @@ export async function action(actionArgs) {
|
|
|
97
89
|
computeAppDir,
|
|
98
90
|
localMode,
|
|
99
91
|
fastlyApiToken,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
awsSecretAccessKey,
|
|
92
|
+
s3AccessKeyId,
|
|
93
|
+
s3SecretAccessKey,
|
|
103
94
|
});
|
|
104
95
|
}
|
|
105
96
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promote.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/promote.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"promote.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/promote.ts"],"names":[],"mappings":"AAmEA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAuLhD"}
|
|
@@ -47,20 +47,13 @@ KV Store Options:
|
|
|
47
47
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
48
48
|
If not set, the tool will check:
|
|
49
49
|
1. FASTLY_API_TOKEN environment variable
|
|
50
|
-
2.
|
|
50
|
+
2. The default profile in the Fastly CLI
|
|
51
51
|
|
|
52
52
|
S3 Storage Options (BETA):
|
|
53
|
-
--
|
|
54
|
-
--
|
|
55
|
-
If not set, the tool will check
|
|
56
|
-
|
|
57
|
-
environment variables
|
|
58
|
-
2. The aws credentials file, see below
|
|
59
|
-
|
|
60
|
-
--aws-profile=<profile> Profile within the aws credentials file.
|
|
61
|
-
If not set, the tool will check:
|
|
62
|
-
1. AWS_PROFILE environment variable
|
|
63
|
-
2. The default profile, if set
|
|
53
|
+
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
54
|
+
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
55
|
+
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
56
|
+
and S3_SECRET_ACCESS_KEY environment variables.
|
|
64
57
|
|
|
65
58
|
Global Options:
|
|
66
59
|
-h, --help Show this help message and exit.
|
|
@@ -76,9 +69,8 @@ export async function action(actionArgs) {
|
|
|
76
69
|
{ name: 'expires-never', type: Boolean },
|
|
77
70
|
{ name: 'local', type: Boolean },
|
|
78
71
|
{ name: 'fastly-api-token', type: String, },
|
|
79
|
-
{ name: '
|
|
80
|
-
{ name: '
|
|
81
|
-
{ name: 'aws-secret-access-key', type: String, },
|
|
72
|
+
{ name: 's3-access-key-id', type: String, },
|
|
73
|
+
{ name: 's3-secret-access-key', type: String, },
|
|
82
74
|
];
|
|
83
75
|
const parsed = parseCommandLine(actionArgs, optionDefinitions);
|
|
84
76
|
if (parsed.needHelp) {
|
|
@@ -90,7 +82,7 @@ export async function action(actionArgs) {
|
|
|
90
82
|
help();
|
|
91
83
|
return;
|
|
92
84
|
}
|
|
93
|
-
const { verbose, ['collection-name']: collectionNameValue, to: toCollectionNameValue, ['expires-in']: expiresIn, ['expires-at']: expiresAt, ['expires-never']: expiresNever, local: localMode, ['fastly-api-token']: fastlyApiToken, ['
|
|
85
|
+
const { verbose, ['collection-name']: collectionNameValue, to: toCollectionNameValue, ['expires-in']: expiresIn, ['expires-at']: expiresAt, ['expires-never']: expiresNever, local: localMode, ['fastly-api-token']: fastlyApiToken, ['s3-access-key-id']: s3AccessKeyId, ['s3-secret-access-key']: s3SecretAccessKey, } = parsed.commandLineOptions;
|
|
94
86
|
// compute-js-static-publisher cli is always run from the Compute application directory
|
|
95
87
|
// in other words, the directory that contains `fastly.toml`.
|
|
96
88
|
const computeAppDir = path.resolve();
|
|
@@ -144,9 +136,8 @@ export async function action(actionArgs) {
|
|
|
144
136
|
computeAppDir,
|
|
145
137
|
localMode,
|
|
146
138
|
fastlyApiToken,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
awsSecretAccessKey,
|
|
139
|
+
s3AccessKeyId,
|
|
140
|
+
s3SecretAccessKey,
|
|
150
141
|
});
|
|
151
142
|
}
|
|
152
143
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-expiration.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/update-expiration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-expiration.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/update-expiration.ts"],"names":[],"mappings":"AA+DA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0JhD"}
|
|
@@ -43,20 +43,13 @@ KV Store Options:
|
|
|
43
43
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
44
44
|
If not set, the tool will check:
|
|
45
45
|
1. FASTLY_API_TOKEN environment variable
|
|
46
|
-
2.
|
|
46
|
+
2. The default profile in the Fastly CLI
|
|
47
47
|
|
|
48
48
|
S3 Storage Options (BETA):
|
|
49
|
-
--
|
|
50
|
-
--
|
|
51
|
-
If not set, the tool will check
|
|
52
|
-
|
|
53
|
-
environment variables
|
|
54
|
-
2. The aws credentials file, see below
|
|
55
|
-
|
|
56
|
-
--aws-profile=<profile> Profile within the aws credentials file.
|
|
57
|
-
If not set, the tool will check:
|
|
58
|
-
1. AWS_PROFILE environment variable
|
|
59
|
-
2. The default profile, if set
|
|
49
|
+
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
50
|
+
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
51
|
+
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
52
|
+
and S3_SECRET_ACCESS_KEY environment variables.
|
|
60
53
|
|
|
61
54
|
Global Options:
|
|
62
55
|
-h, --help Show this help message and exit.
|
|
@@ -71,9 +64,8 @@ export async function action(actionArgs) {
|
|
|
71
64
|
{ name: 'expires-never', type: Boolean },
|
|
72
65
|
{ name: 'local', type: Boolean },
|
|
73
66
|
{ name: 'fastly-api-token', type: String, },
|
|
74
|
-
{ name: '
|
|
75
|
-
{ name: '
|
|
76
|
-
{ name: 'aws-secret-access-key', type: String, },
|
|
67
|
+
{ name: 's3-access-key-id', type: String, },
|
|
68
|
+
{ name: 's3-secret-access-key', type: String, },
|
|
77
69
|
];
|
|
78
70
|
const parsed = parseCommandLine(actionArgs, optionDefinitions);
|
|
79
71
|
if (parsed.needHelp) {
|
|
@@ -85,7 +77,7 @@ export async function action(actionArgs) {
|
|
|
85
77
|
help();
|
|
86
78
|
return;
|
|
87
79
|
}
|
|
88
|
-
const { verbose, ['collection-name']: collectionNameValue, ['expires-in']: expiresIn, ['expires-at']: expiresAt, ['expires-never']: expiresNever, local: localMode, ['fastly-api-token']: fastlyApiToken, ['
|
|
80
|
+
const { verbose, ['collection-name']: collectionNameValue, ['expires-in']: expiresIn, ['expires-at']: expiresAt, ['expires-never']: expiresNever, local: localMode, ['fastly-api-token']: fastlyApiToken, ['s3-access-key-id']: s3AccessKeyId, ['s3-secret-access-key']: s3SecretAccessKey, } = parsed.commandLineOptions;
|
|
89
81
|
// compute-js-static-publisher cli is always run from the Compute application directory
|
|
90
82
|
// in other words, the directory that contains `fastly.toml`.
|
|
91
83
|
const computeAppDir = path.resolve();
|
|
@@ -139,9 +131,8 @@ export async function action(actionArgs) {
|
|
|
139
131
|
computeAppDir,
|
|
140
132
|
localMode,
|
|
141
133
|
fastlyApiToken,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
awsSecretAccessKey,
|
|
134
|
+
s3AccessKeyId,
|
|
135
|
+
s3SecretAccessKey,
|
|
145
136
|
});
|
|
146
137
|
}
|
|
147
138
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/index.ts"],"names":[],"mappings":"AA2DA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAyBhD"}
|
|
@@ -33,20 +33,13 @@ KV Store Options:
|
|
|
33
33
|
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
34
34
|
If not set, the tool will check:
|
|
35
35
|
1. FASTLY_API_TOKEN environment variable
|
|
36
|
-
2.
|
|
36
|
+
2. The default profile in the Fastly CLI
|
|
37
37
|
|
|
38
38
|
S3 Storage Options (BETA):
|
|
39
|
-
--
|
|
40
|
-
--
|
|
41
|
-
If not set, the tool will check
|
|
42
|
-
|
|
43
|
-
environment variables
|
|
44
|
-
2. The aws credentials file, see below
|
|
45
|
-
|
|
46
|
-
--aws-profile=<profile> Profile within the aws credentials file.
|
|
47
|
-
If not set, the tool will check:
|
|
48
|
-
1. AWS_PROFILE environment variable
|
|
49
|
-
2. The default profile, if set
|
|
39
|
+
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
40
|
+
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
41
|
+
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
42
|
+
and S3_SECRET_ACCESS_KEY environment variables.
|
|
50
43
|
|
|
51
44
|
Global Options:
|
|
52
45
|
-h, --help Show this help message and exit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"AAsGA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAyehD"}
|
|
@@ -45,7 +45,7 @@ Optional:
|
|
|
45
45
|
--fastly-api-token=<token> Fastly API token for KV Store or cache access.
|
|
46
46
|
If not set, the tool will check:
|
|
47
47
|
1. FASTLY_API_TOKEN environment variable
|
|
48
|
-
2.
|
|
48
|
+
2. The default profile in the Fastly CLI
|
|
49
49
|
|
|
50
50
|
--overwrite-existing Always overwrite existing entries in storage, even if unchanged.
|
|
51
51
|
|
|
@@ -69,17 +69,10 @@ KV Store Options:
|
|
|
69
69
|
--kv-overwrite Alias for --overwrite-existing.
|
|
70
70
|
|
|
71
71
|
S3 Storage Options (BETA):
|
|
72
|
-
--
|
|
73
|
-
--
|
|
74
|
-
If not set, the tool will check
|
|
75
|
-
|
|
76
|
-
environment variables
|
|
77
|
-
2. The aws credentials file, see below
|
|
78
|
-
|
|
79
|
-
--aws-profile=<profile> Profile within the aws credentials file.
|
|
80
|
-
If not set, the tool will check:
|
|
81
|
-
1. AWS_PROFILE environment variable
|
|
82
|
-
2. The default profile, if set
|
|
72
|
+
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
73
|
+
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
74
|
+
If not set, the tool will check the S3_ACCESS_KEY_ID
|
|
75
|
+
and S3_SECRET_ACCESS_KEY environment variables.
|
|
83
76
|
|
|
84
77
|
Global Options:
|
|
85
78
|
-h, --help Show this help message and exit.
|
|
@@ -104,9 +97,8 @@ export async function action(actionArgs) {
|
|
|
104
97
|
{ name: 'local', type: Boolean },
|
|
105
98
|
{ name: 'fastly-api-token', type: String, },
|
|
106
99
|
{ name: 'kv-overwrite', type: Boolean },
|
|
107
|
-
{ name: '
|
|
108
|
-
{ name: '
|
|
109
|
-
{ name: 'aws-secret-access-key', type: String, },
|
|
100
|
+
{ name: 's3-access-key-id', type: String, },
|
|
101
|
+
{ name: 's3-secret-access-key', type: String, },
|
|
110
102
|
];
|
|
111
103
|
const parsed = parseCommandLine(actionArgs, optionDefinitions);
|
|
112
104
|
if (parsed.needHelp) {
|
|
@@ -118,7 +110,7 @@ export async function action(actionArgs) {
|
|
|
118
110
|
help();
|
|
119
111
|
return;
|
|
120
112
|
}
|
|
121
|
-
const { verbose, config: configFilePathValue, ['collection-name']: collectionNameValue, ['root-dir']: rootDir, ['overwrite-existing']: _overwriteExisting, ['expires-in']: expiresIn, ['expires-at']: expiresAt, ['expires-never']: expiresNever, local: localMode, ['fastly-api-token']: fastlyApiToken, ['kv-overwrite']: _kvOverwrite, ['
|
|
113
|
+
const { verbose, config: configFilePathValue, ['collection-name']: collectionNameValue, ['root-dir']: rootDir, ['overwrite-existing']: _overwriteExisting, ['expires-in']: expiresIn, ['expires-at']: expiresAt, ['expires-never']: expiresNever, local: localMode, ['fastly-api-token']: fastlyApiToken, ['kv-overwrite']: _kvOverwrite, ['s3-access-key-id']: s3AccessKeyId, ['s3-secret-access-key']: s3SecretAccessKey, } = parsed.commandLineOptions;
|
|
122
114
|
const overwriteExisting = _overwriteExisting ?? _kvOverwrite;
|
|
123
115
|
// compute-js-static-publisher cli is always run from the Compute application directory
|
|
124
116
|
// in other words, the directory that contains `fastly.toml`.
|
|
@@ -187,9 +179,8 @@ export async function action(actionArgs) {
|
|
|
187
179
|
computeAppDir,
|
|
188
180
|
localMode,
|
|
189
181
|
fastlyApiToken,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
awsSecretAccessKey,
|
|
182
|
+
s3AccessKeyId,
|
|
183
|
+
s3SecretAccessKey,
|
|
193
184
|
});
|
|
194
185
|
}
|
|
195
186
|
catch (err) {
|
|
@@ -12,7 +12,7 @@ import * as fs from 'node:fs';
|
|
|
12
12
|
import { parseCommandLine } from '../../util/args.js';
|
|
13
13
|
import { dotRelative, rootRelative } from '../../util/files.js';
|
|
14
14
|
import { findComputeJsStaticPublisherVersion } from '../../util/package.js';
|
|
15
|
-
import {
|
|
15
|
+
import { findHostnameForAwsS3RegionAndBucket } from '../../util/s3.js';
|
|
16
16
|
function help() {
|
|
17
17
|
console.log(`\
|
|
18
18
|
|
|
@@ -570,7 +570,11 @@ export async function action(actionArgs) {
|
|
|
570
570
|
}
|
|
571
571
|
let s3Endpoint = options.s3Endpoint;
|
|
572
572
|
if (s3Endpoint == null || s3Endpoint === '') {
|
|
573
|
-
|
|
573
|
+
// If endpoint is not presented, we assume it's from AWS,
|
|
574
|
+
// and ask the SDK what the hostname would be.
|
|
575
|
+
// This is required because we need to add the hostname as a
|
|
576
|
+
// backend in the Compute service.
|
|
577
|
+
s3Endpoint = await findHostnameForAwsS3RegionAndBucket(s3Region, s3Bucket);
|
|
574
578
|
if (s3Endpoint) {
|
|
575
579
|
console.log('✅ S3 endpoint resolved:', s3Endpoint);
|
|
576
580
|
}
|
|
@@ -615,7 +619,7 @@ export async function action(actionArgs) {
|
|
|
615
619
|
console.log('KV Store Name :', kvStoreName);
|
|
616
620
|
}
|
|
617
621
|
else if (storageMode === 's3') {
|
|
618
|
-
console.log('Storage Name : S3
|
|
622
|
+
console.log('Storage Name : S3 (or compatible) storage (BETA)');
|
|
619
623
|
console.log('S3 Region :', s3Region);
|
|
620
624
|
console.log('S3 Bucket :', s3Bucket);
|
|
621
625
|
console.log('S3 Endpoint :', String(s3EndpointUrl));
|
|
@@ -672,7 +676,7 @@ export async function action(actionArgs) {
|
|
|
672
676
|
author,
|
|
673
677
|
type: 'module',
|
|
674
678
|
devDependencies: {
|
|
675
|
-
"@fastly/cli": "^
|
|
679
|
+
"@fastly/cli": "^13.1.0",
|
|
676
680
|
'@fastly/compute-js-static-publish': computeJsStaticPublisherVersion,
|
|
677
681
|
},
|
|
678
682
|
dependencies: {
|
|
@@ -709,15 +713,15 @@ ${kvStoreName} = { file = "${localServerKvStorePath}", format = "json" }
|
|
|
709
713
|
[local_server]
|
|
710
714
|
|
|
711
715
|
[local_server.secret_stores]
|
|
712
|
-
[[local_server.secret_stores.
|
|
713
|
-
key = "
|
|
714
|
-
env = "
|
|
715
|
-
[[local_server.secret_stores.
|
|
716
|
-
key = "
|
|
717
|
-
env = "
|
|
716
|
+
[[local_server.secret_stores.S3_CREDENTIALS]]
|
|
717
|
+
key = "S3_ACCESS_KEY_ID"
|
|
718
|
+
env = "S3_ACCESS_KEY_ID"
|
|
719
|
+
[[local_server.secret_stores.S3_CREDENTIALS]]
|
|
720
|
+
key = "S3_SECRET_ACCESS_KEY"
|
|
721
|
+
env = "S3_SECRET_ACCESS_KEY"
|
|
718
722
|
|
|
719
723
|
[local_server.backends]
|
|
720
|
-
[local_server.backends.
|
|
724
|
+
[local_server.backends.s3_storage]
|
|
721
725
|
url = "${String(s3EndpointUrl)}"
|
|
722
726
|
override_host = "${s3EndpointUrl.hostname}"
|
|
723
727
|
`;
|
|
@@ -725,18 +729,18 @@ override_host = "${s3EndpointUrl.hostname}"
|
|
|
725
729
|
[setup]
|
|
726
730
|
|
|
727
731
|
[setup.backends]
|
|
728
|
-
[setup.backends.
|
|
732
|
+
[setup.backends.s3_storage]
|
|
729
733
|
address = "${s3EndpointUrl.hostname}"
|
|
730
734
|
description = "S3 API endpoint"
|
|
731
735
|
port = 443
|
|
732
736
|
[setup.secret_stores]
|
|
733
|
-
[setup.secret_stores.
|
|
737
|
+
[setup.secret_stores.S3_CREDENTIALS]
|
|
734
738
|
description = "Credentials for S3 storage"
|
|
735
|
-
[setup.secret_stores.
|
|
736
|
-
[setup.secret_stores.
|
|
737
|
-
description = "
|
|
738
|
-
[setup.secret_stores.
|
|
739
|
-
description = "
|
|
739
|
+
[setup.secret_stores.S3_CREDENTIALS.items]
|
|
740
|
+
[setup.secret_stores.S3_CREDENTIALS.items.S3_ACCESS_KEY_ID]
|
|
741
|
+
description = "Access Key ID"
|
|
742
|
+
[setup.secret_stores.S3_CREDENTIALS.items.S3_SECRET_ACCESS_KEY]
|
|
743
|
+
description = "Secret Access Key"
|
|
740
744
|
`;
|
|
741
745
|
}
|
|
742
746
|
resourceFiles['fastly.toml'] = /* language=text */ `\
|
|
@@ -925,25 +929,21 @@ To publish your content to your S3-compatible bucket
|
|
|
925
929
|
Bucket: ${s3Bucket}
|
|
926
930
|
Endpoint: ${String(s3EndpointUrl)}
|
|
927
931
|
|
|
928
|
-
Using an
|
|
932
|
+
Using an access key ID and secret access key for S3, type:
|
|
929
933
|
cd ${COMPUTE_JS_DIR}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
Using AWS IAM credentials, type:
|
|
933
|
-
cd ${COMPUTE_JS_DIR}
|
|
934
|
-
AWS_ACCESS_KEY_ID=xxxx AWS_SECRET_ACCESS_KEY=xxxx npm run s3:publish
|
|
934
|
+
S3_ACCESS_KEY_ID=xxxx S3_SECRET_ACCESS_KEY=xxxx npm run s3:publish
|
|
935
935
|
|
|
936
936
|
To run your Compute application locally
|
|
937
937
|
|
|
938
938
|
Run the following commands:
|
|
939
939
|
cd ${COMPUTE_JS_DIR}
|
|
940
|
-
|
|
940
|
+
S3_ACCESS_KEY_ID=xxxx S3_SECRET_ACCESS_KEY=xxxx npm run dev:start
|
|
941
941
|
|
|
942
942
|
To build and deploy to your Compute service:
|
|
943
943
|
|
|
944
|
-
Create a Secret Store in your account named
|
|
945
|
-
|
|
946
|
-
|
|
944
|
+
Create a Secret Store in your account named S3_CREDENTIALS, and set the following values:
|
|
945
|
+
S3_ACCESS_KEY_ID: xxxx
|
|
946
|
+
S3_SECRET_ACCESS_KEY: xxxx
|
|
947
947
|
|
|
948
948
|
Run the following commands:
|
|
949
949
|
cd ${COMPUTE_JS_DIR}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/s3-storage-provider.ts"],"names":[],"mappings":"AAOA,OAAO,EAWL,QAAQ,EAET,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,8BAA8B,CAAC;AAQtC,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAsB/B,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEnF,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"s3-storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/s3-storage-provider.ts"],"names":[],"mappings":"AAOA,OAAO,EAWL,QAAQ,EAET,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,8BAA8B,CAAC;AAQtC,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KA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OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IA6B1D,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAwB9D,kBAAkB,CACtB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC;IAaV,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW9C,UAAU,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBtD,oBAAoB,CAAC,OAAO,SAAS;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,EACxD,OAAO,EAAE,OAAO,EAAE,EAClB,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EAC/D,aAAa,GAAE,MAAW,GACzB,OAAO,CAAC,IAAI,CAAC;IAkBhB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAInC,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA8BjF,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CA4B7D"}
|
|
@@ -8,7 +8,7 @@ import { DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, ListObjectsV2
|
|
|
8
8
|
import { decodeAssetVariantMetadata, } from '../../models/assets/index.js';
|
|
9
9
|
import { isS3StorageConfigRc, } from '../../models/config/static-publish-rc.js';
|
|
10
10
|
import { getS3StorageConfigFromRc, } from '../../models/config/s3-storage-config.js';
|
|
11
|
-
import {
|
|
11
|
+
import { loadS3Credentials, } from '../util/s3-credentials.js';
|
|
12
12
|
import { concurrentParallel, makeRetryable, } from '../util/retryable.js';
|
|
13
13
|
import { rootRelative, } from '../util/files.js';
|
|
14
14
|
import { loadApiToken, } from '../util/api-token.js';
|
|
@@ -26,15 +26,14 @@ export const buildStoreProvider = async (config, context) => {
|
|
|
26
26
|
console.log(` Region : ${region}`);
|
|
27
27
|
console.log(` Bucket : ${bucket}`);
|
|
28
28
|
console.log(` Endpoint: ${endpoint ?? 'default'}`);
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
awsSecretAccessKey: context.awsSecretAccessKey,
|
|
29
|
+
const s3CredentialsResult = await loadS3Credentials({
|
|
30
|
+
s3AccessKeyId: context.s3AccessKeyId,
|
|
31
|
+
s3SecretAccessKey: context.s3SecretAccessKey,
|
|
33
32
|
});
|
|
34
|
-
if (
|
|
35
|
-
throw new Error("❌ S3 Credentials not provided.\nProvide an
|
|
33
|
+
if (s3CredentialsResult == null) {
|
|
34
|
+
throw new Error("❌ S3 Credentials not provided.\nProvide an access key ID and secret access key that have write access to the S3 or compatible storage.\nRefer to the README file and --help for additional information.");
|
|
36
35
|
}
|
|
37
|
-
console.log(`✔️ S3 Credentials: ${
|
|
36
|
+
console.log(`✔️ S3 Credentials: ${s3CredentialsResult.s3AccessKeyId.slice(0, 4)}${'*'.repeat(s3CredentialsResult.s3AccessKeyId.length - 4)} from '${s3CredentialsResult.source}'`);
|
|
38
37
|
const fastlyTomlPath = path.resolve(context.computeAppDir, 'fastly.toml');
|
|
39
38
|
const serviceId = readServiceId(fastlyTomlPath);
|
|
40
39
|
let apiToken = undefined;
|
|
@@ -50,7 +49,7 @@ export const buildStoreProvider = async (config, context) => {
|
|
|
50
49
|
console.log(`✔️ Fastly API Token: ${apiTokenResult.apiToken.slice(0, 4)}${'*'.repeat(apiTokenResult.apiToken.length - 4)} from '${apiTokenResult.source}'`);
|
|
51
50
|
apiToken = apiTokenResult.apiToken;
|
|
52
51
|
}
|
|
53
|
-
return new S3StorageProvider(serviceId, apiToken, region,
|
|
52
|
+
return new S3StorageProvider(serviceId, apiToken, region, s3CredentialsResult.s3AccessKeyId, s3CredentialsResult.s3SecretAccessKey, bucket, endpoint);
|
|
54
53
|
};
|
|
55
54
|
export class S3StorageProvider {
|
|
56
55
|
constructor(fastlyServiceId, fastlyApiToken, s3Region, accessKeyId, secretAccessKey, s3Bucket, s3Endpoint) {
|
|
@@ -35,9 +35,8 @@ export type StorageProviderBuilderContext = {
|
|
|
35
35
|
computeAppDir: string;
|
|
36
36
|
localMode?: boolean;
|
|
37
37
|
fastlyApiToken?: string;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
awsSecretAccessKey?: string;
|
|
38
|
+
s3AccessKeyId?: string;
|
|
39
|
+
s3SecretAccessKey?: string;
|
|
41
40
|
};
|
|
42
41
|
export type StorageProviderBuilder = (config: StaticPublishRc, context: StorageProviderBuilderContext) => (Promise<StorageProvider | null> | StorageProvider | null);
|
|
43
42
|
export declare function registerStorageProviderBuilder(builder: StorageProviderBuilder): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/storage-provider.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,KAAK,eAAe,EACrB,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MA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C,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AACF,MAAM,MAAM,sBAAsB,GAChC,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,6BAA6B,KAAK,CAAC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,GAAG,eAAe,GAAG,IAAI,CAAC,CAAC;AAGlI,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,sBAAsB,QAE7E;AAED,wBAAsB,sCAAsC,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,6BAA6B,4BAS3H"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type LoadS3CredentialsResult = {
|
|
2
|
+
s3AccessKeyId: string;
|
|
3
|
+
s3SecretAccessKey: string;
|
|
4
|
+
source: string;
|
|
5
|
+
};
|
|
6
|
+
export type LoadS3CredentialsParams = {
|
|
7
|
+
s3AccessKeyId?: any;
|
|
8
|
+
s3SecretAccessKey?: any;
|
|
9
|
+
};
|
|
10
|
+
export declare function loadS3Credentials(params: LoadS3CredentialsParams): Promise<LoadS3CredentialsResult | null>;
|
|
11
|
+
//# sourceMappingURL=s3-credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3-credentials.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/s3-credentials.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,uBAAuB,GAAG;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,iBAAiB,CAAC,EAAE,GAAG,CAAC;CACzB,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAwChH"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Fastly, Inc.
|
|
3
|
+
* Licensed under the MIT license. See LICENSE file for details.
|
|
4
|
+
*/
|
|
5
|
+
export async function loadS3Credentials(params) {
|
|
6
|
+
let s3AccessKeyId = null;
|
|
7
|
+
let s3SecretAccessKey = null;
|
|
8
|
+
let source = '';
|
|
9
|
+
// Try command line arg
|
|
10
|
+
if (typeof params.s3AccessKeyId === 'string' &&
|
|
11
|
+
typeof params.s3SecretAccessKey === 'string') {
|
|
12
|
+
const id = params.s3AccessKeyId.trim() || null;
|
|
13
|
+
const key = params.s3SecretAccessKey.trim() || null;
|
|
14
|
+
if (id != null && key != null) {
|
|
15
|
+
s3AccessKeyId = id;
|
|
16
|
+
s3SecretAccessKey = key;
|
|
17
|
+
source = 'commandline';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Try env (S3_ACCESS_KEY_ID and S3_SECRET_ACCESS_KEY)
|
|
21
|
+
if (s3AccessKeyId == null && s3SecretAccessKey == null) {
|
|
22
|
+
const id = process.env.S3_ACCESS_KEY_ID || null;
|
|
23
|
+
const key = process.env.S3_SECRET_ACCESS_KEY || null;
|
|
24
|
+
if (id != null && key != null) {
|
|
25
|
+
s3AccessKeyId = id;
|
|
26
|
+
s3SecretAccessKey = key;
|
|
27
|
+
source = 'env';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (s3AccessKeyId == null || s3SecretAccessKey == null) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
s3AccessKeyId,
|
|
35
|
+
s3SecretAccessKey,
|
|
36
|
+
source,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* - Uses client-s3's own endpoint resolution logic (so it's always accurate).
|
|
4
4
|
* - No network calls; intercepts at the build step.
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function findHostnameForAwsS3RegionAndBucket(region: string, bucket: string): Promise<string>;
|
|
7
7
|
//# sourceMappingURL=s3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/s3.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAsB,
|
|
1
|
+
{"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/s3.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAsB,mCAAmC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAqCzG"}
|
package/build/cli/cli/util/s3.js
CHANGED
|
@@ -9,7 +9,7 @@ const DUMMY_KEY = 'dummy.dat'; // placeholder, never sent over the network
|
|
|
9
9
|
* - Uses client-s3's own endpoint resolution logic (so it's always accurate).
|
|
10
10
|
* - No network calls; intercepts at the build step.
|
|
11
11
|
*/
|
|
12
|
-
export async function
|
|
12
|
+
export async function findHostnameForAwsS3RegionAndBucket(region, bucket) {
|
|
13
13
|
const client = new S3Client({ region });
|
|
14
14
|
let hostname = '';
|
|
15
15
|
const captureHostname = (_next) => async (args) => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright Fastly, Inc.
|
|
3
3
|
* Licensed under the MIT license. See LICENSE file for details.
|
|
4
4
|
*/
|
|
5
|
-
//
|
|
5
|
+
// To work with some platforms such as S3 that insist on lowercasing their metadata keys
|
|
6
6
|
export function getMetadataFieldValue(metadata, key) {
|
|
7
7
|
return metadata[key] ?? metadata[key.toLowerCase()] ?? undefined;
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright Fastly, Inc.
|
|
3
3
|
* Licensed under the MIT license. See LICENSE file for details.
|
|
4
4
|
*/
|
|
5
|
-
//
|
|
5
|
+
// To work with some platforms such as S3 that insist on lowercasing their metadata keys
|
|
6
6
|
export function getMetadataFieldValue(metadata, key) {
|
|
7
7
|
return metadata[key] ?? metadata[key.toLowerCase()] ?? undefined;
|
|
8
8
|
}
|
|
@@ -3,6 +3,6 @@ export { type PublishContentConfig } from '../models/config/publish-content-conf
|
|
|
3
3
|
export * as collectionSelector from './collection-selector/index.js';
|
|
4
4
|
export { CookieCollectionSelector, type CookieCollectionSelectorOpts, } from './collection-selector/from-cookie.js';
|
|
5
5
|
export { type StorageProvider, type StorageProviderBuilder, type StorageEntry, registerStorageProviderBuilder, } from './storage/storage-provider.js';
|
|
6
|
-
export {
|
|
6
|
+
export { setSecretStoreForS3Credentials, setSecretStoreKeyForS3AccessKeyId, setSecretStoreKeyForS3SecretAccessKey, setS3CredentialsBuilder, } from './storage/s3-storage-provider.js';
|
|
7
7
|
export { PublisherServer } from './publisher-server/index.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,KAAK,kBAAkB,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACL,wBAAwB,EACxB,KAAK,4BAA4B,GAClC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,8BAA8B,GAC/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,KAAK,kBAAkB,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACL,wBAAwB,EACxB,KAAK,4BAA4B,GAClC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,8BAA8B,GAC/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,8BAA8B,EAC9B,iCAAiC,EACjC,qCAAqC,EACrC,uBAAuB,GACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export * as collectionSelector from './collection-selector/index.js';
|
|
6
6
|
export { CookieCollectionSelector, } from './collection-selector/from-cookie.js';
|
|
7
7
|
export { registerStorageProviderBuilder, } from './storage/storage-provider.js';
|
|
8
|
-
export {
|
|
8
|
+
export { setSecretStoreForS3Credentials, setSecretStoreKeyForS3AccessKeyId, setSecretStoreKeyForS3SecretAccessKey, setS3CredentialsBuilder, } from './storage/s3-storage-provider.js';
|
|
9
9
|
export { PublisherServer } from './publisher-server/index.js';
|
|
10
10
|
// Register storage builder providers
|
|
11
11
|
import { registerStorageProviderBuilder } from './storage/storage-provider.js';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Command } from '@smithy/types';
|
|
2
2
|
import { S3ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from '@aws-sdk/client-s3';
|
|
3
3
|
import { type StorageEntry, type StorageProvider, StorageProviderBuilder } from './storage-provider.js';
|
|
4
|
-
export type
|
|
4
|
+
export type S3Credentials = {
|
|
5
5
|
accessKeyId: string;
|
|
6
6
|
secretAccessKey: string;
|
|
7
7
|
};
|
|
8
|
-
export type
|
|
8
|
+
export type S3CredentialsBuilder = () => (S3Credentials | Promise<S3Credentials>);
|
|
9
9
|
export declare const buildStoreProvider: StorageProviderBuilder;
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function
|
|
10
|
+
export declare function setSecretStoreForS3Credentials(secretStoreName: string): void;
|
|
11
|
+
export declare function setSecretStoreKeyForS3AccessKeyId(secretStoreKey: string): void;
|
|
12
|
+
export declare function setSecretStoreKeyForS3SecretAccessKey(secretStoreKey: string): void;
|
|
13
|
+
export declare function buildS3CredentialsFromSecretStore(): Promise<S3Credentials>;
|
|
14
|
+
export declare function setS3CredentialsBuilder(s3CredentialsBuilder: S3CredentialsBuilder): void;
|
|
15
15
|
export type S3StorageProviderParams = {
|
|
16
16
|
s3Endpoint?: string;
|
|
17
17
|
s3FastlyBackendName?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/server/storage/s3-storage-provider.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAKL,sBAAsB,EAEtB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"s3-storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/server/storage/s3-storage-provider.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAKL,sBAAsB,EAEtB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,M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OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;CAgC3E"}
|
|
@@ -19,49 +19,49 @@ export const buildStoreProvider = (config) => {
|
|
|
19
19
|
s3FastlyBackendName: s3StorageConfig.fastlyBackendName,
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
|
-
let
|
|
23
|
-
let
|
|
24
|
-
let
|
|
25
|
-
export function
|
|
26
|
-
|
|
22
|
+
let _secretStoreForS3Credentials = 'S3_CREDENTIALS';
|
|
23
|
+
let _secretStoreKeyForS3AccessKeyId = 'S3_ACCESS_KEY_ID';
|
|
24
|
+
let _secretStoreKeyForS3SecretAccessKey = 'S3_SECRET_ACCESS_KEY';
|
|
25
|
+
export function setSecretStoreForS3Credentials(secretStoreName) {
|
|
26
|
+
_secretStoreForS3Credentials = secretStoreName;
|
|
27
27
|
}
|
|
28
|
-
export function
|
|
29
|
-
|
|
28
|
+
export function setSecretStoreKeyForS3AccessKeyId(secretStoreKey) {
|
|
29
|
+
_secretStoreKeyForS3AccessKeyId = secretStoreKey;
|
|
30
30
|
}
|
|
31
|
-
export function
|
|
32
|
-
|
|
31
|
+
export function setSecretStoreKeyForS3SecretAccessKey(secretStoreKey) {
|
|
32
|
+
_secretStoreKeyForS3SecretAccessKey = secretStoreKey;
|
|
33
33
|
}
|
|
34
|
-
let
|
|
35
|
-
export async function
|
|
36
|
-
if (
|
|
37
|
-
return
|
|
34
|
+
let _s3CredentialsFromSecretStore = undefined;
|
|
35
|
+
export async function buildS3CredentialsFromSecretStore() {
|
|
36
|
+
if (_s3CredentialsFromSecretStore != null) {
|
|
37
|
+
return _s3CredentialsFromSecretStore;
|
|
38
38
|
}
|
|
39
39
|
let secretStore;
|
|
40
40
|
try {
|
|
41
|
-
secretStore = new SecretStore(
|
|
41
|
+
secretStore = new SecretStore(_secretStoreForS3Credentials);
|
|
42
42
|
}
|
|
43
43
|
catch {
|
|
44
|
-
throw new Error(`Could not open secret store for
|
|
44
|
+
throw new Error(`Could not open secret store for S3 credentials: ${_secretStoreForS3Credentials}`);
|
|
45
45
|
}
|
|
46
|
-
const accessKeyIdEntry = await secretStore.get(
|
|
46
|
+
const accessKeyIdEntry = await secretStore.get(_secretStoreKeyForS3AccessKeyId);
|
|
47
47
|
if (accessKeyIdEntry == null) {
|
|
48
|
-
throw new Error(`Could not retrieve value '${
|
|
48
|
+
throw new Error(`Could not retrieve value '${_secretStoreKeyForS3AccessKeyId}' in secret store '${_secretStoreForS3Credentials}'`);
|
|
49
49
|
}
|
|
50
50
|
const accessKeyId = accessKeyIdEntry.plaintext();
|
|
51
|
-
const secretAccessKeyEntry = await secretStore.get(
|
|
51
|
+
const secretAccessKeyEntry = await secretStore.get(_secretStoreKeyForS3SecretAccessKey);
|
|
52
52
|
if (secretAccessKeyEntry == null) {
|
|
53
|
-
throw new Error(`Could not retrieve value '${
|
|
53
|
+
throw new Error(`Could not retrieve value '${_secretStoreKeyForS3SecretAccessKey}' in secret store '${_secretStoreForS3Credentials}'`);
|
|
54
54
|
}
|
|
55
55
|
const secretAccessKey = secretAccessKeyEntry.plaintext();
|
|
56
|
-
|
|
56
|
+
_s3CredentialsFromSecretStore = {
|
|
57
57
|
accessKeyId,
|
|
58
58
|
secretAccessKey,
|
|
59
59
|
};
|
|
60
|
-
return
|
|
60
|
+
return _s3CredentialsFromSecretStore;
|
|
61
61
|
}
|
|
62
|
-
let
|
|
63
|
-
export function
|
|
64
|
-
|
|
62
|
+
let _s3CredentialsBuilder = buildS3CredentialsFromSecretStore;
|
|
63
|
+
export function setS3CredentialsBuilder(s3CredentialsBuilder) {
|
|
64
|
+
_s3CredentialsBuilder = s3CredentialsBuilder;
|
|
65
65
|
}
|
|
66
66
|
export class S3StorageProvider {
|
|
67
67
|
constructor(s3Region, s3Bucket, params) {
|
|
@@ -71,14 +71,14 @@ export class S3StorageProvider {
|
|
|
71
71
|
this.s3FastlyBackendName = params?.s3FastlyBackendName;
|
|
72
72
|
}
|
|
73
73
|
async sendS3Command(command, requestInit) {
|
|
74
|
-
const
|
|
74
|
+
const s3Credentials = await _s3CredentialsBuilder();
|
|
75
75
|
const s3Client = new S3Client({
|
|
76
76
|
region: this.s3Region,
|
|
77
77
|
endpoint: this.s3Endpoint,
|
|
78
78
|
forcePathStyle: this.s3Endpoint != null,
|
|
79
79
|
credentials: {
|
|
80
|
-
accessKeyId:
|
|
81
|
-
secretAccessKey:
|
|
80
|
+
accessKeyId: s3Credentials.accessKeyId,
|
|
81
|
+
secretAccessKey: s3Credentials.secretAccessKey,
|
|
82
82
|
},
|
|
83
83
|
maxAttempts: 5,
|
|
84
84
|
requestHandler: new FetchHttpHandler({
|
|
@@ -98,7 +98,7 @@ export class S3StorageProvider {
|
|
|
98
98
|
let response;
|
|
99
99
|
try {
|
|
100
100
|
response = await this.sendS3Command(command, {
|
|
101
|
-
backend: this.s3FastlyBackendName ?? "
|
|
101
|
+
backend: this.s3FastlyBackendName ?? "s3_storage",
|
|
102
102
|
cacheOverride: new CacheOverride({
|
|
103
103
|
ttl: 3600,
|
|
104
104
|
surrogateKey: (tags ?? []).join(' ') || undefined,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastly/compute-js-static-publish",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.0.0-beta.
|
|
4
|
+
"version": "8.0.0-beta.8",
|
|
5
5
|
"description": "Static Publisher for Fastly Compute JavaScript",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -41,8 +41,7 @@
|
|
|
41
41
|
"homepage": "https://github.com/fastly/compute-js-static-publish#readme",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@aws-sdk/client-s3": "3.888.0",
|
|
44
|
-
"@
|
|
45
|
-
"@fastly/cli": "^11.2.0",
|
|
44
|
+
"@fastly/cli": "^13.1.0",
|
|
46
45
|
"command-line-args": "^5.2.1",
|
|
47
46
|
"glob-to-regexp": "^0.4.1",
|
|
48
47
|
"toml": "^3.0.0"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type LoadAwsCredentialsResult = {
|
|
2
|
-
awsAccessKeyId: string;
|
|
3
|
-
awsSecretAccessKey: string;
|
|
4
|
-
source: string;
|
|
5
|
-
};
|
|
6
|
-
export type LoadAwsCredentialsParams = {
|
|
7
|
-
awsProfile?: any;
|
|
8
|
-
awsAccessKeyId?: any;
|
|
9
|
-
awsSecretAccessKey?: any;
|
|
10
|
-
};
|
|
11
|
-
export declare function loadAwsCredentials(params: LoadAwsCredentialsParams): Promise<LoadAwsCredentialsResult | null>;
|
|
12
|
-
//# sourceMappingURL=aws-credentials.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aws-credentials.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/aws-credentials.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,wBAAwB,GAAG;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,kBAAkB,CAAC,EAAE,GAAG,CAAC;CAC1B,CAAC;AAEF,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAuEnH"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright Fastly, Inc.
|
|
3
|
-
* Licensed under the MIT license. See LICENSE file for details.
|
|
4
|
-
*/
|
|
5
|
-
import { fromIni } from '@aws-sdk/credential-providers';
|
|
6
|
-
export async function loadAwsCredentials(params) {
|
|
7
|
-
let awsAccessKeyId = null;
|
|
8
|
-
let awsSecretAccessKey = null;
|
|
9
|
-
let source = '';
|
|
10
|
-
// Try command line arg
|
|
11
|
-
if (typeof params.awsAccessKeyId === 'string' &&
|
|
12
|
-
typeof params.awsSecretAccessKey === 'string') {
|
|
13
|
-
const id = params.awsAccessKeyId.trim() || null;
|
|
14
|
-
const key = params.awsSecretAccessKey.trim() || null;
|
|
15
|
-
if (id != null && key != null) {
|
|
16
|
-
awsAccessKeyId = id;
|
|
17
|
-
awsSecretAccessKey = key;
|
|
18
|
-
source = 'commandline';
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
// Try env (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY)
|
|
22
|
-
if (awsAccessKeyId == null && awsSecretAccessKey == null) {
|
|
23
|
-
const id = process.env.AWS_ACCESS_KEY_ID || null;
|
|
24
|
-
const key = process.env.AWS_SECRET_ACCESS_KEY || null;
|
|
25
|
-
if (id != null && key != null) {
|
|
26
|
-
awsAccessKeyId = id;
|
|
27
|
-
awsSecretAccessKey = key;
|
|
28
|
-
source = 'env';
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (awsAccessKeyId == null && awsSecretAccessKey == null) {
|
|
32
|
-
let awsProfile = undefined;
|
|
33
|
-
if (typeof params.awsProfile === 'string') {
|
|
34
|
-
awsProfile = params.awsProfile.trim() || undefined;
|
|
35
|
-
}
|
|
36
|
-
if (awsProfile == null) {
|
|
37
|
-
const profile = process.env.AWS_PROFILE || undefined;
|
|
38
|
-
if (profile != null) {
|
|
39
|
-
awsProfile = profile;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
let provider;
|
|
43
|
-
try {
|
|
44
|
-
provider = await fromIni({ profile: awsProfile ?? undefined })();
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
provider = null;
|
|
48
|
-
}
|
|
49
|
-
if (provider != null) {
|
|
50
|
-
const id = provider.accessKeyId || null;
|
|
51
|
-
const key = provider.secretAccessKey || null;
|
|
52
|
-
if (id != null && key != null) {
|
|
53
|
-
awsAccessKeyId = id;
|
|
54
|
-
awsSecretAccessKey = key;
|
|
55
|
-
source = `credentials (profile ${awsProfile ?? 'default'})`;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (awsAccessKeyId == null || awsSecretAccessKey == null) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
awsAccessKeyId,
|
|
64
|
-
awsSecretAccessKey,
|
|
65
|
-
source,
|
|
66
|
-
};
|
|
67
|
-
}
|