refactor(config): rename VITE_LAMASSU_* machine-config env vars to VITE_BITSPIRE_*
MACHINE_MODEL, FIAT_CODE, VALIDATOR_DEVICE, DISPENSER_DEVICE and CASSETTES carried the old brand in their names. Renamed everywhere they are read (device.ts, electron/main.ts), written (flake.nix, mkAtmApp.nix, live.nix, provision-atm.sh, factory-reset-atm.sh) and documented (.env.example, docs/device-configuration.md). No compatibility fallback in code: the machine reads VITE_BITSPIRE_* and nothing else. The deployed .env files are the one place the old names persist — sintra's /var/lib/bitspire/.env holds all three keys today — and the machine reads MACHINE_MODEL / FIAT_CODE / CASSETTES from that file on every boot. Renaming the keys in code alone would boot a live machine on preset defaults (wrong bays, wrong fiat) at the next nightly pull. So configuration.nix gains an activation script, beside the existing lamassu→bitspire user migration, that rewrites VITE_LAMASSU_* → VITE_BITSPIRE_* in that file. Idempotent; runs before bitspire.service starts.
This commit is contained in:
parent
d569e4013e
commit
bf2b9427aa
10 changed files with 68 additions and 52 deletions
|
|
@ -355,11 +355,11 @@ ipcMain.handle('get-config', () => {
|
|||
appId: process.env.VITE_APP_ID || '',
|
||||
|
||||
// Hardware configuration
|
||||
machineModel: process.env.VITE_LAMASSU_MACHINE_MODEL || 'sintra',
|
||||
fiatCode: process.env.VITE_LAMASSU_FIAT_CODE || 'USD',
|
||||
validatorDevice: process.env.VITE_LAMASSU_VALIDATOR_DEVICE,
|
||||
dispenserDevice: process.env.VITE_LAMASSU_DISPENSER_DEVICE,
|
||||
cassettes: process.env.VITE_LAMASSU_CASSETTES,
|
||||
machineModel: process.env.VITE_BITSPIRE_MACHINE_MODEL || 'sintra',
|
||||
fiatCode: process.env.VITE_BITSPIRE_FIAT_CODE || 'USD',
|
||||
validatorDevice: process.env.VITE_BITSPIRE_VALIDATOR_DEVICE,
|
||||
dispenserDevice: process.env.VITE_BITSPIRE_DISPENSER_DEVICE,
|
||||
cassettes: process.env.VITE_BITSPIRE_CASSETTES,
|
||||
// SECURITY: In production (packaged app), mock fallback is always disabled.
|
||||
// Only allow it in development mode, and only when explicitly opted in via env.
|
||||
allowMockFallback: isDev && process.env.VITE_ALLOW_MOCK_FALLBACK === 'true',
|
||||
|
|
@ -836,7 +836,7 @@ function startCommandPoller(): void {
|
|||
const result = await halInstance.dispenseCash(parsed.bills)
|
||||
const txid = `manual-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
|
||||
const totalFiatCents = parsed.bills.reduce((s, b) => s + b.denomination * b.count * 100, 0)
|
||||
const fiatCode = process.env.VITE_LAMASSU_FIAT_CODE || 'USD'
|
||||
const fiatCode = process.env.VITE_BITSPIRE_FIAT_CODE || 'USD'
|
||||
|
||||
recordTransaction({
|
||||
txid,
|
||||
|
|
@ -908,19 +908,19 @@ app.whenReady().then(() => {
|
|||
if (existing.length === 0) {
|
||||
let seedCassettes: { denomination: number; count: number }[] = []
|
||||
|
||||
// Priority 1: explicit VITE_LAMASSU_CASSETTES env var
|
||||
const cassettesJson = process.env.VITE_LAMASSU_CASSETTES
|
||||
// Priority 1: explicit VITE_BITSPIRE_CASSETTES env var
|
||||
const cassettesJson = process.env.VITE_BITSPIRE_CASSETTES
|
||||
if (cassettesJson) {
|
||||
try {
|
||||
seedCassettes = JSON.parse(cassettesJson)
|
||||
} catch (e) {
|
||||
console.warn('[Electron] Failed to parse VITE_LAMASSU_CASSETTES:', e)
|
||||
console.warn('[Electron] Failed to parse VITE_BITSPIRE_CASSETTES:', e)
|
||||
}
|
||||
}
|
||||
|
||||
// Priority 2: default presets per model
|
||||
if (seedCassettes.length === 0) {
|
||||
const model = process.env.VITE_LAMASSU_MACHINE_MODEL || 'sintra'
|
||||
const model = process.env.VITE_BITSPIRE_MACHINE_MODEL || 'sintra'
|
||||
const presets: Record<string, { denomination: number; count: number }[]> = {
|
||||
douro: [
|
||||
{ denomination: 100, count: 50 },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue