@ostro-cloud/cli 1.0.0-alpha.4 → 1.0.0-alpha.6

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/bin/ostro.js CHANGED
@@ -194,14 +194,14 @@ program
194
194
  // Doctor
195
195
  const SERVICES = [
196
196
  { name: 'Unified Console', host: 'console.ostro-cloud.com', path: '/api/health' },
197
- { name: 'Kubernetes Engine', host: 'console.ostro-cloud.com', path: '/kubernetes/api/health' },
198
- { name: 'Ostro Serverless', host: 'console.ostro-cloud.com', path: '/serverless/api/health' },
199
- { name: 'Ostro Bucket S3', host: 'console.ostro-cloud.com', path: '/storage/api/s3/health' },
200
- { name: 'Ostro Formation', host: 'console.ostro-cloud.com', path: '/formation/api/health' },
201
- { name: 'API Gateway', host: 'console.ostro-cloud.com', path: '/gateway/api/health' },
202
- { name: 'Ostro DNS', host: 'console.ostro-cloud.com', path: '/dns/api/health' },
203
- { name: 'Message Broker', host: 'console.ostro-cloud.com', path: '/broker/api/health' },
204
- { name: 'CloudWatch Logs', host: 'console.ostro-cloud.com', path: '/cloudwatch/api/health' }
197
+ { name: 'Kubernetes Engine', host: 'eks.ostro-cloud.com', path: '/api/health' },
198
+ { name: 'Ostro Serverless', host: 'serverless.ostro-cloud.com', path: '/api/health' },
199
+ { name: 'Ostro Bucket S3', host: 's3.ostro-cloud.com', path: '/api/health' },
200
+ { name: 'Ostro Formation', host: 'formation.ostro-cloud.com', path: '/health' },
201
+ { name: 'API Gateway', host: 'apigateway.ostro-cloud.com', path: '/api/health' },
202
+ { name: 'Ostro DNS', host: 'route53.ostro-cloud.com', path: '/api/health' },
203
+ { name: 'Message Broker', host: 'mq.ostro-cloud.com', path: '/api/health' },
204
+ { name: 'CloudWatch Logs', host: 'logs.ostro-cloud.com', path: '/api/health' }
205
205
  ];
206
206
 
207
207
  async function checkService(svc) {
package/lib/client.js CHANGED
@@ -38,12 +38,12 @@ const SERVICE_PATHS = {
38
38
 
39
39
  /**
40
40
  * Returns the base URL for a service.
41
- * Pattern: https://console.ostro-cloud.com/<service>
41
+ * Pattern: https://<service>.ostro-cloud.com
42
42
  */
43
- function defaultServiceUrl(service, _region, _domain) {
43
+ function defaultServiceUrl(service, _region, domain) {
44
44
  const seg = SERVICE_PATHS[service] || service;
45
- const host = process.env.OSTRO_CONSOLE_HOST || DEFAULT_CONSOLE_HOST;
46
- return `${host.replace(/\/+$/, '')}/${seg}`;
45
+ const d = domain || process.env.OSTRO_DOMAIN || DEFAULT_CLOUD_DOMAIN;
46
+ return `https://${seg}.${d}`;
47
47
  }
48
48
 
49
49
  function getStoredConfig() {
@@ -136,9 +136,13 @@ async function validateTemplate(options = {}) {
136
136
  }
137
137
  effectiveParams = loadEnvParams(templateDir, effectiveParams);
138
138
 
139
- const buildContextDir = fs.existsSync(path.join(templateDir, 'Dockerfile'))
140
- ? templateDir
141
- : (fs.existsSync(path.join(process.cwd(), 'Dockerfile')) ? process.cwd() : null);
139
+ const codeUriMatch = yamlContent.match(/^\s*(?:CodeUri|BuildContext)\s*:\s*['"]?([^\s'"#]+)['"]?/m);
140
+ const codeUriDir = codeUriMatch ? path.resolve(templateDir, codeUriMatch[1]) : null;
141
+ const buildContextDir = (codeUriDir && fs.existsSync(codeUriDir))
142
+ ? codeUriDir
143
+ : (fs.existsSync(path.join(templateDir, 'Dockerfile'))
144
+ ? templateDir
145
+ : (fs.existsSync(path.join(process.cwd(), 'Dockerfile')) ? process.cwd() : null));
142
146
 
143
147
  if (options.image) {
144
148
  effectiveParams = { ...effectiveParams, Image: options.image };
@@ -214,9 +218,13 @@ async function createStack(options = {}) {
214
218
  }
215
219
  effectiveParams = loadEnvParams(templateDir, effectiveParams);
216
220
 
217
- const buildContextDir = fs.existsSync(path.join(templateDir, 'Dockerfile'))
218
- ? templateDir
219
- : (fs.existsSync(path.join(process.cwd(), 'Dockerfile')) ? process.cwd() : null);
221
+ const codeUriMatch = yamlContent.match(/^\s*(?:CodeUri|BuildContext)\s*:\s*['"]?([^\s'"#]+)['"]?/m);
222
+ const codeUriDir = codeUriMatch ? path.resolve(templateDir, codeUriMatch[1]) : null;
223
+ const buildContextDir = (codeUriDir && fs.existsSync(codeUriDir))
224
+ ? codeUriDir
225
+ : (fs.existsSync(path.join(templateDir, 'Dockerfile'))
226
+ ? templateDir
227
+ : (fs.existsSync(path.join(process.cwd(), 'Dockerfile')) ? process.cwd() : null));
220
228
 
221
229
  if (options.image) {
222
230
  effectiveParams = { ...effectiveParams, Image: options.image };
@@ -286,9 +294,13 @@ async function deployStack(options = {}) {
286
294
  }
287
295
  effectiveParams = loadEnvParams(templateDir, effectiveParams);
288
296
 
289
- const buildContextDir = fs.existsSync(path.join(templateDir, 'Dockerfile'))
290
- ? templateDir
291
- : (fs.existsSync(path.join(process.cwd(), 'Dockerfile')) ? process.cwd() : null);
297
+ const codeUriMatch = yamlContent.match(/^\s*(?:CodeUri|BuildContext)\s*:\s*['"]?([^\s'"#]+)['"]?/m);
298
+ const codeUriDir = codeUriMatch ? path.resolve(templateDir, codeUriMatch[1]) : null;
299
+ const buildContextDir = (codeUriDir && fs.existsSync(codeUriDir))
300
+ ? codeUriDir
301
+ : (fs.existsSync(path.join(templateDir, 'Dockerfile'))
302
+ ? templateDir
303
+ : (fs.existsSync(path.join(process.cwd(), 'Dockerfile')) ? process.cwd() : null));
292
304
 
293
305
  if (options.image) {
294
306
  effectiveParams = { ...effectiveParams, Image: options.image };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ostro-cloud/cli",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.6",
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": {