Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions internal/platform/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Platform struct {
JWT string
DefaultProjectID string
DefaultOrganizationID string
APIUrl string
}

func (p *Platform) CreateClient(client *http.Client, _ string, _ string) (*scw.Client, error) {
Expand All @@ -32,6 +33,10 @@ func (p *Platform) CreateClient(client *http.Client, _ string, _ string) (*scw.C
opts = append(opts, scw.WithDefaultOrganizationID(p.DefaultOrganizationID))
}

if p.APIUrl != "" {
opts = append(opts, scw.WithAPIURL(p.APIUrl))
}

return scw.NewClient(opts...)
}

Expand Down
2 changes: 2 additions & 0 deletions internal/wasm/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type RunConfig struct {
JWT string `js:"jwt"`
DefaultProjectID string `js:"defaultProjectID"`
DefaultOrganizationID string `js:"defaultOrganizationID"`
APIUrl string `js:"apiUrl"`
}

type RunResponse struct {
Expand All @@ -44,6 +45,7 @@ func runCommand(cfg *RunConfig, args []string, stdout io.Writer, stderr io.Write
JWT: cfg.JWT,
DefaultProjectID: cfg.DefaultProjectID,
DefaultOrganizationID: cfg.DefaultOrganizationID,
APIUrl: cfg.APIUrl,
},
})

Expand Down
1 change: 1 addition & 0 deletions wasm/cli.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export type RunConfig = {
jwt: string
defaultProjectID: string
defaultOrganizationID: string
apiUrl: string
}

export type RunResponse = {
Expand Down
2 changes: 1 addition & 1 deletion wasm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scaleway/scaleway-cli-wasm",
"version": "0.0.10",
"version": "0.0.11",
"description": "",
"type": "module",
"main": "index.js",
Expand Down
4 changes: 3 additions & 1 deletion wasm/src/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ const emptyConfig = (
override?: {
jwt?: string,
defaultProjectID?: string,
defaultOrganizationID?: string
defaultOrganizationID?: string,
apiUrl?: string
}
): RunConfig => ({
jwt: override?.jwt || "",
defaultProjectID: override?.defaultProjectID || "",
defaultOrganizationID: override?.defaultOrganizationID || "",
apiUrl: override?.apiUrl || ""
})

describe('With wasm CLI', async () => {
Expand Down