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: http url interpolation SOFIE-3310 #342

Merged
merged 6 commits into from
Aug 19, 2024
Merged

Conversation

Julusian
Copy link
Contributor

@Julusian Julusian commented Aug 16, 2024

About the Contributor

This pull request is posted on behalf of the NRK.

Type of Contribution

This is a Feature

New Behavior

This allows for defining the urls for the httpsend device, as well as urls passed to the renderers in sofieChef and casparcg, in a format that allows for taking fragments from the datastore.

For example an object could look something like:

{
  deviceType: 'httpSend',
  type: 'post',
  url: {
    key: `http://example.com/{{subPath}?apiKey={{apiKey}}`,
    args: {
      subPath: 'my-default', // Overriden by the datastore
      apiKey: '', // Taken from datastore
    }
  },
  $references: {
    'url.args.subPath': {
      datastoreKey: 'httpSubpath',
      overwrite: true,
    },
    'url.args.apiKey': {
      datastoreKey: 'httpApiKey',
      overwrite: false,
    }
  }
}

In this example, the 'apiKey' will be taken from the datastore, avoiding being baked into the rundown.
And the 'subPath' being taken from the datastore, means it can be changed while playing the rundown more easily.

The syntax of the interpolation matches the translations format we use elsewhere in Sofie.

This has been added to the httpSend and sofieChef devices, and to casparcg for the html content type

Testing Instructions

Other Information

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

@Julusian Julusian marked this pull request as ready for review August 16, 2024 09:24
@Julusian Julusian requested a review from a team as a code owner August 16, 2024 09:24
@Julusian Julusian changed the title feat: http url interpolation feat: http url interpolation SOFIE-3310 Aug 16, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 16, 2024

Codecov Report

Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Project coverage is 55.76%. Comparing base (7acebc8) to head (eb3c376).
Report is 4 commits behind head on release51.

Files Patch % Lines
packages/timeline-state-resolver/src/lib.ts 90.90% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           release51     #342      +/-   ##
=============================================
+ Coverage      55.71%   55.76%   +0.04%     
=============================================
  Files            129      129              
  Lines          10117    10130      +13     
  Branches        2446     2515      +69     
=============================================
+ Hits            5637     5649      +12     
- Misses          4103     4104       +1     
  Partials         377      377              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

packages/timeline-state-resolver-types/src/index.ts Outdated Show resolved Hide resolved
packages/timeline-state-resolver/src/lib.ts Outdated Show resolved Hide resolved
@Julusian Julusian changed the base branch from release51 to release52 August 19, 2024 11:21
@Julusian Julusian merged commit 01593a3 into release52 Aug 19, 2024
35 of 36 checks passed
@Julusian Julusian deleted the feat/http-interpolation branch August 19, 2024 11:23
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.

3 participants