Optimize .env with domain-based defaults for easier deployment #14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add a base
VITE_DOMAINenvironment variable that automatically derives sensible defaults for all other URL-based variables. This makes deployment significantly easier - you only need to set your domain once.Current State
Currently, deploying requires setting multiple URL variables manually:
Proposed Solution
New Variables
Default Derivations
When
VITE_DOMAINis set, the following defaults apply:VITE_LNBITS_BASE_URLhttps://lnbits.{domain}VITE_LIGHTNING_DOMAIN{domain}VITE_PICTRS_BASE_URLhttps://img.{domain}Protocol Handling
VITE_USE_HTTPS=true(default) →https://prefixVITE_USE_HTTPS=false→http://prefix (for local dev)Example Configurations
Minimal Production Setup
Results in:
https://lnbits.mydomain.commydomain.comhttps://img.mydomain.comLocal Development
Custom Subdomains
Implementation Notes
src/lib/config.tsto implement domain-based defaults.env.examplewith the new patternBenefits