feat: configurable fee rates via VITE_CASH_IN_FEE and VITE_CASH_OUT_FEE
Accepts percentage (5.55) or decimal (0.0555) — auto-detected by whether the value is >= 1. Defaults to 3.33% cash-in, 7.77% cash-out. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
cc109b2958
commit
2a2faf41ef
4 changed files with 31 additions and 3 deletions
|
|
@ -30,6 +30,12 @@ import { initializeHal, type HalInstance } from './hal-service.js'
|
|||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(__filename)
|
||||
|
||||
/** Parse fee value: accepts percentage (5.55 → 0.0555) or decimal (0.0555 → 0.0555) */
|
||||
function parseFee(val: string): number {
|
||||
const n = parseFloat(val)
|
||||
return n >= 1 ? n / 100 : n
|
||||
}
|
||||
|
||||
// Load .env file manually (Electron main process doesn't have Vite's env loading)
|
||||
function loadEnvFile() {
|
||||
const envPath = path.join(__dirname, '..', '.env')
|
||||
|
|
@ -190,6 +196,10 @@ ipcMain.handle('get-config', () => {
|
|||
|
||||
// Maintenance mode — show "out of service" screen
|
||||
maintenanceMode: process.env.VITE_MAINTENANCE_MODE === 'true',
|
||||
|
||||
// Fee rates — accepts percentage (5.55) or decimal (0.0555), auto-detected
|
||||
cashInFeeRate: parseFee(process.env.VITE_CASH_IN_FEE || '0.0333'),
|
||||
cashOutFeeRate: parseFee(process.env.VITE_CASH_OUT_FEE || '0.0777'),
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue