Skip to content

Commit

Permalink
rollback some broken subdomain updates
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-stoker committed Dec 23, 2023
1 parent df2ff13 commit a51ef33
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 23 deletions.
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stoked-cenv-web",
"version": "2.0.0-a.134",
"version": "2.0.0-a.135",
"license": "MIT",
"private": true,
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions example/packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stoked-cenv/web-api",
"version": "2.0.0-a.134",
"version": "2.0.0-a.135",
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
Expand All @@ -17,8 +17,8 @@
"@nestjs/config": "^3.0.0",
"@nestjs/core": "^10.1.3",
"@nestjs/platform-express": "^10.1.3",
"@stoked-cenv/cdk": "^2.0.0-a.134",
"@stoked-cenv/lib": "^2.0.0-a.134",
"@stoked-cenv/cdk": "^2.0.0-a.135",
"@stoked-cenv/lib": "^2.0.0-a.135",
"express-oauth2-jwt-bearer": "^1.5.0",
"helmet": "^6.2.0",
"nocache": "^3.0.4",
Expand Down
2 changes: 1 addition & 1 deletion example/packages/globals/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stoked-cenv/globals",
"version": "2.0.0-a.134",
"version": "2.0.0-a.135",
"cenv": {
"globals": true
}
Expand Down
2 changes: 1 addition & 1 deletion example/packages/spa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stoked-cenv/web-spa",
"version": "2.0.0-a.134",
"version": "2.0.0-a.135",
"dependencies": {
"@auth0/auth0-react": "^2.2.0",
"axios": "^0.27.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk/src/stacks/cert/site-certificate-stack.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CfnOutput, Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { HostedZone } from 'aws-cdk-lib/aws-route53';
import { Certificate, CertificateValidation, DnsValidatedCertificate } from 'aws-cdk-lib/aws-certificatemanager';
import { Certificate, CertificateValidation } from 'aws-cdk-lib/aws-certificatemanager';
import { getDomains, stackPrefix, tagStack } from '../../index';

export class SiteCertificateStack extends Stack {
Expand Down
17 changes: 2 additions & 15 deletions packages/cdk/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,28 +102,15 @@ export function getDomains(subdomain?: string) {
const appIfNotSameAsRoot = APP && rootDomainParts.shift() !== APP ? APP : undefined;
console.log('appIfNotSameAsRoot', appIfNotSameAsRoot);
const appMatchesRoot = !appIfNotSameAsRoot;
let subs = [];
if (subdomain) {
subs = subdomain.split(',').map(s => `${s}.`);
}
if (subs.length > 0) {
subdomain = subs[0];
}
subdomain = `${subdomain ? subdomain + '.' : ''}`;
const app = appIfNotSameAsRoot ? `${APP}.${rootDomain}` : rootDomain;
if (subs.length > 1) {
for (let i = 1; i < subs.length; i++) {
subs[i] = `${subs[i]}${ENV}.${app}`;
subs[i] = `*.${subs[i]}`;
}
}
const env = `${subdomain}${ENV}.${app}`;
const sub = `*.${env}`;
const domains: {env: string, sub: string, app?: string, primary: string, alt: string[], root: string, www?: string} = { env, sub, primary: env, alt: subs, root: rootDomain }
const domains: {env: string, sub: string, app?: string, primary: string, alt: string[], root: string, www?: string} = { env, sub, primary: env, alt: [sub], root: rootDomain }
if (ENV === 'prod') {
domains.app = app;
domains.primary = `${subdomain}${app}`;
domains.alt = [`*.${app}`, env, sub];
domains.alt = domains.alt.concat(subs);
if (appMatchesRoot) {
domains.www = `www.${app}`;
domains.alt.push(domains.www);
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/params/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"author": "Brian Stoker",
"license": "MIT",
"dependencies": {
"@stoked-cenv/lib": "^2.0.0-a.134",
"@stoked-cenv/lib": "^2.0.0-a.135",
"async-mutex": "^0.4.0",
"build": "^0.1.4",
"js-yaml": "^4.1.0",
Expand Down

0 comments on commit a51ef33

Please sign in to comment.