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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ orkes config delete --profile staging -y
- `config list` shows all available profiles in `~/.conductor-cli/` directory
- Delete operations require confirmation unless `-y` flag is used
- Both positional argument and `--profile` flag work for delete command
- Server URLs can be provided with or without `/api` suffix (e.g., `http://localhost:8080` or `http://localhost:8080/api`).

## Workflow Metadata Management

Expand Down
7 changes: 7 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"net/http"
"os"
"path/filepath"
"strings"
"time"
)

Expand Down Expand Up @@ -76,6 +77,12 @@ var rootCmd = &cobra.Command{
url = "http://localhost:8080/api"
}

// Ensure URL has /api suffix for SDK
url = strings.TrimSuffix(url, "/")
if !strings.HasSuffix(url, "/api") {
url = url + "/api"
}

log.Debug("Using Server ", url)
apiClient := client.NewAPIClient(settings.NewAuthenticationSettings(key, secret), settings.NewHttpSettings(url))

Expand Down
38 changes: 38 additions & 0 deletions test/e2e/config.bats
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,41 @@ teardown() {
# Clean up
rm -f ~/.conductor-cli/config-e2e-default-check.yaml
}

@test "13. Server URL without /api suffix is accepted" {
# Test URL without /api
run bash -c "./orkes --server http://example.com --auth-key key --profile e2e-noapi config save 2>/dev/null"
[ "$status" -eq 0 ]

# Verify config was saved with user's input (not normalized)
[ -f ~/.conductor-cli/config-e2e-noapi.yaml ]
grep -q "server: http://example.com" ~/.conductor-cli/config-e2e-noapi.yaml

# Clean up
rm -f ~/.conductor-cli/config-e2e-noapi.yaml
}

@test "14. Server URL with /api suffix is accepted" {
# Test URL with /api
run bash -c "./orkes --server http://example.com/api --auth-key key --profile e2e-withapi config save 2>/dev/null"
[ "$status" -eq 0 ]

# Verify config was saved
[ -f ~/.conductor-cli/config-e2e-withapi.yaml ]

# Clean up
rm -f ~/.conductor-cli/config-e2e-withapi.yaml
}

@test "15. Server URL with trailing slash is handled" {
# Test URL with trailing slash
run bash -c "./orkes --server http://example.com/ --auth-key key --profile e2e-slash config save 2>/dev/null"
[ "$status" -eq 0 ]

# Verify config was saved with trailing slash (user's input preserved)
[ -f ~/.conductor-cli/config-e2e-slash.yaml ]
grep -q "server: http://example.com/" ~/.conductor-cli/config-e2e-slash.yaml

# Clean up
rm -f ~/.conductor-cli/config-e2e-slash.yaml
}
Loading