Skip to content

Commit f420a2c

Browse files
authored
read the value of NDC_OAS_BASE_URL at runtime instead of build time (#66)
completes: https://linear.app/hasura/issue/ENT-148/openapi-connector-should-use-the-env-var-for-base-url
1 parent 61c3fd7 commit f420a2c

27 files changed

+28
-26
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Read the value of `NDC_OAS_BASE_URL` at runtime instead of build time ([#66](https://github.com/hasura/ndc-open-api-lambda/pull/66))
6+
57
## [[1.0.0](https://github.com/hasura/ndc-open-api-lambda/releases/tag/v1.0.0)] 2024-11-07
68

79
## [[0.2.0](https://github.com/hasura/ndc-open-api-lambda/releases/tag/v0.2.0)] 2024-09-26

templates/custom/http-client.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export enum ContentType {
4848
}
4949

5050
export class HttpClient<SecurityDataType = unknown> {
51-
public baseUrl: string = "<%~ apiConfig.baseUrl %>";
51+
public baseUrl: string = "";
5252
private securityData: SecurityDataType | null = null;
5353
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
5454
private abortControllers = new Map<CancelToken, AbortController>();

templates/functions/functions.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Api, <%~ it.importList.join(', ') %> } from './api';
44
import * as hasuraSdk from "@hasura/ndc-lambda-sdk"
55

66
const api = new Api({
7-
baseUrl: '<%~ baseUrl %>',
7+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
88
});
99

1010
<% for (let routeFunction of it.routeFunctions) { %>

tests/test-data/golden-files/1password

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from "./api";
1212

1313
const api = new Api({
14-
baseUrl: "",
14+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
1515
});
1616

1717
/**

tests/test-data/golden-files/acko-insurance

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as hasuraSdk from "@hasura/ndc-lambda-sdk";
22
import { Api, ConsentArtifactSchema } from "./api";
33

44
const api = new Api({
5-
baseUrl: "",
5+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
66
});
77

88
/**

tests/test-data/golden-files/adobe

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from "./api";
1010

1111
const api = new Api({
12-
baseUrl: "http://localhost:13191",
12+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
1313
});
1414

1515
/**

tests/test-data/golden-files/amazon-workspaces

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ import {
134134
} from "./api";
135135

136136
const api = new Api({
137-
baseUrl: "",
137+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
138138
});
139139

140140
/**

tests/test-data/golden-files/apideck-crm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import {
6161
} from "./api";
6262

6363
const api = new Api({
64-
baseUrl: "",
64+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
6565
});
6666

6767
/**

tests/test-data/golden-files/apple-store-connect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ import {
168168
} from "./api";
169169

170170
const api = new Api({
171-
baseUrl: "",
171+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
172172
});
173173

174174
/**

tests/test-data/golden-files/atlassian-jira

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ import {
300300
} from "./api";
301301

302302
const api = new Api({
303-
baseUrl: "",
303+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
304304
});
305305

306306
/**

tests/test-data/golden-files/auckland-museum

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as hasuraSdk from "@hasura/ndc-lambda-sdk";
22
import { Api } from "./api";
33

44
const api = new Api({
5-
baseUrl: "",
5+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
66
});
77

88
/**

tests/test-data/golden-files/aws-cloud-map

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import {
5555
} from "./api";
5656

5757
const api = new Api({
58-
baseUrl: "",
58+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
5959
});
6060

6161
/**

tests/test-data/golden-files/azure-alerts-management

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as hasuraSdk from "@hasura/ndc-lambda-sdk";
22
import { AlertRule, AlertRulePatchObject, AlertRulesList, Api } from "./api";
33

44
const api = new Api({
5-
baseUrl: "",
5+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
66
});
77

88
/**

tests/test-data/golden-files/azure-application-insights

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "./api";
99

1010
const api = new Api({
11-
baseUrl: "",
11+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
1212
});
1313

1414
/**

tests/test-data/golden-files/circleci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from "./api";
2121

2222
const api = new Api({
23-
baseUrl: "http://localhost:13191",
23+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
2424
});
2525

2626
/**

tests/test-data/golden-files/demo-blog-api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as hasuraSdk from "@hasura/ndc-lambda-sdk";
22
import { Api, MainAuthor, MainBlog, MainBlogRequestDto } from "./api";
33

44
const api = new Api({
5-
baseUrl: "http://localhost:9191",
5+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
66
});
77

88
/**

tests/test-data/golden-files/geomag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as hasuraSdk from "@hasura/ndc-lambda-sdk";
22
import { Api } from "./api";
33

44
const api = new Api({
5-
baseUrl: "",
5+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
66
});
77

88
/**

tests/test-data/golden-files/github

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ import {
246246
} from "./api";
247247

248248
const api = new Api({
249-
baseUrl: "",
249+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
250250
});
251251

252252
/**

tests/test-data/golden-files/gitlab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import {
6363
} from "./api";
6464

6565
const api = new Api({
66-
baseUrl: "",
66+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
6767
});
6868

6969
/**

tests/test-data/golden-files/google-adsense

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from "./api";
2121

2222
const api = new Api({
23-
baseUrl: "http://localhost:13191",
23+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
2424
});
2525

2626
/**

tests/test-data/golden-files/google-home

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import {
3838
} from "./api";
3939

4040
const api = new Api({
41-
baseUrl: "http://localhost:13191",
41+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
4242
});
4343

4444
/**

tests/test-data/golden-files/instagram

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
} from "./api";
2020

2121
const api = new Api({
22-
baseUrl: "",
22+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
2323
});
2424

2525
/**

tests/test-data/golden-files/kubernetes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ import {
146146
} from "./api";
147147

148148
const api = new Api({
149-
baseUrl: "http://localhost:9191",
149+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
150150
});
151151

152152
/**

tests/test-data/golden-files/microsoft-workload-monitor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from "./api";
1414

1515
const api = new Api({
16-
baseUrl: "",
16+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
1717
});
1818

1919
/**

tests/test-data/golden-files/petstore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as hasuraSdk from "@hasura/ndc-lambda-sdk";
22
import { Api, ApiResponse, Order, Pet, User } from "./api";
33

44
const api = new Api({
5-
baseUrl: "http://localhost:13191",
5+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
66
});
77

88
/**

tests/test-data/golden-files/spotify

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import {
4141
} from "./api";
4242

4343
const api = new Api({
44-
baseUrl: "",
44+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
4545
});
4646

4747
/**

tests/test-data/golden-files/trello

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ import {
126126
} from "./api";
127127

128128
const api = new Api({
129-
baseUrl: "",
129+
baseUrl: `${process.env.NDC_OAS_BASE_URL}`,
130130
});
131131

132132
/**

0 commit comments

Comments
 (0)