Skip to content

Commit

Permalink
feat: allow overriding platform.apiRuntime (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrich authored Jul 2, 2023
1 parent 036cf64 commit fd8241a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ export default {
'redirect': '/login',
'statusCode': 302
}
},
platform: {
apiRuntime: 'node:18'
}
}
})
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ export function generateConfig(customStaticWebAppConfig, appDir) {
rewrite: ssrFunctionRoute
},
platform: {
apiRuntime: 'node:16'
apiRuntime: 'node:16',
...customStaticWebAppConfig.platform
}
};

Expand Down
4 changes: 4 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ describe('generateConfig', () => {

test('accepts custom config', () => {
const result = generateConfig({
platform: {
apiRuntime: 'node:18'
},
globalHeaders: { 'X-Foo': 'bar' }
});
expect(result.globalHeaders).toStrictEqual({ 'X-Foo': 'bar' });
expect(result.platform.apiRuntime).toBe('node:18');
});
});

Expand Down

0 comments on commit fd8241a

Please sign in to comment.