router icon indicating copy to clipboard operation
router copied to clipboard

[BaseUrl Variables] Allow baseUrl templates to use `$config` and `$env` variables

Open Hunter-apollo opened this issue 5 months ago • 2 comments

Description

Allow baseUrl property of sources to use $config and $env environment variables in URL templates.

Note: Additional validation is added to ensure no other variables (i.e. $args, $request, etc) are used in baseUrl templates.

Manual Testing

In addition to unit and integ tests added in this PR, the following source definition was manually tested with a local mock-RestAPI:

  @source(
    name: "user-api"
    http: {
      baseURL: "http://{$config.host}:{$env.PORT}"
    }
  )

Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • [X] PR description explains the motivation for the change and relevant context for reviewing
  • [ ] PR description links appropriate GitHub/Jira tickets (creating when necessary)
  • [ ] Changeset is included for user-facing changes
  • [x] Changes are compatible[^1]
  • [ ] Documentation[^2] completed
  • [ ] Performance impact assessed and acceptable
  • [ ] Metrics and logs are added[^3] and documented
  • Tests added and passing[^4]
    • [X] Unit tests
    • [X] Integration tests
    • [X] Manual tests, as necessary

Exceptions

Note any exceptions here

Notes

[^1]: It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. [^2]: Configuration is an important part of many changes. Where applicable please try to document configuration examples. [^3]: A lot of (if not most) features benefit from built-in observability and debug-level logs. Please read this guidance on metrics best-practices. [^4]: Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

Hunter-apollo avatar Jun 24 '25 13:06 Hunter-apollo