danin: API key pindah ke Script Properties BRIDGE_API_KEY + setter
Lint / lint (push) Has been cancelled

This commit is contained in:
player
2026-10-01 09:48:13 +07:00
parent debf4c30f0
commit b23c04b144
2 changed files with 39 additions and 5 deletions
+26 -2
View File
@@ -22,8 +22,32 @@ projects/danin/
- `GET ?apiKey=...&op=meta` → info sheet (judul, jumlah baris/kolom, nama tab)
- `GET ?apiKey=...&op=rows&sheet=DATA&start=1&limit=500` → `{header, rows, range, totalRows}`
API key web app (`sk-dta-…`) tersimpan di dalam `Code.js` — JANGAN tampilkan di chat/vault (file ini tidak mencatat nilainya).
Ganti key: edit di editor Apps Script ATAU ubah `dist/Code.js` lalu `clasp push` (akun bdn).
API key web app tersimpan di **Script Properties** (`BRIDGE_API_KEY`) — TIDAK di dalam kode, tidak di git.
JANGAN tampilkan nilainya di chat/vault.
## Cara set / rotasi key (akun bdn, sekali per script)
Opsi A — via editor (klik manusia): project `1IJ4…` → Project Settings (gerigi) →
Script Properties → Add property: key `BRIDGE_API_KEY`, value key baru → Save.
Opsi B — via clasp run (tanpa browser, dari PC/runner setelah `use bdn`):
```
clasp run __setBridgeKey --params '["sk-baru-..."]'
```
dengan fungsi setter di bawah (ada di `dist/Code.js`, boleh dipanggil via API
tapi TIDAK terekspos sebagai web app):
```js
function __setBridgeKey(k) {
PropertiesService.getScriptProperties().setProperty('BRIDGE_API_KEY', k);
return 'ok';
}
```
Ganti key: set property baru (A/B) → pull/tes baca tetap jalan → hapus key lama
dari semua pemanggil (`pull-sheets-gas.ps1 -ApiKey`, Scheduler, n8n).
## Riwayat