Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
* @generated-id: 320761608fb3
* Code originally generated by Speakeasy (https://speakeasy.com).
* 03-11-2026 - Modified by Galileo to add a new source for API URL path.
*/

import { Params, pathToFunc } from "./url.js";
import { HTTPClient } from "./http.js";
import { Logger } from "./logger.js";
import { RetryConfig } from "./retries.js";
import { Params, pathToFunc } from "./url.js";
import { GalileoConfig } from "./galileo-config.js";

/**
* Contains the list of servers available to the SDK
Expand Down Expand Up @@ -43,7 +44,8 @@ export type SDKOptions = {
};

export function serverURLFromOptions(options: SDKOptions): URL | null {
let serverURL = options.serverURL;
const config = GalileoConfig.get();
let serverURL = options.serverURL ?? config.apiUrl;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the type of apiUrl is apiUrl: string | undefined, is it possible that serverURL will be undefined? Can this happen in practice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only way this could happen was if no url was provided in "options" and ServerList is also empty, I believe Speakeasy assigns "string | undefined" as the type here to support this possibility.
Since config.apiUrl will (in the worst case) provide the default "https://api.galileo.ai" URL, not likely to happen now (compiler/lint rules could not figure that this is the case, so I'm maintaining the type for proper support).


const params: Params = {};

Expand Down
Loading