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

Resolve multi-word snakecase WEBPACKER_DEV_SERVER env values #2528

Merged
merged 1 commit into from Apr 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions package/__tests__/dev_server.js
Expand Up @@ -13,11 +13,13 @@ describe('DevServer', () => {
process.env.RAILS_ENV = 'development'
process.env.WEBPACKER_DEV_SERVER_HOST = '0.0.0.0'
process.env.WEBPACKER_DEV_SERVER_PORT = 5000
process.env.WEBPACKER_DEV_SERVER_DISABLE_HOST_CHECK = false

const devServer = require('../dev_server')
expect(devServer).toBeDefined()
expect(devServer.host).toEqual('0.0.0.0')
expect(devServer.port).toEqual('5000')
expect(devServer.disable_host_check).toBe(false)
})

test('with custom env prefix', () => {
Expand Down
2 changes: 1 addition & 1 deletion package/dev_server.js
Expand Up @@ -12,7 +12,7 @@ if (devServerConfig) {
const envPrefix = config.dev_server.env_prefix || 'WEBPACKER_DEV_SERVER'

Object.keys(devServerConfig).forEach((key) => {
const envValue = fetch(`${envPrefix}_${key.toUpperCase().replace(/_/g, '')}`)
const envValue = fetch(`${envPrefix}_${key.toUpperCase()}`)
if (envValue !== undefined) devServerConfig[key] = envValue
})
}
Expand Down