Skip to content

fix: allow for custom URL and inital testing#2

Merged
KT-Doan merged 20 commits intomainfrom
fix/staging-project-api-url
Jan 8, 2026
Merged

fix: allow for custom URL and inital testing#2
KT-Doan merged 20 commits intomainfrom
fix/staging-project-api-url

Conversation

@KT-Doan
Copy link
Copy Markdown
Collaborator

@KT-Doan KT-Doan commented Dec 24, 2025

Description

Add support for custom API URLs to enable testing against non-production environments (staging, dev, self-hosted).

Changes:

  • Add console_api_url provider attribute to override the Console API endpoint
  • Add project_api_url provider attribute to override the Project API URL template
  • Override SDK OperationServers configuration to use custom URLs when specified
  • Default to production URLs when not specified (backwards compatible)

Related Issues

Fixes: #1

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING guide
  • My code follows the existing code style
  • I have added tests that prove my fix/feature works
  • I have updated documentation as needed
  • All new and existing tests pass (make test)
  • I have run the linter (make lint)

Testing

Describe how you tested these changes:

  • Unit tests
  • Acceptance tests
  • Manual testing

Manual Testing Details

Screenshots/Output

Apply complete! Resources: 8 added, 0 changed, 0 destroyed.

Outputs:

identity_schema_id = "customer"
project_api_key = <sensitive>
project_id = "e9f3a2b1-..."
project_slug = "terraform-two-phase-test-abc123"

The provider was hardcoding the project API URL to
`https://{slug}.projects.oryapis.com`, which doesn't work for
staging environments that use `projects.staging.oryapis.dev`.

This adds a new `project_api_url` provider attribute that accepts
a URL template with `%s` as placeholder for the project slug.

Examples:
- Production (default): `https://%s.projects.oryapis.com`
- Staging: `https://%s.projects.staging.oryapis.dev`

The attribute can also be set via the `ORY_PROJECT_API_URL`
environment variable.
The Ory SDK has hardcoded operation-specific server URLs for all console
API operations (ProjectAPI, WorkspaceAPI, EventsAPI) in the default
Configuration. These operation servers override the main Servers config,
causing all console API requests to be sent to production
(api.console.ory.sh) even when console_api_url is set to a staging URL.

This fix explicitly overrides OperationServers for all console API
operations to use the configured console_api_url, enabling proper support
for staging and custom API endpoints.
@KT-Doan KT-Doan requested a review from piotrmsc December 24, 2025 11:35
Copy link
Copy Markdown

@piotrmsc piotrmsc left a comment

Choose a reason for hiding this comment

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

would be greate to add also on this PR already small GHA to execute go tests on files changed *.go

@KT-Doan KT-Doan requested a review from piotrmsc January 2, 2026 12:55
Copy link
Copy Markdown

@piotrmsc piotrmsc left a comment

Choose a reason for hiding this comment

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

small initial round with some ideas for improvements

- name: Checkout
uses: actions/checkout@v4

- name: Install jq
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

it's a dependency used in script, let's add it as dependency and then here just set up all dependencies

Comment on lines +20 to +44
enable_keto_tests:
description: 'Enable Keto/relationship tests'
required: false
default: true
type: boolean
enable_b2b_tests:
description: 'Enable B2B/organization tests'
required: false
default: true
type: boolean
enable_social_provider_tests:
description: 'Enable social provider tests'
required: false
default: true
type: boolean
enable_schema_tests:
description: 'Enable identity schema tests'
required: false
default: true
type: boolean
enable_project_tests:
description: 'Enable project create/delete tests'
required: false
default: true
type: boolean
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What if we instead have input representing run all with default true, and then the post-merge, aka main pipeline, will run all tests by default, and if you want to manually trigger, then you can individually select which components/areas you want to test?

Comment on lines +6 to +10
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- '.github/workflows/acceptance-test.yml'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: I think will be better to use path filter which allows us to extend in the pipeline with conditional logic

@KT-Doan KT-Doan changed the title fix: allow for custom URL fix: allow for custom URL and inital testing Jan 8, 2026
@KT-Doan KT-Doan merged commit 246dbe5 into main Jan 8, 2026
2 checks passed
@KT-Doan KT-Doan deleted the fix/staging-project-api-url branch January 8, 2026 06:36
@KT-Doan KT-Doan self-assigned this Jan 26, 2026
KT-Doan added a commit that referenced this pull request Mar 4, 2026
fix: allow for custom URL and inital testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support custom API URLs for non-production environments

2 participants