diff --git a/README.md b/README.md index aba1f360..f387bb1c 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ TaaS App is done using Single SPA micro-frontend architecture https://single-spa ### Local Authentication First of all, to authenticate locally we have to run a local authentication service. + - Clone this repository into `taas-app`. - Inside the folder `taas-app/local/login-locally` run `npm run start`. - You would need npm 5+ for it. This would start a local sever on port 5000 which could be used for local Authentication. @@ -76,36 +77,36 @@ Some config files are using domain `local.topcoder-dev.com`. You can change it t 1. Run **Frame** App: - ```sh - git clone https://github.com/topcoder-platform/micro-frontends-frame.git - cd micro-frontends-frame - # inside folder "micro-frontends-frame" run: + ```sh + git clone https://github.com/topcoder-platform/micro-frontends-frame.git + cd micro-frontends-frame + # inside folder "micro-frontends-frame" run: - nvm use # or make sure to use Node 10 - npm i # to install dependencies + nvm use # or make sure to use Node 10 + npm i # to install dependencies - # set environment variables: + # set environment variables: - export APPMODE="development" - export APPENV="local-multi" + export APPMODE="development" + export APPENV="local-multi" - npm run local-server + npm run local-server - # this would start frame server on http://localhost:3000 - ``` + # this would start frame server on http://localhost:3000 + ``` - open one more terminal window in the same folder and run: + open one more terminal window in the same folder and run: - ```sh - # set environment variables: + ```sh + # set environment variables: - export APPMODE="development" - export APPENV="local-multi" + export APPMODE="development" + export APPENV="local-multi" - npm run local-client + npm run local-client - # this host frame client code on http://localhost:8080 - ``` + # this host frame client code on http://localhost:8080 + ``` 2. Run **Navbar** micro-app: @@ -135,6 +136,10 @@ Some config files are using domain `local.topcoder-dev.com`. You can change it t nvm use # or make sure to use Node 10 npm i # to install dependencies + # set environment variables: + + export STRIPE_PUBLIC_KEY="" + npm run dev # this host TaaS App as http://localhost:8501/taas-app/topcoder-micro-frontends-teams.js @@ -142,16 +147,16 @@ Some config files are using domain `local.topcoder-dev.com`. You can change it t 4. Now we have to update the `micro-frontends-frame` app to show our local version of TaaS App, instead of remote one. Update file `micro-frontends-frame/config/micro-frontends-config-local.json`: - ```js - // replace line - "@topcoder/micro-frontends-teams": "https://platform.topcoder-dev.com/taas-app/topcoder-micro-frontends-teams.js", + ```js + // replace line + "@topcoder/micro-frontends-teams": "https://platform.topcoder-dev.com/taas-app/topcoder-micro-frontends-teams.js", - // with line: - "@topcoder/micro-frontends-teams": "http://localhost:8501/taas-app/topcoder-micro-frontends-teams.js", - ``` + // with line: + "@topcoder/micro-frontends-teams": "http://localhost:8501/taas-app/topcoder-micro-frontends-teams.js", + ``` - Now open in the browser http://localhost:8080/taas/myteams. - If you are not logged-in yet, you should be redirected to the login page. - If you cannot see the application and redirect doesn't happen, make sure that file "http://local.topcoder-dev.com:8501/taas-app/topcoder-micro-frontends-teams.js" is loaded successfully in the Network tab. -Congratulations, you successfully run the project. If you had some issue, please, try to go through README of https://github.com/topcoder-platform/micro-frontends-frame and https://github.com/topcoder-platform/micro-frontends-navbar-app. \ No newline at end of file +Congratulations, you successfully run the project. If you had some issue, please, try to go through README of https://github.com/topcoder-platform/micro-frontends-frame and https://github.com/topcoder-platform/micro-frontends-navbar-app. diff --git a/build.sh b/build.sh index 7d73d2b9..250e113f 100755 --- a/build.sh +++ b/build.sh @@ -4,6 +4,7 @@ APP_NAME=$1 UPDATE_CACHE="" docker build -f docker/Dockerfile -t $APP_NAME:latest \ +--build-arg STRIPE_PUBLIC_KEY=$STRIPE_PUBLIC_KEY \ --build-arg APPMODE=$APPMODE \ --build-arg APPENV=$APPENV . diff --git a/docker/Dockerfile b/docker/Dockerfile index a3565335..00924af2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,9 +3,11 @@ FROM node:10 ARG APPMODE ARG APPENV +ARG STRIPE_PUBLIC_KEY ENV APPMODE=$APPMODE ENV APPENV=$APPENV +ENV STRIPE_PUBLIC_KEY=$STRIPE_PUBLIC_KEY # Copy the current directory into the Docker image COPY . /taas-app diff --git a/local/login-locally/README b/local/login-locally/README index a72052b8..080616cf 100644 --- a/local/login-locally/README +++ b/local/login-locally/README @@ -5,7 +5,3 @@ 3. Now you can open http://localhost:5000 in browser and click login (wait it a little bit, it may take time to redirect you). After you login, you should be redirected back to http://localhost:3000 PS. You may also download latest version of `setupAuth0WithRedirect.js` file from here - https://github.com/topcoder-platform/tc-auth-lib/blob/dev/web-assets/js/setupAuth0WithRedirect.js - - - - diff --git a/local/login-locally/index.html b/local/login-locally/index.html index 5217f1bc..3129ead1 100644 --- a/local/login-locally/index.html +++ b/local/login-locally/index.html @@ -1,18 +1,20 @@ - -
+