# react-rwp Setup Project
This directory contains the Inno Setup script for building a setup package for [react-rwp](https://github.com/Greenfield-Investments/react-rwp). It also includes a PowerShell script to configure IIS features and roles and a new IIS site for the deployed application ([IIS_Config.ps1](IIS_Config.ps1)), which relies on a deployment configuration template file to determine which IIS features and roles should be installed ([DeploymentConfigTemplate.xml](DeploymentConfigTemplate.xml)).

## Configuration Variables
During installation using the compiled setup package for react-rwp, the user is prompted for values for the following configuration variables:

1. Company name (for branding).
2. iWS5 API URL.
3. Whether to enable/disable the RWP Companion integration.
4. Whether to enable/disable LPNU work item signage<sup>3</sup>.
5. The list of LPNU signage certificate issuer names<sup>3, 4</sup>.
6. IIS site name and host name.

The non-IIS configuration variables are used to update the `config.js` file after installation has completed, and the IIS site and host names are passed to the PowerShell script to create the new IIS site.

## Dependencies
The minimal set of IIS features and roles required to run react-rwp are defined in [DeploymentConfigTemplate.xml](DeploymentConfigTemplate.xml). When the setup process is complete, IIS will be configured and any features/roles which are not already installed on the target machine will be installed. This process can take a while, depending on the target machine.

In addition to IIS, the following dependencies are required to host react-rwp:

1. The [IIS URL Rewrite 2.1 module](https://download.microsoft.com/download/1/2/8/128E2E22-C1B9-44A4-BE2A-5859ED1D4592/rewrite_amd64_en-US.msi) must be installed for IIS to host bundled single-page applications. This file should be located at `redist/rewrite_amd64_en-US.msi`.

## Additional Notes
1. When building the react-rwp setup package, the `PublishPath` pre-processor variable in the Inno Setup script ([RRWP_Setup.iss](RRWP_Setup.iss)) should be set to the `dist` directory created after building the application using [Vite](https://vite.dev/) (`npm run build`).
2. When building the react-rwp setup package, the `MyAppVersion` pre-processor variable will be set by the output of the [Extract_Version.ps1](Extract_Version.ps1) PowerShell script which reads the compiled application files for the version string.
3. The "Enable LPNU work item signage" checkbox and the additional page for entering the list of valid certificate issuer names are only shown when the setup executable is run from the command line with the flag: `/LPNU=true`
4. When the "Enable LPNU work item signage" checkbox is checked on the application variables configuration page of setup, an additional page is shown with a text area where the user must enter the list of valid certificate issuer names (one per line). These values are used to assemble a function in the `config.js` file that is used to retrieve the list dynamically.