Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update endpoint to new ha service #44

Merged
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
2 changes: 1 addition & 1 deletion internal/clients/namespace/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (c *Client) Get(ctx context.Context, path string) (*http.Request, error) {
}

func (c *Client) getWorkspaceConfigsReader(ctx context.Context) (io.ReadCloser, error) {
req, err := c.Get(ctx, "/data-plane/v2/namespaces/"+c.Identity.Namespace+"/config")
req, err := c.Get(ctx, "/configuration/v2/namespaces/"+c.Identity.Namespace)
if err != nil {
return nil, err
}
Expand Down
11 changes: 9 additions & 2 deletions sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ import (
"github.com/rudderlabs/rudder-go-kit/logger"
)

const defaultBaseUrl = "https://api.rudderstack.com"
const (
defaultBaseUrl = "https://api.rudderstack.com"
defaultBaseUrlV2 = "https://dp.api.rudderstack.com"
)

type ControlPlane struct {
baseUrl *url.URL
baseUrlV2 *url.URL
workspaceIdentity *identity.Workspace
namespaceIdentity *identity.Namespace
adminCredentials *identity.AdminCredentials
Expand Down Expand Up @@ -53,8 +57,10 @@ type RequestDoer interface {

func New(options ...Option) (*ControlPlane, error) {
url, _ := url.Parse(defaultBaseUrl)
urlV2, _ := url.Parse(defaultBaseUrlV2)
cp := &ControlPlane{
baseUrl: url,
baseUrlV2: urlV2,
log: logger.NOP,
pollingInterval: 1 * time.Second,
configsCache: &cache.WorkspaceConfigCache{},
Expand Down Expand Up @@ -83,6 +89,7 @@ func (cp *ControlPlane) setupClients() error {
}

baseClient := &base.Client{HTTPClient: cp.httpClient, BaseURL: cp.baseUrl}
baseClientV2 := &base.Client{HTTPClient: cp.httpClient, BaseURL: cp.baseUrlV2}

// set admin client
if cp.adminCredentials != nil {
Expand All @@ -101,7 +108,7 @@ func (cp *ControlPlane) setupClients() error {
}
} else if cp.namespaceIdentity != nil {
cp.Client = &namespace.Client{
Client: baseClient,
Client: baseClientV2,
Identity: cp.namespaceIdentity,
}
} else {
Expand Down
Loading