mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-28 09:16:49 +01:00
434e379f9a
git-subtree-dir: plugin-server git-subtree-mainline:776b056b6d
git-subtree-split:01a99a4e26
30 lines
901 B
TypeScript
30 lines
901 B
TypeScript
import { getDefaultConfig, overrideWithEnv } from '../src/config/config'
|
|
|
|
test('overrideWithEnv 1', () => {
|
|
const defaultConfig = getDefaultConfig()
|
|
const env = {
|
|
KAFKA_ENABLED: 'false',
|
|
TASK_TIMEOUT: '3008',
|
|
CLICKHOUSE_HOST: '0.0.0.0',
|
|
BASE_DIR: undefined,
|
|
}
|
|
const config = overrideWithEnv(getDefaultConfig(), env)
|
|
|
|
expect(config.KAFKA_ENABLED).toEqual(false)
|
|
expect(config.TASK_TIMEOUT).toEqual(3008)
|
|
expect(config.CLICKHOUSE_HOST).toEqual('0.0.0.0')
|
|
expect(config.BASE_DIR).toEqual(defaultConfig.BASE_DIR)
|
|
})
|
|
|
|
test('overrideWithEnv 2', () => {
|
|
const defaultConfig = getDefaultConfig()
|
|
const env = {
|
|
KAFKA_ENABLED: '1',
|
|
TASK_TIMEOUT: '3008.12',
|
|
}
|
|
const config = overrideWithEnv(getDefaultConfig(), env)
|
|
|
|
expect(config.KAFKA_ENABLED).toEqual(true)
|
|
expect(config.TASK_TIMEOUT).toEqual(3008.12)
|
|
})
|