skip production data dir creation (#1164)

This commit is contained in:
ekko
2026-05-30 20:29:04 +08:00
committed by GitHub
parent fc35c74eb3
commit 4c3f025b8f
3 changed files with 12 additions and 9 deletions
+4 -3
View File
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'
import { homedir } from 'os'
import { join, resolve } from 'path'
import { getListenHost, getWebUiDataDir, getWebUiHome } from '../../packages/server/src/config'
import { getListenHost, getWebUiHome, shouldCreateWebUiDataDir } from '../../packages/server/src/config'
describe('server config', () => {
it('defaults to an IPv4 bind host', () => {
@@ -28,7 +28,8 @@ describe('server config', () => {
expect(getWebUiHome({ HERMES_WEBUI_STATE_DIR: ' ./tmp/hermes-state ' })).toBe(resolve('./tmp/hermes-state'))
})
it('keeps runtime data under the web-ui home', () => {
expect(getWebUiDataDir({ HERMES_WEB_UI_HOME: ' ./tmp/hermes-ui ' })).toBe(resolve('./tmp/hermes-ui/data'))
it('only creates the development data directory outside production', () => {
expect(shouldCreateWebUiDataDir({ NODE_ENV: 'development' })).toBe(true)
expect(shouldCreateWebUiDataDir({ NODE_ENV: 'production' })).toBe(false)
})
})