Skip to content

Open source personal finance application

refactor: rename OPENEXCHANGERATES_APP_ID to OPEN_EXCHANGE_RATES_KEY

Ilya Komichev2d2d8082745e
diff --git a/.claude/skills/security-review/SKILL.md b/.claude/skills/security-review/SKILL.md
index 1e0f4223..3cd96fd0 100644
--- a/.claude/skills/security-review/SKILL.md
+++ b/.claude/skills/security-review/SKILL.md
@@ -34,9 +34,9 @@ const config = useRuntimeConfig()
const publicKey = config.public.convexUrl
// Convex backend env vars
-const apiKey = process.env.OPENEXCHANGERATES_APP_ID
+const apiKey = process.env.OPEN_EXCHANGE_RATES_KEY
if (!apiKey) {
- throw new Error('OPENEXCHANGERATES_APP_ID not configured')
+ throw new Error('OPEN_EXCHANGE_RATES_KEY not configured')
}
```
diff --git a/CLAUDE.md b/CLAUDE.md
index 79fef8a7..d49931a0 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -111,7 +111,7 @@ npx convex env set BETTER_AUTH_SECRET <value>
npx convex env set APP_URL http://localhost:3050
npx convex env set GOOGLE_CLIENT_ID <value>
npx convex env set GOOGLE_CLIENT_SECRET <value>
-npx convex env set OPENEXCHANGERATES_APP_ID <value>
+npx convex env set OPEN_EXCHANGE_RATES_KEY <value>
```
## Environment Variables
@@ -135,7 +135,7 @@ All `.env*` files are gitignored except `.env.example`.
- `BETTER_AUTH_SECRET` - secret key for Better Auth (**required** - without it all auth endpoints including CORS preflight will fail)
- `APP_URL` - app URL for cross-domain auth and CORS/trustedOrigins
- `GOOGLE_CLIENT_ID` / `GOOGLE_CLIENT_SECRET` - Google OAuth
-- `OPENEXCHANGERATES_APP_ID` - exchange rates API
+- `OPEN_EXCHANGE_RATES_KEY` - exchange rates API
## Key Files
diff --git a/README.md b/README.md
index 919d3482..7bd920e4 100644
--- a/README.md
+++ b/README.md
@@ -102,7 +102,7 @@ npx convex env set BETTER_AUTH_SECRET your_secret
npx convex env set APP_URL https://your-app-domain.com
npx convex env set GOOGLE_CLIENT_ID your_client_id
npx convex env set GOOGLE_CLIENT_SECRET your_client_secret
-npx convex env set OPENEXCHANGERATES_APP_ID your_app_id
+npx convex env set OPEN_EXCHANGE_RATES_KEY your_app_id
```
- **BETTER_AUTH_SECRET**: Required — without it all auth endpoints including CORS preflight will fail
diff --git a/convex/rates.ts b/convex/rates.ts
index 4ed27804..fdaf2e56 100644
--- a/convex/rates.ts
+++ b/convex/rates.ts
@@ -3,7 +3,8 @@ import { v } from 'convex/values'
import { internal } from './_generated/api'
import { internalAction, internalMutation, query } from './_generated/server'
-const appId = process.env.OPENEXCHANGERATES_APP_ID
+const RATES_API_URL = 'https://openexchangerates.org/api/latest.json'
+const appId = process.env.OPEN_EXCHANGE_RATES_KEY
export const getLatest = query({
args: {},
@@ -40,12 +41,12 @@ export const fetchAndSaveRates = internalAction({
args: {},
handler: async (ctx) => {
if (!appId) {
- console.error('OPENEXCHANGERATES_APP_ID not set')
+ console.error('OPEN_EXCHANGE_RATES_KEY not set')
return
}
const res = await fetch(
- `https://openexchangerates.org/api/latest.json?app_id=${appId}`,
+ `${RATES_API_URL}?app_id=${appId}`,
)
if (!res.ok) {