Skip to content

Commit

Permalink
fix: JUDOSCALE_URL should take priority over RENDER_SERVICE_ID on Render
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlogic committed Dec 31, 2024
1 parent 4da312b commit 4dffebf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/node-core/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function getDefaultOptions() {

if (process.env.RENDER_INSTANCE_ID) {
containerID = process.env.RENDER_INSTANCE_ID.replace(process.env.RENDER_SERVICE_ID, '').replace('-', '')
apiBaseUrl = `https://adapter.judoscale.com/api/${process.env.RENDER_SERVICE_ID}`
apiBaseUrl ||= `https://adapter.judoscale.com/api/${process.env.RENDER_SERVICE_ID}`
}

if (process.env.ECS_CONTAINER_METADATA_URI) {
Expand Down
9 changes: 9 additions & 0 deletions packages/node-core/test/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ describe('Config', () => {
expect(new Config()).toHaveProperty('container', 'renderInstanceId')
})

test('JUDOSCALE_URL overrides RENDER_INSTANCE_ID for render', () => {
process.env.JUDOSCALE_URL = 'HO HO HO'
process.env.RENDER_INSTANCE_ID = 'renderServiceId-renderInstanceId'
process.env.RENDER_SERVICE_ID = 'renderServiceId'

expect(new Config()).toHaveProperty('api_base_url', 'HO HO HO')
expect(new Config()).toHaveProperty('container', 'renderInstanceId')
})

test('has container property for ECS', () => {
process.env.ECS_CONTAINER_METADATA_URI = 'ecs-service/container-id'
expect(new Config()).toHaveProperty('container', 'container-id')
Expand Down

0 comments on commit 4dffebf

Please sign in to comment.