Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1e07655
feat: sync the internal code into horizon
ansh-meesho Nov 18, 2025
d43555f
Merge branch 'develop' into feat/horizon_code_sync
ansh-meesho Nov 18, 2025
45b0062
fix: updated the name from inferflowservice to inferflow in proto files
ansh-meesho Nov 18, 2025
bc47a67
Merge branch 'feat/horizon_code_sync' of https://github.com/Meesho/Bh…
ansh-meesho Nov 18, 2025
dd4032d
fix
ansh-meesho Nov 18, 2025
73ffb0b
fix
ansh-meesho Nov 18, 2025
43d0310
init all configs
ansh-meesho Nov 18, 2025
85acfdb
Sync Code with develop
Adit2607 Nov 21, 2025
2fbe84c
Added switch between cac and env (#205)
ansh-meesho Nov 21, 2025
31b08a5
Fixed the env initialization and feature validation call
ansh-meesho Nov 24, 2025
f586926
Merge branch 'develop' into feat/horizon_code_sync
ansh-meesho Nov 24, 2025
e56462f
updated the go version
ansh-meesho Nov 24, 2025
bff7186
Merge branch 'feat/horizon_code_sync' of github.com:Meesho/BharatMLSt…
ansh-meesho Nov 24, 2025
47fdab3
updated the go version
ansh-meesho Nov 24, 2025
4b2e02e
Merge branch 'develop' of github.com:Meesho/BharatMLStack into feat/h…
ansh-meesho Nov 24, 2025
512d150
Updated start script to provide option to run local services and upda…
ansh-meesho Nov 24, 2025
13e6f77
Merge branch 'develop' of github.com:Meesho/BharatMLStack into feat/h…
Adit2607 Nov 25, 2025
db93704
Upgraded helix client to alpha release
Adit2607 Nov 25, 2025
24dedf7
Merge branch 'develop' of github.com:Meesho/BharatMLStack into feat/h…
ansh-meesho Nov 25, 2025
8168086
Updated the horizon the test files
ansh-meesho Nov 25, 2025
42747ad
Fixed the failed vet checked
ansh-meesho Nov 25, 2025
a0d3413
Fixed the staticcheck
ansh-meesho Nov 25, 2025
12d9c8e
Added Fix for Horizon startup
Adit2607 Nov 25, 2025
4cd95df
Merge branch 'feat/horizon_code_sync' of github.com:Meesho/BharatMLSt…
Adit2607 Nov 25, 2025
bbd3d41
Updated the start.sh
ansh-meesho Nov 25, 2025
509d279
refactor: update EntityRegistry and StoreRegistry to use structured c…
ati-jn Nov 27, 2025
5a6a01f
revert conf-id db display
ati-jn Nov 27, 2025
0e3372a
Update db and etcd script for testing
ansh-meesho Nov 27, 2025
f296e67
Merge branch 'develop' of github.com:Meesho/BharatMLStack into feat/h…
ansh-meesho Nov 27, 2025
6eb0d75
start script rollback
ansh-meesho Nov 27, 2025
f9284c4
fix failing static check commands
ansh-meesho Nov 27, 2025
9280ee5
remove the max limit size for the page
ansh-meesho Dec 1, 2025
c45d736
Merge branch 'develop' of https://github.com/Meesho/BharatMLStack int…
ati-jn Dec 3, 2025
a2b034e
Update axios version and add new dependencies in package.json
ati-jn Dec 5, 2025
53ee801
feat: add comprehensive environment variables documentation and backe…
ati-jn Mar 26, 2026
ff8dbdb
Merge branch 'develop' of https://github.com/Meesho/BharatMLStack int…
ati-jn Mar 26, 2026
548e778
Merge branch 'feat/auth-and-permission' of https://github.com/Meesho/…
ati-jn Apr 28, 2026
03b33d4
fix: remove hardcoded Google OAuth credentials for security
ati-jn Apr 28, 2026
f6d4b4a
chore: remove outdated documentation files for backend improvements a…
ati-jn Apr 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 205 additions & 0 deletions ENV_VARIABLES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# Environment Variables Documentation

This document lists all environment variables required for the authentication and permission system.

## Backend (Horizon) Environment Variables

### Required Variables

#### JWT Configuration
- **`JWT_SECRET_KEY`** (Required)
- Description: Secret key for signing JWT tokens
- Example: `JWT_SECRET_KEY=your-very-secure-random-string-here`
- **Security Note**: Use a strong, randomly generated string in production. Never commit this to version control.
- Default: `horizon-admin-secret` (development only - will log a warning)

### Optional Variables (SSO Configuration)

#### SSO Enable/Disable
- **`SSO_ENABLED`** (Optional, default: `false`)
- Description: Enable or disable SSO authentication
- Values: `true` or `false`
- Example: `SSO_ENABLED=true`

#### SSO Provider Mode
- **`SSO_PROVIDER`** (Optional, default: `password`)
- Description: Authentication mode configuration
- Values:
- `password` - Only username/password login available
- `google` - Only Google SSO available
- `both` - Both username/password and Google SSO available
- Example: `SSO_PROVIDER=both`

#### Google OAuth Credentials (Required if SSO_ENABLED=true and SSO_PROVIDER includes 'google')
- **`GOOGLE_OAUTH_CLIENT_ID`** (Required for Google SSO)
- Description: Google OAuth 2.0 Client ID
- How to get:
1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create a new project or select existing
3. Enable Google+ API
4. Go to "Credentials" β†’ "Create Credentials" β†’ "OAuth 2.0 Client ID"
5. Application type: Web application
6. Copy the Client ID
- Example: `GOOGLE_OAUTH_CLIENT_ID=123456789-abcdefghijklmnop.apps.googleusercontent.com`

- **`GOOGLE_OAUTH_CLIENT_SECRET`** (Required for Google SSO)
- Description: Google OAuth 2.0 Client Secret
- How to get: Same as above, copy the Client Secret
- Example: `GOOGLE_OAUTH_CLIENT_SECRET=GOCSPX-abcdefghijklmnopqrstuvwxyz`
- **Security Note**: Keep this secret secure. Never commit to version control.

- **`GOOGLE_OAUTH_REDIRECT_URI`** (Required for Google SSO)
- Description: OAuth callback URL that Google will redirect to after authentication
- Must match exactly with the redirect URI configured in Google Cloud Console
- Format: `http://your-frontend-domain/auth/google/callback`
- Examples:
- Local development: `http://localhost:3000/auth/google/callback`
- Production: `https://yourdomain.com/auth/google/callback`
- Example: `GOOGLE_OAUTH_REDIRECT_URI=http://localhost:3000/auth/google/callback`

#### Token Expiry Configuration (Optional)
- **`ACCESS_TOKEN_EXPIRY`** (Optional, default: `24`)
- Description: Access token expiry time in hours
- Example: `ACCESS_TOKEN_EXPIRY=24`

- **`REFRESH_TOKEN_EXPIRY`** (Optional, default: `7`)
- Description: Refresh token expiry time in days
- Example: `REFRESH_TOKEN_EXPIRY=7`

## Frontend (TruffleBox UI) Environment Variables

### Optional Variables (SSO Configuration)

#### SSO Enable/Disable
- **`REACT_APP_SSO_ENABLED`** (Optional, default: `false`)
- Description: Enable or disable SSO authentication in frontend
- Should match backend `SSO_ENABLED` setting
- Values: `true` or `false`
- Example: `REACT_APP_SSO_ENABLED=true`

#### SSO Provider Mode
- **`REACT_APP_SSO_PROVIDER`** (Optional, default: `password`)
- Description: Authentication mode configuration for frontend
- Should match backend `SSO_PROVIDER` setting
- Values:
- `password` - Only username/password login available
- `google` - Only Google SSO available
- `both` - Both username/password and Google SSO available
- Example: `REACT_APP_SSO_PROVIDER=both`

## Setup Instructions

### For Local Development

1. **Backend Setup** (`horizon/env.example` or `.env`):
```bash
# Required
JWT_SECRET_KEY=your-secure-random-key-here

# Optional - for SSO
SSO_ENABLED=true
SSO_PROVIDER=both
GOOGLE_OAUTH_CLIENT_ID=your-client-id
GOOGLE_OAUTH_CLIENT_SECRET=your-client-secret
GOOGLE_OAUTH_REDIRECT_URI=http://localhost:3000/auth/google/callback
```

2. **Frontend Setup** (`trufflebox-ui/env.example` or `.env`):
```bash
# Optional - for SSO
REACT_APP_SSO_ENABLED=true
REACT_APP_SSO_PROVIDER=both
```

### For Production

1. **Generate a secure JWT secret**:
```bash
# Generate a random 32-byte key (base64 encoded)
openssl rand -base64 32
```

2. **Set all environment variables** in your deployment configuration (Docker, Kubernetes, etc.)

3. **Ensure Google OAuth redirect URI** matches your production frontend URL

## Google OAuth Setup Steps

1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create a new project or select existing
3. Enable "Google+ API" (or "Google Identity API")
4. Navigate to "APIs & Services" β†’ "Credentials"
5. Click "Create Credentials" β†’ "OAuth 2.0 Client ID"
6. Configure:
- Application type: Web application
- Name: Your application name
- Authorized JavaScript origins: `http://localhost:3000` (dev) or `https://yourdomain.com` (prod)
- Authorized redirect URIs: `http://localhost:3000/auth/google/callback` (dev) or `https://yourdomain.com/auth/google/callback` (prod)
7. Copy the Client ID and Client Secret
8. Set them in your environment variables

## Security Best Practices

1. **Never commit secrets to version control**
- Use `.env` files (already in `.gitignore`)
- Use secret management systems in production (AWS Secrets Manager, HashiCorp Vault, etc.)

2. **Use strong JWT secrets**
- Minimum 32 characters
- Randomly generated
- Different for each environment (dev/staging/prod)

3. **Rotate secrets regularly**
- Change JWT_SECRET_KEY periodically
- Rotate Google OAuth credentials if compromised

4. **Use HTTPS in production**
- OAuth redirects must use HTTPS
- Protects tokens in transit

## Example Configuration Files

### Backend `.env` (horizon/.env)
```bash
# ... existing variables ...

# JWT Configuration
JWT_SECRET_KEY=your-production-secret-key-here-min-32-chars

# SSO Configuration
SSO_ENABLED=true
SSO_PROVIDER=both
GOOGLE_OAUTH_CLIENT_ID=123456789-abc.apps.googleusercontent.com
GOOGLE_OAUTH_CLIENT_SECRET=GOCSPX-xyz123
GOOGLE_OAUTH_REDIRECT_URI=https://yourdomain.com/auth/google/callback

# Token Expiry (optional)
ACCESS_TOKEN_EXPIRY=24
REFRESH_TOKEN_EXPIRY=7
```

### Frontend `.env` (trufflebox-ui/.env)
```bash
# ... existing variables ...

# SSO Configuration
REACT_APP_SSO_ENABLED=true
REACT_APP_SSO_PROVIDER=both
```

## Verification

After setting up environment variables:

1. **Backend**: Check logs for warnings about missing OAuth credentials
2. **Frontend**: Check browser console for SSO status
3. **Test SSO**: Try the "Sign in with Google" button (if enabled)

## Troubleshooting

- **SSO button not showing**: Check `REACT_APP_SSO_ENABLED=true` and backend `SSO_ENABLED=true`
- **OAuth redirect fails**: Verify `GOOGLE_OAUTH_REDIRECT_URI` matches Google Cloud Console configuration
- **Token refresh not working**: Check `JWT_SECRET_KEY` is set and consistent across restarts
- **Permission denied errors**: Verify permissions are set up in the database for your role


Loading
Loading