Skip to main content

ENV_variables_documentation

Environment Variables

This application requires environment variables to be configured for Azure Storage integration. Create a .env.local file in the root directory with the following variables:

Required Variables

  • VITE_AZURE_STORAGE_ACCOUNT_NAME: The name of your Azure Storage account

    • Example: opersight
  • VITE_AZURE_STORAGE_SAS_TOKEN: A Shared Access Signature (SAS) token for accessing Azure Storage

    • Must grant Read and List permissions on Blobs, and Query permission on Tables
    • Should not include the leading ? character
    • Example: sv=2025-07-05&ss=btqf&srt=sco&spr=https&st=...&se=...&sp=rl&sig=...

Optional Variables (with defaults)

  • VITE_AZURE_BLOB_CONTAINER: The name of the blob container (default: zip-files)
  • VITE_AZURE_TABLE_NAME: The name of the Azure Table Storage table (default: ZipFiles)
  • VITE_AZURE_BLOB_RAW_PREFIX: Prefix path for raw blob files (default: raw)
  • VITE_AZURE_BLOB_SEG_PREFIX: Prefix path for segmented blob files (default: seg)
  • VITE_AZURE_BLOB_ENDPOINT: Custom blob service endpoint (default: auto-generated from account name)
  • VITE_AZURE_TABLE_ENDPOINT: Custom table service endpoint (default: auto-generated from account name)

Example .env.local file

VITE_AZURE_STORAGE_ACCOUNT_NAME=opersight
VITE_AZURE_STORAGE_SAS_TOKEN=sv=2025-07-05&ss=btqf&srt=sco&spr=https&st=2025-12-01T14%3A38%3A53Z&se=2026-02-02T14%3A38%3A00Z&sp=rl&sig=...
VITE_AZURE_BLOB_CONTAINER=zip-files
VITE_AZURE_TABLE_NAME=ZipFiles
VITE_AZURE_BLOB_RAW_PREFIX=raw
VITE_AZURE_BLOB_SEG_PREFIX=seg

Adding Environment Variables to GitHub Workflow

Environment variables for production builds are configured in the GitHub Actions workflow file. There are two approaches:

Option 1: Direct Configuration (Current Approach)

Environment variables are defined directly in the workflow file under the env section of the build step:

Location: .github/workflows/azure-static-web-apps-red-field-0d0aada10.yml (lines 25-33)

How to add/update variables:

  1. Open the workflow file: .github/workflows/azure-static-web-apps-red-field-0d0aada10.yml
  2. Locate the env section under the Build And Deploy step (around line 25)
  3. Add or modify variables as key-value pairs:
- name: Build And Deploy
uses: Azure/static-web-apps-deploy@v1
env:
VITE_AZURE_STORAGE_ACCOUNT_NAME: "your-account-name"
VITE_AZURE_STORAGE_SAS_TOKEN: "your-sas-token"
VITE_AZURE_BLOB_CONTAINER: "zip-files"
VITE_AZURE_TABLE_NAME: "ZipFiles"
VITE_AZURE_BLOB_RAW_PREFIX: "raw"
VITE_AZURE_BLOB_SEG_PREFIX: "seg"
  1. Commit and push to trigger the deployment

For better security, especially for sensitive values like SAS tokens, use GitHub Secrets:

Steps:

  1. Add Secrets to GitHub Repository:

    • Go to your repository on GitHub
    • Navigate to SettingsSecrets and variablesActions
    • Click New repository secret
    • Add secrets for sensitive values:
      • AZURE_STORAGE_ACCOUNT_NAME
      • AZURE_STORAGE_SAS_TOKEN
      • (Optional) Other environment-specific values
  2. Update the Workflow File:

    Edit .github/workflows/azure-static-web-apps-red-field-0d0aada10.yml and replace hardcoded values with secrets:

    - name: Build And Deploy
    uses: Azure/static-web-apps-deploy@v1
    env:
    VITE_AZURE_STORAGE_ACCOUNT_NAME: ${{ secrets.AZURE_STORAGE_ACCOUNT_NAME }}
    VITE_AZURE_STORAGE_SAS_TOKEN: ${{ secrets.AZURE_STORAGE_SAS_TOKEN }}
    VITE_AZURE_BLOB_CONTAINER: "zip-files"
    VITE_AZURE_TABLE_NAME: "ZipFiles"
    VITE_AZURE_BLOB_RAW_PREFIX: "raw"
    VITE_AZURE_BLOB_SEG_PREFIX: "seg"