From 63a03d1281615975d5a0259e3f7d854da5e3f622 Mon Sep 17 00:00:00 2001 From: Brooke Date: Fri, 7 Oct 2022 15:39:42 -0700 Subject: [PATCH 1/2] TCA-517 #comment This commit changes the default config to use port ssl and changes my personal config name so that others won't use it. #time 15m --- README.md | 14 +++++++++++--- package.json | 2 +- .../environments/app-host-environment.type.ts | 2 +- ...ouza.config.ts => environment.brooke.config.ts} | 4 ++-- src-ts/config/environments/environment.config.ts | 6 +++--- src-ts/tools/learn/README.md | 2 +- ...arn.bsouza.config.ts => learn.brooke.config.ts} | 2 +- src-ts/tools/learn/learn-config/learn.config.ts | 6 +++--- start-ssl-brooke.sh | 3 +++ start-ssl-bsouza.sh | 4 ---- start-ssl.sh | 1 + 11 files changed, 27 insertions(+), 19 deletions(-) rename src-ts/config/environments/{environment.bsouza.config.ts => environment.brooke.config.ts} (68%) rename src-ts/tools/learn/learn-config/{learn.bsouza.config.ts => learn.brooke.config.ts} (83%) create mode 100644 start-ssl-brooke.sh delete mode 100644 start-ssl-bsouza.sh diff --git a/README.md b/README.md index 340e58034..511756e48 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,14 @@ You can verify the versions of `nvm`, `node`, and `npm` using the commands below | `% nvm current` | v15.15.0 | +>**NOTE:** The `yarn start` command requires the `NVM_DIR` env variable is set. + +```zsh +export NVM_DIR=~/.nvm +``` + +If you don't have this set globally, you can create your own [personal config](#personal-config) to define your local nvm dir. + ### Hosting You will need to add the following line to your hosts file. The hosts file is normally located at `/etc/hosts` (Mac). Do not overwrite the existing localhost entry also pointing to 127.0.0.1. @@ -81,9 +89,9 @@ You will need to add the following line to your hosts file. The hosts file is no >% yarn start -3. Go to https://local.topcoder-dev.com:3000 +3. Go to https://local.topcoder-dev.com ->**NOTE**: The default port is 3000, but you can override it in your [personal config](#personal-config). +>**NOTE**: The must run on port 443 in order for auth0 to work and for the site to load properly. Mac users will need to run the app with elevated permissions. ### Local SSL @@ -102,7 +110,7 @@ Otherwise, you will need to override the exception each time you load the site. ### Personal Config 1. Add [hostname] to [`/src-ts/config/environments/app-host-environment.type.ts`](/src-ts/config/environments/app-host-environment.type.ts) -2. Copy an existing config from [`/src-ts/config/environments/environment.*.config.ts`](/src-ts/config/environments/environment.bsouza.config.ts) +2. Copy an existing config from [`/src-ts/config/environments/environment.*.config.ts`](/src-ts/config/environments/environment.brooke.config.ts) 3. Rename new config `environment.[hostname].config.ts` 4. Rename config variable to `EnvironmentConfig[HostName]` 5. Set the `ENV` variable to `[hostname]` diff --git a/package.json b/package.json index ad70b321e..129e598f8 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "dev": "yarn react-app-rewired start", "start": "sh start-ssl.sh", - "start:bsouza": "sudo sh start-ssl-bsouza.sh", + "start:brooke": "sudo sh start-ssl-brooke.sh", "build": "yarn react-app-rewired build", "lint": "tslint 'src-ts/**/*.{ts,tsx}' && eslint 'src*/**/*.{js,jsx,ts,tsx}'", "lint:fix": "tslint 'src-ts/**/*.{ts,tsx}' --fix && eslint 'src*/**/*.{js,jsx,ts,tsx}' --fix", diff --git a/src-ts/config/environments/app-host-environment.type.ts b/src-ts/config/environments/app-host-environment.type.ts index 01efb080c..193be0f27 100644 --- a/src-ts/config/environments/app-host-environment.type.ts +++ b/src-ts/config/environments/app-host-environment.type.ts @@ -1 +1 @@ -export type AppHostEnvironmentType = 'bsouza' | 'default' | 'dev' | 'prod' +export type AppHostEnvironmentType = 'brooke' | 'default' | 'dev' | 'prod' diff --git a/src-ts/config/environments/environment.bsouza.config.ts b/src-ts/config/environments/environment.brooke.config.ts similarity index 68% rename from src-ts/config/environments/environment.bsouza.config.ts rename to src-ts/config/environments/environment.brooke.config.ts index 269db98cc..a614d691f 100644 --- a/src-ts/config/environments/environment.bsouza.config.ts +++ b/src-ts/config/environments/environment.brooke.config.ts @@ -1,7 +1,7 @@ import { EnvironmentConfigModel } from './environment-config.model' import { EnvironmentConfigDefault } from './environment.default.config' -export const EnvironmentConfigBsouza: EnvironmentConfigModel = { +export const EnvironmentConfigBrooke: EnvironmentConfigModel = { ...EnvironmentConfigDefault, - ENV: 'bsouza', + ENV: 'brooke', } diff --git a/src-ts/config/environments/environment.config.ts b/src-ts/config/environments/environment.config.ts index b0312a180..25fca7939 100644 --- a/src-ts/config/environments/environment.config.ts +++ b/src-ts/config/environments/environment.config.ts @@ -1,6 +1,6 @@ import { AppHostEnvironmentType } from './app-host-environment.type' import { EnvironmentConfigModel } from './environment-config.model' -import { EnvironmentConfigBsouza } from './environment.bsouza.config' +import { EnvironmentConfigBrooke } from './environment.brooke.config' import { EnvironmentConfigDefault } from './environment.default.config' import { EnvironmentConfigDev } from './environment.dev.config' import { EnvironmentConfigProd } from './environment.prod.config' @@ -12,8 +12,8 @@ function getEnvironmentConfig(): EnvironmentConfigModel { switch (environment) { - case 'bsouza': - return EnvironmentConfigBsouza + case 'brooke': + return EnvironmentConfigBrooke case 'default': return EnvironmentConfigDefault diff --git a/src-ts/tools/learn/README.md b/src-ts/tools/learn/README.md index c29536baf..421e50f1f 100644 --- a/src-ts/tools/learn/README.md +++ b/src-ts/tools/learn/README.md @@ -6,7 +6,7 @@ The Learn tool has its own configuration defined in the [/src-ts/tools/learn/lea The default configuration expects both the FCC Client and API to be running locally. In most cases, developers probably won't want to run both locally. ->**See** [/src-ts/tools/learn/learn-config/learn.bsouza.config.ts](/src-ts/tools/learn/learn-config/learn.bsouza.config.ts) for an example of how to override the FCC source URLs to use the dev env config. +>**See** [/src-ts/tools/learn/learn-config/learn.brooke.config.ts](/src-ts/tools/learn/learn-config/learn.brooke.config.ts) for an example of how to override the FCC source URLs to use the dev env config. >**See** the [main app README](/README.md#personal-config) for instructions for creating a personal config. diff --git a/src-ts/tools/learn/learn-config/learn.bsouza.config.ts b/src-ts/tools/learn/learn-config/learn.brooke.config.ts similarity index 83% rename from src-ts/tools/learn/learn-config/learn.bsouza.config.ts rename to src-ts/tools/learn/learn-config/learn.brooke.config.ts index ab591ccaa..01676b2af 100644 --- a/src-ts/tools/learn/learn-config/learn.bsouza.config.ts +++ b/src-ts/tools/learn/learn-config/learn.brooke.config.ts @@ -2,7 +2,7 @@ import { LearnConfigModel } from './learn-config.model' import { LearnConfigDefault } from './learn.default.config' import { LearnConfigDev } from './learn.dev.config' -export const LearnConfigBsouza: LearnConfigModel = { +export const LearnConfigBrooke: LearnConfigModel = { ...LearnConfigDev, // API: LearnConfigDefault.API, CLIENT: LearnConfigDefault.CLIENT, diff --git a/src-ts/tools/learn/learn-config/learn.config.ts b/src-ts/tools/learn/learn-config/learn.config.ts index 64706fc50..24cf6ece7 100644 --- a/src-ts/tools/learn/learn-config/learn.config.ts +++ b/src-ts/tools/learn/learn-config/learn.config.ts @@ -1,7 +1,7 @@ import { EnvironmentConfig } from '../../../config' import { LearnConfigModel } from './learn-config.model' -import { LearnConfigBsouza } from './learn.bsouza.config' +import { LearnConfigBrooke } from './learn.brooke.config' import { LearnConfigDefault } from './learn.default.config' import { LearnConfigDev } from './learn.dev.config' import { LearnConfigProd } from './learn.prod.config' @@ -10,8 +10,8 @@ function getConfig(): LearnConfigModel { switch (EnvironmentConfig.ENV) { - case 'bsouza': - return LearnConfigBsouza + case 'brooke': + return LearnConfigBrooke case 'dev': return LearnConfigDev diff --git a/start-ssl-brooke.sh b/start-ssl-brooke.sh new file mode 100644 index 000000000..2a088f4f3 --- /dev/null +++ b/start-ssl-brooke.sh @@ -0,0 +1,3 @@ +export REACT_APP_HOST_ENV=brooke +export NVM_DIR=~/.nvm +sh ./start-ssl.sh diff --git a/start-ssl-bsouza.sh b/start-ssl-bsouza.sh deleted file mode 100644 index 97893e0db..000000000 --- a/start-ssl-bsouza.sh +++ /dev/null @@ -1,4 +0,0 @@ -export REACT_APP_HOST_ENV=bsouza -export PORT=443 -export NVM_DIR=~/.nvm -sh ./start-ssl.sh diff --git a/start-ssl.sh b/start-ssl.sh index 3a0319aef..739fdd609 100644 --- a/start-ssl.sh +++ b/start-ssl.sh @@ -2,6 +2,7 @@ export HTTPS=true export SSL_CRT_FILE=ssl/server.crt export SSL_KEY_FILE=ssl/server.key export HOST=local.topcoder-dev.com +export PORT=443 source $NVM_DIR/nvm.sh nvm use yarn react-app-rewired start From b6d6c74edf0c9b0b2bf6b8fd46decf92829ea9dc Mon Sep 17 00:00:00 2001 From: Brooke Date: Fri, 7 Oct 2022 15:43:18 -0700 Subject: [PATCH 2/2] TCA-517 cleanup --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 511756e48..cd5757f15 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ You will need to add the following line to your hosts file. The hosts file is no 3. Go to https://local.topcoder-dev.com ->**NOTE**: The must run on port 443 in order for auth0 to work and for the site to load properly. Mac users will need to run the app with elevated permissions. +>**NOTE**: The site must run on port 443 in order for auth0 to work and for the site to load properly. Mac users will need to run the app with elevated permissions. ### Local SSL