Skip to content

Commit 9e8cf4f

Browse files
committed
infra: deployment configuration
1 parent 7ce5ccb commit 9e8cf4f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ The public-facing EzClaim web app lets ACSSZ members submit reimbursements witho
1414
pnpm install
1515
pnpm dev
1616
```
17-
The app assumes the API at `http://localhost:8080`; override via `NEXT_PUBLIC_API_BASE_URL` in `.env.local` when needed.
17+
Development defaults to the API at `http://localhost:8080`; production builds fall back to
18+
`https://ezclaim.liuzisen.com`. Override via `NEXT_PUBLIC_API_BASE_URL` in `.env.local` (or
19+
`.env.production`) when needed.
1820

1921
## License
2022
Licensed under the Do What The Fuck You Want To Public License (WTFPL). See [`LICENCE`](LICENCE).

src/lib/api.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ export class HttpError extends Error {
1010
}
1111
}
1212

13-
const API_BASE = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8080';
13+
const defaultApiBase =
14+
process.env.NODE_ENV === 'production'
15+
? 'https://ezclaim.liuzisen.com'
16+
: 'http://localhost:8080';
17+
18+
const API_BASE = process.env.NEXT_PUBLIC_API_BASE_URL || defaultApiBase;
1419

1520
async function http<T>(path: string, init?: RequestInit): Promise<T> {
1621
const hasBody = typeof init?.body !== 'undefined' && init?.body !== null;

0 commit comments

Comments
 (0)