From ee3914b9d8d2ce65ad81849217102c094037b12b Mon Sep 17 00:00:00 2001 From: recursivefunk Date: Tue, 10 Feb 2026 15:18:08 -0500 Subject: [PATCH] Improve getUrl docs --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9dfb5d3..0cf7242 100644 --- a/README.md +++ b/README.md @@ -78,9 +78,24 @@ env.list('VALUES', { cast: 'number' }); // [1, 2, 3] (converts from '1,2,3') ```javascript // Get as a URL object -env.getUrl('API_ENDPOINT'); // Returns URL object with helpful properties +// API_ENDPOINT=https://api.example.com/v1 +const apiUrl = env.getUrl('API_ENDPOINT'); +// Returns: +// { +// httpOk: true, +// redisOk: false, +// pgOk: false, +// href: 'https://api.example.com/v1', +// raw: URL { ... } // Native Node.js URL object +// } + env.url('API_ENDPOINT'); // Shorthand for getUrl() +// Supported protocols: http, https, redis, postgresql +// DATABASE_URL=postgresql://user:pass@localhost:5432/mydb +const dbUrl = env.getUrl('DATABASE_URL'); +// Returns: { pgOk: true, redisOk: false, httpOk: false, href: '...', raw: URL {...} } + // Get an IP address (with validation) env.getIp('SERVER_IP', '127.0.0.1'); // Returns the IP if valid, or default ```