From 68f5140e2b424957dc3eff2dabd70bd26eed3380 Mon Sep 17 00:00:00 2001 From: Matt Rabe Date: Sat, 21 Feb 2026 07:32:47 -1000 Subject: [PATCH] Env var clean up --- apps/api/.env.example | 7 +++++-- apps/api/package.json | 2 +- apps/api/src/config/index.ts | 20 +++++++++---------- apps/api/src/config/types.ts | 16 +++++++-------- .../src/endpoints/trpc/systemSettings/get.ts | 6 ++++-- apps/mobile/package.json | 2 +- .../components/MinimumRequiredVersionGate.tsx | 4 ++-- 7 files changed, 31 insertions(+), 26 deletions(-) diff --git a/apps/api/.env.example b/apps/api/.env.example index b50d878..7c914a7 100644 --- a/apps/api/.env.example +++ b/apps/api/.env.example @@ -4,8 +4,11 @@ API_PORT=3000 # API base URL API_BASE_URL=http://localhost:3000 -# App base URL -APP_BASE_URL=plannting:// +# Mobile app base URL +MOBILE_APP_BASE_URL=plannting:// + +# Enforce a minimum required mobile app version +MOBILE_APP_MINIMUM_REQUIRED_VERSION=0.9.0 # Debug logging # See readme for "Verbose debug logging" diff --git a/apps/api/package.json b/apps/api/package.json index f6f8ffb..07545c2 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -8,7 +8,7 @@ "build": "tsc && npm run copy:assets", "copy:assets": "mkdir -p dist/assets && cp -r src/assets/* dist/assets/ 2>/dev/null || true", "start": "node dist/index.js", - "lint": "eslint src --ext .ts", + "lint": "tsc --noEmit", "test": "jest", "test:watch": "jest --watch" }, diff --git a/apps/api/src/config/index.ts b/apps/api/src/config/index.ts index da662be..6193480 100644 --- a/apps/api/src/config/index.ts +++ b/apps/api/src/config/index.ts @@ -5,20 +5,20 @@ export const config: ApiConfig = { baseUrl: process.env.API_BASE_URL, port: parseInt(process.env.API_PORT || '3000'), }, - app: { - baseUrl: process.env.APP_BASE_URL, - }, - appStoreUrls: { - android: process.env.APP_STORE_URL_ANDROID ?? 'https://play.google.com/store/apps/details?id=com.completecodesolutions.***', - ios: process.env.APP_STORE_URL_IOS ?? 'https://apps.apple.com/us/app/***/***', - }, expo: { accessToken: process.env.EXPO_ACCESS_TOKEN, }, jwt: { secret: process.env.JWT_SECRET || '' }, - // Used by the mobile app to determine whether it must hard-block the UI until the user updates. - // Default is 0.0.0 so we never block unless explicitly configured. - minimumRequiredMobileAppVersion: (process.env.MINIMUM_REQUIRED_MOBILE_APP_VERSION ?? '0.9.0') as SemVerString, + mobileApp: { + baseUrl: process.env.MOBILE_APP_BASE_URL, + // Used by the mobile app to determine whether it must hard-block the UI until the user updates. + // Default is 0.0.0 so we never block unless explicitly configured. + minimumRequiredVersion: (process.env.MOBILE_APP_MINIMUM_REQUIRED_VERSION ?? '0.9.0') as SemVerString, + storeUrls: { + android: process.env.MOBILE_APP_STORE_URL_ANDROID ?? 'https://play.google.com/store/apps/details?id=com.completecodesolutions.***', + ios: process.env.MOBILE_APP_STORE_URL_IOS ?? 'https://apps.apple.com/us/app/***/***', + }, + }, mongo: { host: process.env.MONGO_HOST, appName: process.env.MONGO_APP_NAME, diff --git a/apps/api/src/config/types.ts b/apps/api/src/config/types.ts index fe0ba72..ec5626c 100644 --- a/apps/api/src/config/types.ts +++ b/apps/api/src/config/types.ts @@ -5,20 +5,20 @@ export type ApiConfig = { baseUrl: string | undefined, port: number, }, - app: { - baseUrl: string | undefined, - }, - appStoreUrls: { - android: string, - ios: string, - }, expo: { accessToken: string | undefined, }, jwt: { secret: string, }, - minimumRequiredMobileAppVersion: SemVerString, + mobileApp: { + baseUrl: string | undefined, + minimumRequiredVersion: SemVerString, + storeUrls: { + android: string, + ios: string, + }, + }, mongo: { host: string | undefined, appName: string | undefined, diff --git a/apps/api/src/endpoints/trpc/systemSettings/get.ts b/apps/api/src/endpoints/trpc/systemSettings/get.ts index 5b999fc..1c21794 100644 --- a/apps/api/src/endpoints/trpc/systemSettings/get.ts +++ b/apps/api/src/endpoints/trpc/systemSettings/get.ts @@ -4,8 +4,10 @@ import { publicProcedure } from '../../../procedures/publicProcedure' export const get = publicProcedure .query(async () => { return { - appStoreUrls: config.appStoreUrls, - minimumRequiredMobileAppVersion: config.minimumRequiredMobileAppVersion, + mobileApp: { + minimumRequiredVersion: config.mobileApp.minimumRequiredVersion, + storeUrls: config.mobileApp.storeUrls, + }, } }) diff --git a/apps/mobile/package.json b/apps/mobile/package.json index f75b8e1..7fda7e9 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -8,7 +8,7 @@ "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", - "lint": "tsc --noEmit && eslint src --ext .ts", + "lint": "tsc --noEmit", "test": "jest", "test:watch": "jest --watch", "build:development:add-device": "eas device:create", diff --git a/apps/mobile/src/components/MinimumRequiredVersionGate.tsx b/apps/mobile/src/components/MinimumRequiredVersionGate.tsx index 4b6a325..269162e 100644 --- a/apps/mobile/src/components/MinimumRequiredVersionGate.tsx +++ b/apps/mobile/src/components/MinimumRequiredVersionGate.tsx @@ -25,7 +25,7 @@ export function MinimumRequiredVersionGate({ children }: { children: React.React }) const currentVersion = parseSemVer(config.version) - const minimumRequiredVersion = parseSemVer(data?.minimumRequiredMobileAppVersion) + const minimumRequiredVersion = parseSemVer(data?.mobileApp.minimumRequiredVersion) const isOutOfDate = !!currentVersion && !!minimumRequiredVersion && (compareSemVer(currentVersion, minimumRequiredVersion) < 0) @@ -33,7 +33,7 @@ export function MinimumRequiredVersionGate({ children }: { children: React.React return children } - const appStoreUrl = (Platform.OS === 'ios' && data?.appStoreUrls.ios.xyz) || (Platform.OS === 'android' && data?.appStoreUrls.android) || undefined + const appStoreUrl = (Platform.OS === 'ios' && data?.mobileApp.storeUrls.ios) || (Platform.OS === 'android' && data?.mobileApp.storeUrls.android) || undefined const onPressUpdate = () => { if (!appStoreUrl) {