-
Notifications
You must be signed in to change notification settings - Fork 0
Environment Variables
See also: Deployment Guide for platform-specific Deployment instructions.
This project supports Environment Variables for customizing behavior during build and Deployment. This guide covers all supported variables and platform-specific configuration.
- Environment Variables Guide
The project uses Vite's environment variable system, which requires the VITE_ prefix for client-side variables. Environment Variables take priority over configuration files.
Controls the resume download/view link on the Resume page.
Usage:
- External links (Google Drive, OneDrive, etc.)
- Local files (relative to public directory)
- CDN links
Examples:
# External Google Drive link
VITE_RESUME_LINK="https://drive.google.com/file/d/YOUR_FILE_ID/view"
# OneDrive share link
VITE_RESUME_LINK="https://1drv.ms/b/YOUR_SHARE_ID"
# Local file in public directory
VITE_RESUME_LINK="/resume.pdf"
# CDN hosted file
VITE_RESUME_LINK="https://cdn.example.com/files/resume.pdf"Priority System:
- Environment variable (VITE_RESUME_LINK) - Highest priority
- settings.json configuration - Fallback
- Default local file (/resume.pdf) - Last resort
If no environment variable is set, the app will fallback to the value in settings.json or /resume.pdf.
Create or update .github/workflows/deploy.yml:
name: Deploy to GitHub Pages
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
VITE_RESUME_LINK: ${{ secrets.VITE_RESUME_LINK }}
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./distSetting GitHub Secrets:
- Go to your repository → Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
VITE_RESUME_LINK - Value: Your resume URL (e.g.,
https://drive.google.com/file/d/YOUR_ID/view)
Method 1: Environment Variables in Dashboard
- Go to Cloudflare Dashboard → Pages
- Select your project
- Go to Settings → Environment Variables
- Add variable:
- Name:
VITE_RESUME_LINK - Value: Your resume URL
- Environment: Production (and Preview if needed)
- Name:
Method 2: Build Configuration In your build settings:
# Build command
npm run build
# Build output directory
dist
# Environment Variables (set in dashboard)
VITE_RESUME_LINK=https://drive.google.com/file/d/YOUR_FILE_ID/viewUpdate your wrangler.toml:
[env.production.vars]
VITE_RESUME_LINK = "https://drive.google.com/file/d/YOUR_FILE_ID/view"
[env.preview.vars]
VITE_RESUME_LINK = "https://drive.google.com/file/d/YOUR_FILE_ID/view"Create .env file in project root:
# .env (for local development only)
VITE_RESUME_LINK="https://drive.google.com/file/d/YOUR_FILE_ID/view"Important: Never commit .env files to version control. They're already in .gitignore.
- URL Validation: The application validates URLs to prevent XSS attacks
- No Sensitive Data: Only use public resume links in Environment Variables
- HTTPS Only: External links should use HTTPS for security
- Access Control: Ensure resume links are publicly accessible
Check if environment variable is loaded:
- Open browser dev tools
- Go to Console tab
- Look for:
"Using environment resume URL: [your-url]"
Test the button:
- Click the resume button
- Verify it opens your specified URL
- Check that external links open in new tabs
-
Check the prefix: Must be
VITE_RESUME_LINK(notRESUME_LINK) - Rebuild the project: Changes require a rebuild to take effect
- Check platform settings: Verify the variable is set in your Deployment platform
- Case sensitivity: Variable names are case-sensitive
- Verify URL format: Must be valid HTTP/HTTPS or relative path
- Check permissions: Ensure the URL is publicly accessible
- Test manually: Copy the URL and test it in a browser
GitHub Actions:
- Ensure secret is named exactly
VITE_RESUME_LINK - Check workflow logs for build errors
- Verify the secret is accessible to the workflow
Cloudflare Pages:
- Environment Variables take effect on next Deployment
- Check build logs for environment variable loading
- Ensure variable is set for correct environment (production/preview)
# Share your resume on Google Drive and get the shareable link
# Format: https://drive.google.com/file/d/FILE_ID/view
VITE_RESUME_LINK="https://drive.google.com/file/d/1abc123def456ghi789/view"# Use environment variable for CDN, fallback to local file
VITE_RESUME_LINK="https://cdn.mywebsite.com/resume.pdf"# .env.development
VITE_RESUME_LINK="/resume.pdf"
# .env.production (set in Deployment platform)
VITE_RESUME_LINK="https://drive.google.com/file/d/YOUR_ID/view"- Use External Links: For better availability and faster loading
- Test Regularly: Ensure links remain accessible
- Update Documentation: Keep resume links current
- Monitor Analytics: Track resume download/view metrics
- Backup Strategy: Have both external and local copies available
If you encounter issues with Environment Variables:
-
Check the troubleshooting section above
-
Verify your platform-specific configuration
-
Test with a simple URL first (like a local file)
-
Check browser console for error messages
cp .env.example .env
-
Edit
.envwith your values:VITE_RESUME_LINK=https://your-resume-link.com
-
Restart the development server:
npm run dev
- Environment Variables are validated for security
- Dangerous URL schemes (javascript:, data:, vbscript:) are blocked
- Invalid URLs fallback to default resume.pdf
Set Environment Variables in your Deployment platform:
- Vercel: Project Settings → Environment Variables
- Netlify: Site Settings → Environment Variables
- GitHub Pages: Repository Settings → Secrets and Variables
© 2025 Krishna GSVV
Portfolio: VKrishna04.me
GitHub: VKrishna04
Org: Life Experimentalists
Use this sidebar for your wiki, GitHub Pages, or static documentation site. Copy/paste or import as needed.