Skip to content

Commit

Permalink
Fix default URL for JavaScript, Python and Go. (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
tasn authored Jul 5, 2021
1 parent e35a250 commit ea743d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions go/svix.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ func Int32(i int32) *int32 {

func New(token string, options *SvixOptions) *Svix {
conf := openapi.NewConfiguration()
conf.Scheme = "https"
conf.Host = "api.svix.com"
if options != nil {
conf.Debug = options.Debug
if options.DebugURL != nil {
Expand Down
5 changes: 2 additions & 3 deletions javascript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
} from "./openapi/index";
export * from "./openapi/models/all";
export * from "./openapi/apis/exception";
import { server1 } from "./openapi/servers";
import * as utf8 from "@stablelib/utf8";
import * as base64 from "@stablelib/base64";
import * as sha256 from "fast-sha256";
Expand All @@ -54,9 +53,9 @@ export class Svix {
public readonly messageAttempt: MessageAttempt;

public constructor(token: string, options: SvixOptions = {}) {
const testUrl: string | undefined = (options as any)._testUrl;
const baseUrl: string = (options as any)._testUrl ?? "https://api.svix.com";

const baseServer = testUrl ? new ServerConfiguration<any>(testUrl, {}) : server1;
const baseServer = new ServerConfiguration<any>(baseUrl, {});

const bearerConfiguration: HttpBearerConfiguration = {
tokenProvider: {
Expand Down
5 changes: 4 additions & 1 deletion python/svix/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from .openapi_client.configuration import Configuration
from .openapi_client.model.message_status import MessageStatus

DEFAULT_SERVER_URL = "https://api.svix.com"


@dataclass
class SvixOptions:
Expand Down Expand Up @@ -223,7 +225,8 @@ class Svix:
_configuration: Configuration

def __init__(self, auth_token: str, options: SvixOptions = SvixOptions()) -> None:
self._configuration = Configuration(host=options._test_url, access_token=auth_token) # type: ignore
host = options._test_url or DEFAULT_SERVER_URL
self._configuration = Configuration(host=host, access_token=auth_token) # type: ignore

@property
def authentication(self) -> Authentication:
Expand Down

0 comments on commit ea743d8

Please sign in to comment.