Skip to content

Commit

Permalink
chore: streaming spike (#8907)
Browse files Browse the repository at this point in the history
We need this PR to correctly set up CORS for streaming-related endpoints
in our spike and add the flag to our types.

---------

Co-authored-by: kwasniew <[email protected]>
  • Loading branch information
nunogois and kwasniew authored Dec 3, 2024
1 parent 3879821 commit 263aad4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/lib/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ export default async function getApp(
`${baseUriPath}/api/frontend*`,
corsOriginMiddleware(services, config),
);
app.options(
`${baseUriPath}/api/streaming*`,
corsOriginMiddleware(services, config),
);

app.use(baseUriPath, patMiddleware(config, services));

Expand Down
7 changes: 6 additions & 1 deletion src/lib/types/experimental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export type IFlagKey =
| 'showUserDeviceCount'
| 'deleteStaleUserSessions'
| 'memorizeStats'
| 'licensedUsers';
| 'licensedUsers'
| 'streaming';

export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;

Expand Down Expand Up @@ -279,6 +280,10 @@ const flags: IFlags = {
process.env.UNLEASH_EXPERIMENTAL_FLAG_LICENSED_USERS,
false,
),
streaming: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_STREAMING,
false,
),
};

export const defaultExperimentalOptions: IExperimentalOptions = {
Expand Down

0 comments on commit 263aad4

Please sign in to comment.