@ostro-cloud/cli 1.0.0-alpha.7 → 1.0.0-alpha.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/lib/client.js CHANGED
@@ -148,8 +148,9 @@ function saveConfig(newConfig) {
148
148
  async function request(url, options = {}) {
149
149
  const config = getStoredConfig();
150
150
  const authToken = config.sessionToken || config.token;
151
- if (!authToken && !options.skipAuth) {
152
- throw new Error('Authentication required. Run "ostro-cloud login" or set OSTRO_SESSION_TOKEN.');
151
+ const hasAccessKeys = Boolean(config.accessKeyId && config.secretAccessKey);
152
+ if (!authToken && !hasAccessKeys && !options.skipAuth) {
153
+ throw new Error('Authentication required. Run "ostro-cloud login" or set OSTRO_ACCESS_KEY_ID / OSTRO_SECRET_ACCESS_KEY / OSTRO_SESSION_TOKEN.');
153
154
  }
154
155
 
155
156
  const headers = {
@@ -157,6 +158,8 @@ async function request(url, options = {}) {
157
158
  'Content-Type': 'application/json',
158
159
  ...(authToken ? { 'Authorization': `Bearer ${authToken}` } : {}),
159
160
  ...(config.sessionToken ? { 'X-Ostro-Session-Token': config.sessionToken } : {}),
161
+ ...(config.accessKeyId ? { 'X-Ostro-Access-Key-Id': config.accessKeyId } : {}),
162
+ ...(config.secretAccessKey ? { 'X-Ostro-Secret-Access-Key': config.secretAccessKey } : {}),
160
163
  ...(config.roleArn ? { 'X-Ostro-Role-Arn': config.roleArn } : {}),
161
164
  ...(config.clientId ? { 'X-Ostro-Client-Id': config.clientId } : {}),
162
165
  ...(options.headers || {})
@@ -40,7 +40,10 @@ async function buildImageViaApi(formationUrl, stackName, sourceDir) {
40
40
 
41
41
  const config = getStoredConfig();
42
42
  const authToken = config.sessionToken || config.token;
43
- if (!authToken) throw new Error('Authentication required. Run "ostro-cloud login".');
43
+ const hasAccessKeys = Boolean(config.accessKeyId && config.secretAccessKey);
44
+ if (!authToken && !hasAccessKeys) {
45
+ throw new Error('Authentication required. Run "ostro-cloud login" or set OSTRO_ACCESS_KEY_ID / OSTRO_SECRET_ACCESS_KEY / OSTRO_SESSION_TOKEN.');
46
+ }
44
47
 
45
48
  // Use Node's http/https directly — global fetch (undici) rejects Node Buffers as binary body
46
49
  const statusCode = await new Promise((resolve, reject) => {
@@ -52,8 +55,9 @@ async function buildImageViaApi(formationUrl, stackName, sourceDir) {
52
55
  path: url.pathname + url.search,
53
56
  method: 'POST',
54
57
  headers: {
55
- 'Authorization': `Bearer ${authToken}`,
56
- 'X-Ostro-Session-Token': authToken,
58
+ ...(authToken ? { 'Authorization': `Bearer ${authToken}`, 'X-Ostro-Session-Token': authToken } : {}),
59
+ ...(config.accessKeyId ? { 'X-Ostro-Access-Key-Id': config.accessKeyId } : {}),
60
+ ...(config.secretAccessKey ? { 'X-Ostro-Secret-Access-Key': config.secretAccessKey } : {}),
57
61
  'Content-Type': 'application/octet-stream',
58
62
  'Accept': 'application/json',
59
63
  'X-Stack-Name': stackName,
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@ostro-cloud/cli",
3
- "version": "1.0.0-alpha.7",
3
+ "version": "1.0.0-alpha.8",
4
4
  "description": "Enterprise Command Line Interface (CLI) for Ostro Cloud Serverless, S3 Buckets, Kubernetes, and CloudFormation Orchestration",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
7
- "ostro": "bin/ostro.js",
8
7
  "ocs": "bin/ostro.js",
9
8
  "ostro-cloud": "bin/ostro.js",
10
9
  "ostro-cfn": "bin/ostro.js"