Skip to content

Commit

Permalink
secret is now passed unconditionally to async handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
Konard committed Oct 22, 2023
1 parent 9d395dd commit 8b21c17
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions imports/container-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ export interface ContainerControllerOptions {

export interface NewContainerOptions {
handler: string,
code: string,
jwt: string,
data: any
forceName?: string;
forcePort?: number;
forceRestart?: boolean;
Expand All @@ -42,6 +39,7 @@ export interface Container {
export interface CallOptions {
code: string;
jwt: string,
secret?: string,
data: any
container: Container;
}
Expand Down
7 changes: 4 additions & 3 deletions imports/router/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,12 @@ export const useRunner = async ({
useRunnerDebug("handler4: ");

const jwt = await getJwt(handlerId, useRunnerDebug);
const container = await containerController.newContainer({ publish: +DOCKER ? false : true, forceRestart: true, handler: isolationProviderImageName, code, jwt, data});
const secret = process.env.DEEPLINKS_HASURA_SECRET; // TODO: check jwt's permissions (unsafe permission must be granted)
const container = await containerController.newContainer({ publish: +DOCKER ? false : true, forceRestart: true, handler: isolationProviderImageName});
useRunnerDebug('newContainerResult', container);
const initResult = await containerController.initHandler(container);
useRunnerDebug('initResult', initResult);
const callResult = await containerController.callHandler({ code, container, jwt, data });
const callResult = await containerController.callHandler({ code, container, jwt, secret, data });
useRunnerDebug('callResult', callResult);
return callResult;
}
Expand Down Expand Up @@ -628,7 +629,7 @@ export async function handlePort(handlePortLink: any, operation: 'INSERT' | 'DEL
const containerName = `deep-handle-port-${portValue}`;
handlePortDebug('INSERT containerName', containerName);

const container = await containerController.newContainer({ publish: true, forcePort: portValue, forceName: containerName, handler: dockerImage, code: null, jwt: null, data: { }});
const container = await containerController.newContainer({ publish: true, forcePort: portValue, forceName: containerName, handler: dockerImage});

handlePortDebug('INSERT newContainer result', container);

Expand Down
3 changes: 0 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,6 @@ const handleRoutes = async () => {
handler: image,
forceRestart: true,
publish: +DOCKER ? false : true,
code: '', // TODO: Remove
jwt: '',
data: {}
});
}

Expand Down

0 comments on commit 8b21c17

Please sign in to comment.