Skip to content

Commit 30f9508

Browse files
committed
Adding default speakeasy url
1 parent 1eae75a commit 30f9508

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/client.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const DEFAULT_SPEAKEASY_SERVER_URL = "grpc.speakeasyapi.dev:443"
2+
13
export type Config = {
24
apiKey: string;
35
};
@@ -16,9 +18,9 @@ export class SpeakeasyClient {
1618

1719
const serverUrl = process.env.SPEAKEASY_SERVER_URL;
1820
if (serverUrl == null) {
19-
throw new Error("Speakeasy Server URL is required");
21+
this.serverUrl = DEFAULT_SPEAKEASY_SERVER_URL;
22+
} else {
23+
this.serverUrl = serverUrl;
2024
}
21-
22-
this.serverUrl = serverUrl;
2325
}
2426
}

test/integration/express.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ jest.mock("../../src/transport", () => ({
1010

1111
describe("Simple Express Server", () => {
1212
describe("with an initalized speakeasy instance", () => {
13-
beforeEach(() => {
14-
process.env.SPEAKEASY_SERVER_URL = "";
15-
});
16-
afterEach(() => {
17-
process.env.SPEAKEASY_SERVER_URL = undefined;
18-
});
1913
it("properly calls transport once", () => {
2014
init({ apiKey: "" });
2115
const app = createSimpleExpressApp();

0 commit comments

Comments
 (0)