Skip to content

Commit

Permalink
Merge pull request #134 from Sitecore/feature/static-outcomes-option-2
Browse files Browse the repository at this point in the history
Feature/static outcomes option 2
  • Loading branch information
dylanyoung-dev committed Feb 1, 2024
2 parents 289a614 + 0a49917 commit 3866adc
Show file tree
Hide file tree
Showing 26 changed files with 853 additions and 187 deletions.
6 changes: 5 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ NEXT_PUBLIC_MEASUREMENT_ID=""

# Production
#SITECORE_CH1_CLIENT_KEY=
#SITECORE_CH1_ENDPOINT_URL="https://edge.sitecorecloud.io/api/graphql/v1/"
#SITECORE_CH1_ENDPOINT_URL="https://edge.sitecorecloud.io/api/graphql/v1/"

## Azure Table Storage
AZURE_TABLE_NAME='Urls'
AZURE_TABLE_CONNECTION_STRING="UseDevelopmentStorage=true"
2 changes: 2 additions & 0 deletions .github/workflows/component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ jobs:
SITECORE_CH1_ENDPOINT_URL: ${{ secrets.SITECORE_CH1_ENDPOINT_URL }}
SITECORE_CH1_CLIENT_KEY: ${{ secrets.SITECORE_CH1_CLIENT_KEY }}
NEXT_PUBLIC_EMAIL_FORM_ENDPOINT: ${{ secrets.NEXT_PUBLIC_EMAIL_FORM_ENDPOINT }}
AZURE_TABLE_NAME: 'Urls'
AZURE_TABLE_CONNECTION_STRING: ${{ secrets.AZURE_TABLE_CONNECTION_STRING }}


2 changes: 2 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ jobs:
env:
SITECORE_CH1_ENDPOINT_URL: ${{ secrets.SITECORE_CH1_ENDPOINT_URL }}
SITECORE_CH1_CLIENT_KEY: ${{ secrets.SITECORE_CH1_CLIENT_KEY }}
AZURE_TABLE_NAME: 'Urls'
AZURE_TABLE_CONNECTION_STRING: ${{ secrets.AZURE_TABLE_CONNECTION_STRING }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,8 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
.vscode/settings.json

# Ignore azurite files
__azurite**
__blobstorage
__queuestorage
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Welcome to the open source project for the Sitecore Migration app. The purpose o
- Cypress 16.6.0
- Sitecore Content Hub One (to drive the data for the application)
- Sitecore CDP/Personalize (not required)
- Azure Table Storage (either using the emulator or a live account)
- Azurite for Local Development with Azure Table Storage (Version 3.29.0)

## Development

Expand All @@ -21,7 +23,39 @@ To get started you need to follow the following steps:
4. Run `npm install` to install all the dependencies.
5. Run `npm run dev` to start the development server.

### Optional
## Running Azure Table Storage

This project relies on creating outcome urls on the fly based on the users answers. To do this, we use Azure Table Storage to store the outcome urls. You can configure in your `.env` file the connection string to your Azure Table Storage account. The environment variables needed to connect to Azure Table Storage consist of:

- AZURE_TABLE_NAME
- AZURE_TABLE_CONNECTION_STRING

The name of the table should always be `Urls` to match up with the code.

### Running Azure Table Storage Locally

You can run Azure Table Storage locally, but not required. Below are the steps to run Azure Table Storage locally.

1. Install the Azure Storage Emulator (azurite). You can follow these instructions: (https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=npm%2Cblob-storage). Or you can install azurite globally by running `npm install -g azurite`.
2. Ensure you are able to run the command `azurite` in your terminal. If you are not able to run this command, you may need to add the path to your `azurite` executable to your PATH environment variable.
3. Update your `.env` file with the following values:

```
AZURE_TABLE_NAME=Urls
AZURE_TABLE_CONNECTION_STRING='UseDevelopmentStorage=true'
```

4. Run `npm run dev:azurite` which will start the Next.js development server and azurite local service simultaneously.

> This will start the Azure Table Storage emulator and the development server at the same time. You can now run the application locally.
5. If this is the first time running the above command, you will need to create the table in Azure Table Storage manually (after you've run step 4). You can do this by connecting to the local emulator using Azure Storage Explorer. You can download Azure Storage Explorer here: https://azure.microsoft.com/en-us/features/storage-explorer/
6. Once you have downloaded Azure Storage Explorer, install it, and then open the tool.
7. Along the left side of the tool is the "Explorer", you should see an option for "Emulator & Attached" which you should expand.
8. You should then see an option for "Emulator - Default Ports" which you should expand.
9. You should then see an option for "Tables", which you should right click on and select "Create Table".
10. Enter the name of the table as `Urls` and click "Create".
11. You should now see the table in the list of tables and now be able to run the application locally. Navigate to your website in the browser (ie. http://localhost:3000).

### Running Cypress Tests

Expand Down
Loading

0 comments on commit 3866adc

Please sign in to comment.