Skip to content

Commit 2c0cf24

Browse files
authored
FEAT: Local API Setup (#1844)
* local kubb capabilities * explain KUBB_ENV a little better in def env * Update .env.default add new line at end
1 parent 09e3595 commit 2c0cf24

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.env.default

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ NEXT_PUBLIC_VERCEL_ENV=development
1111
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=
1212

1313
INDEX_COOP_API_V2_KEY=
14+
15+
16+
KUBB_ENV=local # local, or absent / anything else for prod

kubb.config.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@ import { pluginClient } from '@kubb/plugin-client'
33
import { pluginOas } from '@kubb/plugin-oas'
44
import { pluginTs } from '@kubb/plugin-ts'
55

6+
import dotenv from 'dotenv'
7+
8+
dotenv.config()
9+
10+
const isLocal = process.env.KUBB_ENV === 'local'
11+
612
const config = defineConfig({
713
root: '.',
814
input: {
9-
path: 'https://api.indexcoop.com/v2/docs/json',
15+
path: isLocal
16+
? 'http://127.0.0.1:4000/documentation/json' // Requires the indexcoop-api to be running locally
17+
: 'https://api.indexcoop.com/v2/docs/json',
1018
},
1119
output: {
1220
path: './src/gen',
@@ -35,7 +43,9 @@ const config = defineConfig({
3543
dateType: 'date',
3644
}),
3745
pluginClient({
38-
baseURL: 'https://api-q513.onrender.com',
46+
baseURL: isLocal
47+
? 'http://127.0.0.1:4000' // Requires the indexcoop-api to be running locally
48+
: 'https://api-q513.onrender.com',
3949
output: {
4050
path: './clients/axios',
4151
barrelType: 'propagate',

0 commit comments

Comments
 (0)