thinkwork-cli 0.12.9 → 0.12.11
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/dist/{api-client-MC4NOZ4L.js → api-client-ASJWIG3Z.js} +1 -1
- package/dist/{chunk-34NMB5AK.js → chunk-JEHV35EU.js} +31 -0
- package/dist/cli.js +14134 -12808
- package/dist/commands/enterprise/templates/deploy-repo/.github/workflows/deploy.yml +38 -12
- package/dist/commands/enterprise/templates/deploy-repo/docs/runbook.md +85 -78
- package/dist/commands/enterprise/templates/deploy-repo/scripts/apply-release.mjs +1 -0
- package/dist/terraform/examples/greenfield/main.tf +37 -16
- package/dist/terraform/modules/app/static-site/main.tf +34 -3
- package/dist/terraform/modules/app/www-dns/main.tf +34 -7
- package/dist/terraform/modules/app/www-dns/variables.tf +14 -2
- package/dist/terraform/modules/thinkwork/main.tf +66 -15
- package/dist/terraform/modules/thinkwork/outputs.tf +32 -6
- package/dist/terraform/modules/thinkwork/variables.tf +14 -2
- package/package.json +1 -1
|
@@ -43,6 +43,11 @@ function saveEnterpriseDeployment(config) {
|
|
|
43
43
|
JSON.stringify(config, null, 2) + "\n"
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
|
+
function loadEnterpriseDeployment(customerSlug) {
|
|
47
|
+
const configPath = join(ENTERPRISE_DEPLOYMENTS_DIR, `${customerSlug}.json`);
|
|
48
|
+
if (!existsSync(configPath)) return null;
|
|
49
|
+
return JSON.parse(readFileSync(configPath, "utf-8"));
|
|
50
|
+
}
|
|
46
51
|
function loadEnvironment(stage) {
|
|
47
52
|
const configPath = join(ENVIRONMENTS_DIR, stage, "config.json");
|
|
48
53
|
if (!existsSync(configPath)) return null;
|
|
@@ -176,6 +181,30 @@ function getApiEndpoint(stage, region) {
|
|
|
176
181
|
);
|
|
177
182
|
return raw && raw !== "None" ? raw : null;
|
|
178
183
|
}
|
|
184
|
+
function discoverThinkworkStageUrls(stage, region) {
|
|
185
|
+
const urls = {};
|
|
186
|
+
const apiEndpoint = getApiEndpoint(stage, region);
|
|
187
|
+
if (apiEndpoint) urls.apiEndpoint = apiEndpoint;
|
|
188
|
+
const appSyncUrl = runAws(
|
|
189
|
+
`appsync list-graphql-apis --region ${region} --query "graphqlApis[?name=='thinkwork-${stage}-subscriptions'].uris.GRAPHQL|[0]" --output text`
|
|
190
|
+
);
|
|
191
|
+
if (appSyncUrl && appSyncUrl !== "None") urls.appSyncUrl = appSyncUrl;
|
|
192
|
+
const distributions = runAws(
|
|
193
|
+
`cloudfront list-distributions --query "DistributionList.Items[?contains(Origins.Items[0].DomainName, 'thinkwork-${stage}-')].{Origin:Origins.Items[0].DomainName,Domain:DomainName}" --output json`
|
|
194
|
+
);
|
|
195
|
+
if (distributions) {
|
|
196
|
+
const parsed = JSON.parse(distributions);
|
|
197
|
+
for (const distribution of parsed) {
|
|
198
|
+
if (distribution.Origin.includes(`thinkwork-${stage}-admin`)) {
|
|
199
|
+
urls.adminUrl = `https://${distribution.Domain}`;
|
|
200
|
+
}
|
|
201
|
+
if (distribution.Origin.includes(`thinkwork-${stage}-docs`)) {
|
|
202
|
+
urls.docsUrl = `https://${distribution.Domain}`;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return urls;
|
|
207
|
+
}
|
|
179
208
|
function getApiAuthSecretFromLambda(stage, region) {
|
|
180
209
|
const raw = runAws(
|
|
181
210
|
`lambda get-function-configuration --function-name thinkwork-${stage}-api-tenants --region ${region} --query "Environment.Variables.API_AUTH_SECRET" --output text`
|
|
@@ -345,8 +374,10 @@ export {
|
|
|
345
374
|
printSummary,
|
|
346
375
|
listDeployedStages,
|
|
347
376
|
getApiEndpoint,
|
|
377
|
+
discoverThinkworkStageUrls,
|
|
348
378
|
saveEnvironment,
|
|
349
379
|
saveEnterpriseDeployment,
|
|
380
|
+
loadEnterpriseDeployment,
|
|
350
381
|
loadEnvironment,
|
|
351
382
|
listEnvironments,
|
|
352
383
|
resolveTerraformDir,
|