saptools
v0.4.2
Published
Extract SAP HANA credentials from Cloud Foundry environments for SQL tools
Downloads
1,028
Maintainers
Readme
⚡ saptools
Extract SAP HANA credentials from Cloud Foundry — straight into your SQLTools config.
Stop copy-pasting credentials manually.
saptoolsconnects to CF, finds your HANA bindings, and writes your SQLTools connections — in seconds.
✨ Features
- 🔍 Interactive extraction — guided prompts to pick region → org → space → apps
- ⚡ Local cache — orgs and apps are cached locally; subsequent runs are near-instant even with 30+ apps
- 🔄 Background sync — run a
launchddaemon to keep cache fresh every 15 minutes - 🎯 SQLTools-ready — auto-updates
.vscode/settings.jsonwithsqltools.connections - 🌏 Multi-region — supports Singapore (AP11) and Brazil São Paulo (BR10) out of the box
- 🖥️ Spinner UX — real-time
oraprogress for every step, no silent waiting
📦 Installation
npm install -g saptoolsSet your credentials once:
export [email protected]
export SAP_PASSWORD=your-passwordTip: Add these to your
~/.zshrcor~/.bashrcso they persist across sessions.
🚀 Quick Start
saptoolsYou'll be guided through an interactive menu:
? What would you like to do?
❯ 🔍 Extract to SQLTools Config
🔄 Refresh Data Cache (Sync All)Pick Extract, select your region, org, space, and apps — done. Your .vscode/settings.json is updated automatically.
🛠️ Commands
| Command | Description |
|---|---|
| saptools | Launch interactive mode |
| saptools sync | Manually sync all regions to local cache |
| saptools cronjob enable | Install background sync daemon (launchd on macOS) |
| saptools cronjob disable | Remove background sync daemon |
| saptools cronjob status | Check daemon status |
⚙️ How It Works
saptools
↓
Interactive menu → Select region, org, space, apps
↓
CF API → VCAP_SERVICES → Extract HANA credentials
↓
Write → .vscode/settings.json (sqltools.connections)
~/.config/saptools/output.jsonCache architecture: On first run, orgs and app lists are fetched from CF and stored in ~/.config/saptools/cache.json. Subsequent runs read from cache — making selection near-instant. Run saptools sync or enable the background daemon to keep cache fresh.
🔄 Background Sync
# Enable auto-sync every 15 minutes (launchd on macOS, crontab on Linux/WSL)
saptools cronjob enable
# Check sync logs
tail -f ~/.config/saptools/sync.logThe daemon runs silently and keeps your local cache up-to-date, so the CLI always loads instantly.
🔐 Credentials
saptools reads credentials from environment variables only — nothing is ever stored on disk.
export [email protected]
export SAP_PASSWORD=your-password🧪 Development
git clone https://github.com/dongitran/saptools
cd saptools
npm install
npm run check # typecheck + lint + spell + tests
npm run test # unit tests with coverage
npm run build # compile TypeScript📄 License
MIT © dongitran
