Add dotenv

This commit is contained in:
Jon Staab
2026-02-25 15:16:48 -08:00
parent 9bc6c42aee
commit de4a16adbf
11 changed files with 3790 additions and 7 deletions
+26
View File
@@ -0,0 +1,26 @@
# Server
HOST=127.0.0.1
PORT=3000
# Database
DATABASE_URL=sqlite://data/caravel.db
# Nostr
PLATFORM_ADMIN_PUBKEYS= # Comma-separated hex pubkeys with super admin access
PLATFORM_SECRET= # Nostr private key (hex) used to send NIP-17 DMs and sign events
# Zooid
ZOOID_API_URL=http://127.0.0.1:8032
RELAY_DOMAIN=spaces.coracle.social
# Billing
NWC_URL= # Nostr Wallet Connect URL for generating Lightning invoices
# Indexer
NOSTR_INDEXER_RELAYS=wss://purplepag.es/,wss://relay.damus.io/,wss://relay.nostr.band/
# Platform identity (published as kind 0)
PLATFORM_NAME=
PLATFORM_DESCRIPTION=
PLATFORM_PICTURE=
PLATFORM_MESSAGING_RELAYS= # Comma-separated relay URLs published in kind 10050
+3740
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -19,3 +19,4 @@ tower-http = { version = "0.5", features = ["cors"] }
reqwest = { version = "0.12", features = ["json", "rustls-tls"] }
rand = "0.8"
hex = "0.4"
dotenvy = "0.15.7"
+2 -2
View File
@@ -33,7 +33,7 @@ Environment variables:
| Variable | Description | Default |
|---|---|---|
| `DATABASE_URL` | SQLite database URL | `sqlite://data/hosting.db` |
| `DATABASE_URL` | SQLite database URL | `sqlite://data/caravel.db` |
| `HOST` | Bind host | `127.0.0.1` |
| `PORT` | Bind port | `3000` |
| `ZOOID_API_URL` | Zooid API base URL | `http://127.0.0.1:8032` |
@@ -116,7 +116,7 @@ Tenant routes (all require NIP-98 auth; pubkey is inferred from the token):
- `GET /tenant/invoices` — list invoices
- `PUT /tenant/billing` — update tenant billing (NWC URL)
Admin routes (all require NIP-98 auth; pubkey must be in `HOSTING_ADMIN_PUBKEYS`):
Admin routes (all require NIP-98 auth; pubkey must be in `PLATFORM_ADMIN_PUBKEYS`):
- `GET /admin/tenants` — list tenants
- `GET /admin/tenants/:pubkey` — tenant detail (includes relays)
+2 -2
View File
@@ -20,13 +20,13 @@ pub struct Config {
impl Config {
pub fn from_env() -> Self {
let database_url =
env::var("DATABASE_URL").unwrap_or_else(|_| "sqlite://data/hosting.db".to_string());
env::var("DATABASE_URL").unwrap_or_else(|_| "sqlite://data/caravel.db".to_string());
let host = env::var("HOST").unwrap_or_else(|_| "127.0.0.1".to_string());
let port = env::var("PORT")
.ok()
.and_then(|v| v.parse().ok())
.unwrap_or(3000);
let admin_pubkeys = env::var("HOSTING_ADMIN_PUBKEYS")
let admin_pubkeys = env::var("PLATFORM_ADMIN_PUBKEYS")
.unwrap_or_default()
.split(',')
.map(|v| v.trim().to_string())
+2
View File
@@ -27,6 +27,8 @@ use crate::repo::Repo;
#[tokio::main]
async fn main() -> Result<()> {
dotenvy::dotenv().ok();
tracing_subscriber::registry()
.with(tracing_subscriber::EnvFilter::from_default_env())
.with(tracing_subscriber::fmt::layer())