|
1 | 1 | # Branding Configuration |
2 | 2 |
|
3 | | -This project supports two branding modes: **Red Hat** (enterprise) and **Community** (Trustify). |
| 3 | +This project supports flexible branding through backend environment variables. The system defaults to **Trustify** branding and allows you to override specific elements as needed. |
4 | 4 |
|
5 | 5 | ## Quick Start |
6 | 6 |
|
7 | | -### Prerequisites |
8 | | -Install the `env-cmd` package to enable environment-specific builds: |
| 7 | +### Using Predefined Profiles |
| 8 | + |
| 9 | +**Community/Trustify branding (default):** |
9 | 10 | ```bash |
10 | | -npm install --save-dev env-cmd |
| 11 | +# Default profile - no additional flags needed |
| 12 | +./mvnw quarkus:dev |
| 13 | + |
| 14 | +# Or explicitly use community profile |
| 15 | +./mvnw quarkus:dev -Dquarkus.profile=community |
11 | 16 | ``` |
12 | 17 |
|
13 | | -### Development |
| 18 | +**Red Hat Enterprise branding:** |
14 | 19 | ```bash |
15 | | -# Start development server with Community branding (default) |
16 | | -npm run start:community |
| 20 | +./mvnw quarkus:dev -Dquarkus.profile=redhat |
| 21 | +``` |
17 | 22 |
|
18 | | -# Start development server with Red Hat branding |
19 | | -npm run start:redhat |
| 23 | +### Using Environment Variables (Alternative) |
| 24 | +```bash |
| 25 | +# Start development server (branding controlled by backend environment variables) |
| 26 | +npm start |
20 | 27 | ``` |
21 | 28 |
|
22 | 29 | ### Production Build |
23 | 30 | ```bash |
24 | | -# Build Community version |
25 | | -npm run build:community |
| 31 | +# Build for production (branding controlled by backend environment variables) |
| 32 | +npm run build |
| 33 | +``` |
| 34 | + |
| 35 | +## How It Works |
| 36 | + |
| 37 | +1. **Backend Configuration**: Java backend reads `EXHORT_BRANDING_XXX` environment variables |
| 38 | +2. **Runtime Injection**: Branding configuration is passed to the React app through `appData` |
| 39 | +3. **Component Usage**: React components read branding configuration from the app context |
| 40 | +4. **Trustify-First**: All defaults are set to Trustify values, specific brands override as needed |
| 41 | + |
| 42 | +## Available Environment Variables |
| 43 | + |
| 44 | +Configure branding by setting these environment variables for the Java backend: |
| 45 | + |
| 46 | +```bash |
| 47 | +# Brand identity |
| 48 | +EXHORT_BRANDING_DISPLAY_NAME=Your Brand Name # Used for conditional logic |
| 49 | +EXHORT_BRANDING_REMEDIATION_TITLE=Your Remediation Title # Title for remediation section |
| 50 | +EXHORT_BRANDING_ICON=icon_name # Icon identifier ('redhat' or 'trustify') |
26 | 51 |
|
27 | | -# Build Red Hat version |
28 | | -npm run build:redhat |
| 52 | +# Explore section |
| 53 | +EXHORT_BRANDING_EXPLORE_URL=https://your-url.com # URL for "Take me there" button |
| 54 | +EXHORT_BRANDING_EXPLORE_TITLE=Your Explore Title # Title for explore section |
| 55 | +EXHORT_BRANDING_EXPLORE_DESCRIPTION=Your description text # Description text |
29 | 56 | ``` |
30 | 57 |
|
31 | | -## Configuration Files |
| 58 | +## Branding Logic |
32 | 59 |
|
33 | | -### `.env.community` - Community/Trustify Version |
34 | | -- Uses Trustify branding |
35 | | -- Points to https://guac.sh/trustify/ |
36 | | -- Shows "Trustify Overview of security issues" |
37 | | -- Uses Trustify icon for remediations |
| 60 | +The system uses `displayName` for all branding decisions: |
38 | 61 |
|
39 | | -### `.env.redhat` - Red Hat Enterprise Version |
40 | | -- Uses Red Hat branding |
41 | | -- Points to Red Hat developer portal |
42 | | -- Shows "Red Hat Overview of security Issues" |
43 | | -- Uses Red Hat icon for remediations |
44 | | -- Includes "from Red Hat" in remediation text |
| 62 | +- **Red Hat branding**: Triggered when `displayName === 'Red Hat'` |
| 63 | +- **Community branding**: Default for any other `displayName` value (including fallback to 'Trustify') |
45 | 64 |
|
46 | | -## How It Works |
| 65 | +## Examples |
| 66 | + |
| 67 | +### Method 1: Using Predefined Profiles (Recommended) |
| 68 | + |
| 69 | +**Red Hat Enterprise branding:** |
| 70 | +```bash |
| 71 | +./mvnw quarkus:dev -Dquarkus.profile=redhat |
| 72 | +``` |
| 73 | + |
| 74 | +**Community/Trustify branding:** |
| 75 | +```bash |
| 76 | +# Default behavior (no profile needed) |
| 77 | +./mvnw quarkus:dev |
| 78 | + |
| 79 | +# Or explicitly |
| 80 | +./mvnw quarkus:dev -Dquarkus.profile=community |
| 81 | +``` |
| 82 | + |
| 83 | +**Production builds with profiles:** |
| 84 | +```bash |
| 85 | +# Red Hat production build |
| 86 | +./mvnw clean package -Dquarkus.profile=redhat |
47 | 87 |
|
48 | | -1. **Environment Variables**: Different `.env` files define branding configuration |
49 | | -2. **Branding Config**: `src/config/branding.ts` reads environment variables and provides typed configuration |
50 | | -3. **Conditional Rendering**: Components use `getBrandingConfig()` to conditionally render content based on branding mode |
| 88 | +# Community production build |
| 89 | +./mvnw clean package -Dquarkus.profile=community |
| 90 | +``` |
| 91 | + |
| 92 | +### Method 2: Using Environment Variables |
| 93 | + |
| 94 | +**Red Hat Enterprise Configuration:** |
| 95 | +```bash |
| 96 | +export EXHORT_BRANDING_DISPLAY_NAME="Red Hat" |
| 97 | +export EXHORT_BRANDING_REMEDIATION_TITLE="Red Hat Remediations" |
| 98 | +export EXHORT_BRANDING_ICON="redhat" |
| 99 | +export EXHORT_BRANDING_EXPLORE_URL="https://developers.redhat.com/products/trusted-profile-analyzer/overview" |
| 100 | +export EXHORT_BRANDING_EXPLORE_TITLE="Join to explore Red Hat TPA" |
| 101 | +export EXHORT_BRANDING_EXPLORE_DESCRIPTION="Check out our new Trustify to get visibility and insight into your software risk profile, for instance by exploring vulnerabilites or analyzing SBOMs." |
| 102 | + |
| 103 | +./mvnw quarkus:dev |
| 104 | +``` |
51 | 105 |
|
52 | | -## Customizing Branding |
| 106 | +**Community/Trustify Configuration:** |
| 107 | +```bash |
| 108 | +export EXHORT_BRANDING_DISPLAY_NAME="Trustify" |
| 109 | +export EXHORT_BRANDING_REMEDIATION_TITLE="Remediations" |
| 110 | +export EXHORT_BRANDING_ICON="trustify" |
| 111 | +export EXHORT_BRANDING_EXPLORE_URL="https://guac.sh/trustify/" |
| 112 | +export EXHORT_BRANDING_EXPLORE_TITLE="Learn more about Trustify" |
| 113 | +export EXHORT_BRANDING_EXPLORE_DESCRIPTION="The Trustify project is a collection of software components that enables you to store and retrieve Software Bill of Materials (SBOMs), and advisory documents." |
53 | 114 |
|
54 | | -To modify branding, edit the respective `.env` file: |
| 115 | +./mvnw quarkus:dev |
| 116 | +``` |
55 | 117 |
|
| 118 | +### Custom Branding |
56 | 119 | ```bash |
57 | | -REACT_APP_BRANDING_MODE=community|redhat |
58 | | -REACT_APP_BRAND_NAME=Your Brand Name |
59 | | -REACT_APP_BRAND_TITLE=Your Overview Title |
60 | | -REACT_APP_REMEDIATION_TITLE=Your Remediation Title |
61 | | -REACT_APP_BRAND_ICON=icon_name |
62 | | -REACT_APP_BRAND_URL=https://your-url.com |
63 | | -REACT_APP_EXPLORE_TITLE=Your Explore Title |
64 | | -REACT_APP_EXPLORE_DESCRIPTION=Your description text |
65 | | -``` |
| 120 | +export EXHORT_BRANDING_DISPLAY_NAME="My Company" |
| 121 | +export EXHORT_BRANDING_REMEDIATION_TITLE="My Company Remediations" |
| 122 | +export EXHORT_BRANDING_ICON="trustify" # Use trustify icon as fallback |
| 123 | +export EXHORT_BRANDING_EXPLORE_URL="https://mycompany.com" |
| 124 | +export EXHORT_BRANDING_EXPLORE_TITLE="Learn about My Company" |
| 125 | +export EXHORT_BRANDING_EXPLORE_DESCRIPTION="Custom description for our security platform." |
| 126 | +``` |
| 127 | + |
| 128 | +## Backend Integration |
| 129 | + |
| 130 | +The branding configuration is handled in `ReportTemplate.java`: |
| 131 | + |
| 132 | +```java |
| 133 | +@ConfigProperty(name = "exhort.branding.display.name", defaultValue = "Trustify") |
| 134 | +String brandingDisplayName; |
| 135 | + |
| 136 | +@ConfigProperty(name = "exhort.branding.remediation.title", defaultValue = "Remediations") |
| 137 | +String brandingRemediationTitle; |
| 138 | + |
| 139 | +// ... additional configuration properties |
| 140 | + |
| 141 | +private Map<String, String> getBrandingConfig() { |
| 142 | + Map<String, String> branding = new HashMap<>(); |
| 143 | + branding.put("displayName", brandingDisplayName); |
| 144 | + branding.put("remediationTitle", brandingRemediationTitle); |
| 145 | + branding.put("icon", brandingIcon); |
| 146 | + branding.put("exploreUrl", brandingExploreUrl); |
| 147 | + branding.put("exploreTitle", brandingExploreTitle); |
| 148 | + branding.put("exploreDescription", brandingExploreDescription); |
| 149 | + return branding; |
| 150 | +} |
| 151 | +``` |
| 152 | + |
| 153 | +The configuration is then passed to the frontend via the `appData` object in the Freemarker template. |
| 154 | + |
| 155 | +## Profile Configuration |
| 156 | + |
| 157 | +The branding profiles are defined in `src/main/resources/application.properties`: |
| 158 | + |
| 159 | +```properties |
| 160 | +# Default branding configuration (Community/Trustify) |
| 161 | +exhort.branding.display.name=Trustify |
| 162 | +exhort.branding.remediation.title=Remediations |
| 163 | +exhort.branding.icon=trustify |
| 164 | +exhort.branding.explore.url=https://guac.sh/trustify/ |
| 165 | +exhort.branding.explore.title=Learn more about Trustify |
| 166 | +exhort.branding.explore.description=The Trustify project is a collection of software components that enables you to store and retrieve Software Bill of Materials (SBOMs), and advisory documents. |
| 167 | + |
| 168 | +# Red Hat Enterprise branding profile |
| 169 | +%redhat.exhort.branding.display.name=Red Hat |
| 170 | +%redhat.exhort.branding.remediation.title=Red Hat Remediations |
| 171 | +%redhat.exhort.branding.icon=redhat |
| 172 | +%redhat.exhort.branding.explore.url=https://developers.redhat.com/products/trusted-profile-analyzer/overview |
| 173 | +%redhat.exhort.branding.explore.title=Join to explore Red Hat TPA |
| 174 | +%redhat.exhort.branding.explore.description=Check out our new Trustify to get visibility and insight into your software risk profile, for instance by exploring vulnerabilites or analyzing SBOMs. |
| 175 | +``` |
| 176 | + |
| 177 | +Environment variables will override profile settings if both are provided. |
0 commit comments